Fix Per World Difficulty / Remembering Difficulty

Fixes per world difficulty with /difficulty command and also
makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
This commit is contained in:
Aikar
2020-06-28 03:59:10 -04:00
parent 454ff5e5b9
commit 2e3c775b68
6 changed files with 99 additions and 57 deletions

View File

@@ -11,7 +11,7 @@
throw DifficultyCommand.ERROR_ALREADY_DIFFICULT.create(difficulty.getKey());
} else {
- minecraftserver.setDifficulty(difficulty, true);
+ worldServer.serverLevelData.setDifficulty(difficulty); // CraftBukkit
+ minecraftserver.setDifficulty(worldServer, difficulty, true); // Paper - per level difficulty; don't skip other difficulty-changing logic (fix upstream's fix)
source.sendSuccess(() -> {
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
}, true);