9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 18:39:23 +00:00
Files
Leaf/patches/server/0085-Matter-Seed-Command.patch

45 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Apehum <apehumchik@gmail.com>
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 342362c217df5476a927eb54cef3cafcea3889fd..a05e0d998fffd8a50643f118b2ddf4af6804cc14 100644
--- a/src/main/java/net/minecraft/server/commands/SeedCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SeedCommand.java
@@ -6,6 +6,10 @@ 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<CommandSourceStack> dispatcher, boolean dedicated) {
dispatcher.register(Commands.literal("seed").requires((source) -> {
@@ -16,7 +20,19 @@ public class SeedCommand {
context.getSource().sendSuccess(() -> {
return Component.translatable("commands.seed.success", component);
}, false);
- return (int)l;
+
+ // 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;
}));
}
}