net.minecraft.server.commands

This commit is contained in:
Jake Potrebic
2024-12-14 13:42:43 -08:00
parent 973fe2a945
commit 93114d09f2
40 changed files with 460 additions and 518 deletions

View File

@@ -0,0 +1,20 @@
--- 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();
}