2024-12-11 22:26:55 +01:00
|
|
|
--- a/net/minecraft/server/commands/DifficultyCommand.java
|
|
|
|
+++ b/net/minecraft/server/commands/DifficultyCommand.java
|
|
|
|
@@ -44,11 +44,12 @@
|
|
|
|
|
|
|
|
public static int setDifficulty(CommandSourceStack source, Difficulty difficulty) throws CommandSyntaxException {
|
|
|
|
MinecraftServer minecraftserver = source.getServer();
|
|
|
|
+ net.minecraft.server.level.ServerLevel worldServer = source.getLevel(); // CraftBukkit
|
|
|
|
|
|
|
|
- if (minecraftserver.getWorldData().getDifficulty() == difficulty) {
|
|
|
|
+ if (worldServer.getDifficulty() == difficulty) { // CraftBukkit
|
|
|
|
throw DifficultyCommand.ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
|
|
|
|
} else {
|
|
|
|
- minecraftserver.setDifficulty(difficulty, true);
|
2020-06-28 09:59:10 +02:00
|
|
|
+ minecraftserver.setDifficulty(worldServer, difficulty, true); // Paper - per level difficulty; don't skip other difficulty-changing logic (fix upstream's fix)
|
2024-12-11 22:26:55 +01:00
|
|
|
source.sendSuccess(() -> {
|
|
|
|
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
|
|
|
|
}, true);
|