PaperMC/paper-server/patches/sources/net/minecraft/server/commands/GameRuleCommand.java.patch

24 lines
1.2 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/commands/GameRuleCommand.java
+++ b/net/minecraft/server/commands/GameRuleCommand.java
2020-12-21 01:41:44 +01:00
@@ -34,9 +34,9 @@
static <T extends GameRules.Value<T>> int setRule(CommandContext<CommandSourceStack> context, GameRules.Key<T> key) {
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) context.getSource();
- T t0 = commandlistenerwrapper.getServer().getGameRules().getRule(key);
+ T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit
2020-12-21 01:41:44 +01:00
- t0.setFromArgument(context, "value");
+ t0.setFromArgument(context, "value", key); // Paper - Add WorldGameRuleChangeEvent
commandlistenerwrapper.sendSuccess(() -> {
2020-12-21 01:41:44 +01:00
return Component.translatable("commands.gamerule.set", key.getId(), t0.toString());
}, true);
@@ -44,7 +44,7 @@
}
static <T extends GameRules.Value<T>> int queryRule(CommandSourceStack source, GameRules.Key<T> key) {
- T t0 = source.getServer().getGameRules().getRule(key);
+ T t0 = source.getLevel().getGameRules().getRule(key); // CraftBukkit
source.sendSuccess(() -> {
return Component.translatable("commands.gamerule.query", key.getId(), t0.toString());