mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-06 15:51:31 +00:00
Matter: Add Secure Seed
This commit is contained in:
1017
patches/server/0083-Matter-Secure-Seed.patch
Normal file
1017
patches/server/0083-Matter-Secure-Seed.patch
Normal file
File diff suppressed because it is too large
Load Diff
55
patches/server/0084-Matter-Seed-Command.patch
Normal file
55
patches/server/0084-Matter-Seed-Command.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
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..5f426ea20cd777f007212978402edf9af056fc54 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/SeedCommand.java
|
||||
@@ -6,17 +6,37 @@ import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.ComponentUtils;
|
||||
|
||||
+// Leaf start - Matter - Feature Secure Seed
|
||||
+import net.minecraft.ChatFormatting;
|
||||
+import net.minecraft.network.chat.ClickEvent;
|
||||
+import net.minecraft.network.chat.HoverEvent;
|
||||
+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) -> {
|
||||
return !dedicated || source.hasPermission(2);
|
||||
}).executes((context) -> {
|
||||
long l = context.getSource().getLevel().getSeed();
|
||||
- Component component = ComponentUtils.copyOnClickText(String.valueOf(l));
|
||||
- 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 seedComponent = ComponentUtils.wrapInSquareBrackets(Component.literal(String.valueOf(l)).withStyle((style) -> style.withColor(ChatFormatting.GREEN).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, String.valueOf(l))).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.copy.click"))).withInsertion(String.valueOf(l))));
|
||||
+ Component featureSeedComponent = ComponentUtils.wrapInSquareBrackets(Component.translatable("chat.copy.click").withStyle((style) -> style.withColor(ChatFormatting.GREEN).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, seedStr)).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.copy.click"))).withInsertion(seedStr)));
|
||||
+
|
||||
+ context.getSource().sendSuccess(() -> Component.translatable("commands.seed.success", seedComponent), false);
|
||||
+ context.getSource().sendSuccess(() -> Component.translatable(("Feature seed: %s"), featureSeedComponent), false);
|
||||
+ } else {
|
||||
+ Component component = ComponentUtils.copyOnClickText(String.valueOf(l));
|
||||
+ context.getSource().sendSuccess(() -> Component.translatable("commands.seed.success", component), false);
|
||||
+ }
|
||||
+ // Leaf end - Matter
|
||||
+
|
||||
+ return (int) l;
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user