Commits

Doc authored and md_5 committed 62d976242c2
SPIGOT-6900, SPIGOT-6330: Make /difficulty command per-world
No tags

nms-patches/net/minecraft/server/commands/CommandDifficulty.patch

Added
1 +--- a/net/minecraft/server/commands/CommandDifficulty.java
2 ++++ b/net/minecraft/server/commands/CommandDifficulty.java
3 +@@ -42,11 +42,12 @@
4 +
5 + public static int setDifficulty(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException {
6 + MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
7 ++ net.minecraft.server.level.WorldServer worldServer = commandlistenerwrapper.getLevel(); // CraftBukkit
8 +
9 +- if (minecraftserver.getWorldData().getDifficulty() == enumdifficulty) {
10 ++ if (worldServer.getDifficulty() == enumdifficulty) { // CraftBukkit
11 + throw CommandDifficulty.ERROR_ALREADY_DIFFICULT.create(enumdifficulty.getKey());
12 + } else {
13 +- minecraftserver.setDifficulty(enumdifficulty, true);
14 ++ worldServer.serverLevelData.setDifficulty(enumdifficulty); // CraftBukkit
15 + commandlistenerwrapper.sendSuccess(new ChatMessage("commands.difficulty.success", new Object[]{enumdifficulty.getDisplayName()}), true);
16 + return 0;
17 + }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut