From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Apehum Date: Thu, 16 Dec 2021 04:23:40 +0800 Subject: [PATCH] Matter: Seed Command Original license: GPLv3 Original project: https://github.com/plasmoapp/matter diff --git a/src/main/java/net/minecraft/server/commands/SeedCommand.java b/src/main/java/net/minecraft/server/commands/SeedCommand.java index 0b500b19a99fa6c2740c0db350a166462668df9c..e0516ed524fe55277adb3e2c4571ca40c334c5ef 100644 --- a/src/main/java/net/minecraft/server/commands/SeedCommand.java +++ b/src/main/java/net/minecraft/server/commands/SeedCommand.java @@ -6,12 +6,27 @@ import net.minecraft.commands.Commands; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentUtils; +// Leaf start - Matter - Feature Secure Seed +import su.plo.matter.Globals; +// Leaf end - Matter + public class SeedCommand { public static void register(CommandDispatcher dispatcher, boolean dedicated) { dispatcher.register(Commands.literal("seed").requires(source -> !dedicated || source.hasPermission(2)).executes(context -> { long l = context.getSource().getLevel().getSeed(); Component component = ComponentUtils.copyOnClickText(String.valueOf(l)); context.getSource().sendSuccess(() -> Component.translatable("commands.seed.success", component), false); + + // Leaf start - Matter - SecureSeed Command + if (org.dreeam.leaf.config.modules.misc.SecureSeed.enabled) { + Globals.setupGlobals(context.getSource().getLevel()); + String seedStr = Globals.seedToString(Globals.worldSeed); + Component featureSeedComponent = ComponentUtils.copyOnClickText(seedStr); + + context.getSource().sendSuccess(() -> Component.translatable(("Feature seed: %s"), featureSeedComponent), false); + } + // Leaf end - Matter + return (int)l; })); }