1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
--- a/net/minecraft/server/commands/GameRuleCommand.java
+++ b/net/minecraft/server/commands/GameRuleCommand.java
@@ -27,16 +30,22 @@
}
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");
- commandSourceStack.sendSuccess(() -> Component.translatable("commands.gamerule.set", gameRule.getId(), rule.toString()), true);
- return rule.getCommandResult();
+ CommandSourceStack commandlistenerwrapper = (CommandSourceStack) source.getSource();
+ T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(gameRule); // CraftBukkit
+
+ t0.setFromArgument(source, "value");
+ commandlistenerwrapper.sendSuccess(() -> {
+ return Component.translatable("commands.gamerule.set", gameRule.getId(), t0.toString());
+ }, true);
+ return t0.getCommandResult();
}
static <T extends GameRules.Value<T>> int queryRule(CommandSourceStack source, GameRules.Key<T> gameRule) {
- T rule = source.getServer().getGameRules().getRule(gameRule);
- source.sendSuccess(() -> Component.translatable("commands.gamerule.query", gameRule.getId(), rule.toString()), false);
- return rule.getCommandResult();
+ T t0 = source.getLevel().getGameRules().getRule(gameRule); // CraftBukkit
+
+ source.sendSuccess(() -> {
+ return Component.translatable("commands.gamerule.query", gameRule.getId(), t0.toString());
+ }, false);
+ return t0.getCommandResult();
}
}
|