blob: b15cddbe16898bea821e7947ebc18cebef684465 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
--- a/net/minecraft/server/commands/DifficultyCommand.java
+++ b/net/minecraft/server/commands/DifficultyCommand.java
@@ -31,12 +43,16 @@
}
public static int setDifficulty(CommandSourceStack source, Difficulty difficulty) throws CommandSyntaxException {
- MinecraftServer server = source.getServer();
- if (server.getWorldData().getDifficulty() == difficulty) {
- throw ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
+ MinecraftServer minecraftserver = source.getServer();
+ net.minecraft.server.level.ServerLevel worldServer = source.getLevel(); // CraftBukkit
+
+ if (worldServer.getDifficulty() == difficulty) { // CraftBukkit
+ throw DifficultyCommand.ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
} else {
- server.setDifficulty(difficulty, true);
- source.sendSuccess(() -> Component.translatable("commands.difficulty.success", difficulty.getDisplayName()), true);
+ worldServer.serverLevelData.setDifficulty(difficulty); // CraftBukkit
+ source.sendSuccess(() -> {
+ return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
+ }, true);
return 0;
}
}
|