Paper/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/DifficultyCommand.java.patch

24 lines
1.3 KiB
Diff

--- a/net/minecraft/server/commands/DifficultyCommand.java
+++ b/net/minecraft/server/commands/DifficultyCommand.java
@@ -43,14 +42,15 @@
}));
}
- public static int setDifficulty(CommandSourceStack commandsourcestack, Difficulty difficulty) throws CommandSyntaxException {
- MinecraftServer minecraftserver = commandsourcestack.getServer();
+ 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);
- commandsourcestack.sendSuccess(() -> {
+ worldServer.serverLevelData.setDifficulty(difficulty); // CraftBukkit
+ source.sendSuccess(() -> {
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
}, true);
return 0;