geforkt von Mirrors/Paper
17 Zeilen
1018 B
Diff
17 Zeilen
1018 B
Diff
|
--- a/net/minecraft/server/commands/DifficultyCommand.java
|
||
|
+++ b/net/minecraft/server/commands/DifficultyCommand.java
|
||
|
@@ -31,10 +_,11 @@
|
||
|
|
||
|
public static int setDifficulty(CommandSourceStack source, Difficulty difficulty) throws CommandSyntaxException {
|
||
|
MinecraftServer server = source.getServer();
|
||
|
- if (server.getWorldData().getDifficulty() == difficulty) {
|
||
|
+ net.minecraft.server.level.ServerLevel serverLevel = source.getLevel(); // CraftBukkit
|
||
|
+ if (serverLevel.getDifficulty() == difficulty) { // CraftBukkit
|
||
|
throw ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
|
||
|
} else {
|
||
|
- server.setDifficulty(difficulty, true);
|
||
|
+ server.setDifficulty(serverLevel, 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;
|
||
|
}
|