Paper/paper-server/patches/sources/net/minecraft/server/commands/GameRuleCommand.java.patch
2024-12-14 13:42:45 -08:00

21 lines
1.3 KiB
Diff

--- a/net/minecraft/server/commands/GameRuleCommand.java
+++ b/net/minecraft/server/commands/GameRuleCommand.java
@@ -30,14 +_,14 @@
static <T extends GameRules.Value<T>> int setRule(CommandContext<CommandSourceStack> source, GameRules.Key<T> gameRule) {
CommandSourceStack commandSourceStack = source.getSource();
- T rule = commandSourceStack.getServer().getGameRules().getRule(gameRule);
- rule.setFromArgument(source, "value");
+ T rule = commandSourceStack.getLevel().getGameRules().getRule(gameRule); // CraftBukkit
+ rule.setFromArgument(source, "value", gameRule); // Paper - Add WorldGameRuleChangeEvent
commandSourceStack.sendSuccess(() -> Component.translatable("commands.gamerule.set", gameRule.getId(), rule.toString()), true);
return rule.getCommandResult();
}
static <T extends GameRules.Value<T>> int queryRule(CommandSourceStack source, GameRules.Key<T> gameRule) {
- T rule = source.getServer().getGameRules().getRule(gameRule);
+ T rule = source.getLevel().getGameRules().getRule(gameRule); // CraftBukkit
source.sendSuccess(() -> Component.translatable("commands.gamerule.query", gameRule.getId(), rule.toString()), false);
return rule.getCommandResult();
}