mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 23:57:43 +01:00
Fix setting difficulity inside of API (Fixes #8533)
Vanilla moved some logic around setting the world difficulty which was not adopted for inside of upstream properly, this addresses another such case
This commit is contained in:
parent
4a9c9b3fb0
commit
e30b082262
1 changed files with 17 additions and 4 deletions
|
@ -8,7 +8,7 @@ makes it so that the server keeps the last difficulty used instead
|
|||
of restoring the server.properties every single load.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 057c335b15123061ed239f9559aad137e2c97982..1c39e141a392d96548f5ac62fb279ed1f105677d 100644
|
||||
index fb2d02ad6f6a4a1c69dde06e7e193aaef8655028..dda33bd52d9c527c37f67b829010c27dba4b667a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -791,7 +791,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -63,7 +63,7 @@ index 4bb29f86538552bb62125cc61210fd77b1ec671d..817193ca5fc15134d2985187bc2226cc
|
|||
return 0;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 487991163f12c1ded3f5d35a718aa89b1fb9278f..8984a30f0fa790e7854534076912e619f9487160 100644
|
||||
index e3a62579067209c447f2fdcb76b2a11e489a376b..a8e18a168e8288ebea95bacd61a38039b3427d5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -332,7 +332,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
|
@ -76,7 +76,7 @@ index 487991163f12c1ded3f5d35a718aa89b1fb9278f..8984a30f0fa790e7854534076912e619
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 0faa0d73907e6ef1285eba4cf7d692a5f8c3a0e3..582b9595aa06dd6787fd84c0ea0058c890f84c33 100644
|
||||
index 83d05b2546fe54485daede323a0f6343b62d278a..d8c77533a44e316693535ea66fe6ae7f4994de5f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1129,7 +1129,7 @@ public class ServerPlayer extends Player {
|
||||
|
@ -102,7 +102,7 @@ index 02b6cf65f6abedfd4933e4e64d254f190e061301..c59e90ba0de83eeda3719b6303bee979
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ef6ca51679c818989f3ddd83f0bc7f37db6d6196..262d550e739928fc5f203432138fdcaf6ccb8ddb 100644
|
||||
index e8e31ddaa7fa87b9854961dd44abff9ddb6a6142..4c6c9aa8b3305f5ab4f7b8d356e860da169fb1db 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -951,8 +951,8 @@ public final class CraftServer implements Server {
|
||||
|
@ -116,3 +116,16 @@ index ef6ca51679c818989f3ddd83f0bc7f37db6d6196..262d550e739928fc5f203432138fdcaf
|
|||
|
||||
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
|
||||
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index c3703933598ee96d856a18dcc0932061959c9791..298012beaf6f587a05d230b7208325ea8c3ad811 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1147,7 +1147,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
- this.getHandle().serverLevelData.setDifficulty(net.minecraft.world.Difficulty.byId(difficulty.getValue()));
|
||||
+ this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - don't skip other difficulty-changing logic
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue