PaperMC/paper-server/patches/sources/net/minecraft/server/commands/DifficultyCommand.java.patch
Nassim Jahnke 7caf863b52
Small diff cleanups from patch updating
And remove a dumb log change in PacketEncoder
2024-12-17 16:50:59 +01:00

15 lines
934 B
Diff

--- a/net/minecraft/server/commands/DifficultyCommand.java
+++ b/net/minecraft/server/commands/DifficultyCommand.java
@@ -31,10 +_,10 @@
public static int setDifficulty(CommandSourceStack source, Difficulty difficulty) throws CommandSyntaxException {
MinecraftServer server = source.getServer();
- if (server.getWorldData().getDifficulty() == difficulty) {
+ if (source.getLevel().getDifficulty() == difficulty) { // CraftBukkit
throw ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
} else {
- server.setDifficulty(difficulty, true);
+ server.setDifficulty(source.getLevel(), difficulty, true); // Paper - per level difficulty; don't skip other difficulty-changing logic (fix upstream's fix)
source.sendSuccess(() -> Component.translatable("commands.difficulty.success", difficulty.getDisplayName()), true);
return 0;
}