mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-16 18:31:53 +01:00
fix per-world difficulty command (#5306)
This commit is contained in:
parent
afe9f61c4c
commit
59fd0e3a84
1 changed files with 10 additions and 7 deletions
|
@ -47,15 +47,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
- public void a(EnumDifficulty enumdifficulty, boolean flag) {
|
||||
+ // Paper start - fix per world difficulty
|
||||
+ public void a(WorldServer world, EnumDifficulty enumdifficulty, boolean flag) {
|
||||
+ WorldDataServer worldData = world.worldDataServer;
|
||||
if (flag || !this.saveData.isDifficultyLocked()) {
|
||||
this.saveData.setDifficulty(this.saveData.isHardcore() ? EnumDifficulty.HARD : enumdifficulty);
|
||||
- if (flag || !this.saveData.isDifficultyLocked()) {
|
||||
- this.saveData.setDifficulty(this.saveData.isHardcore() ? EnumDifficulty.HARD : enumdifficulty);
|
||||
- this.updateSpawnFlags();
|
||||
- this.getPlayerList().getPlayers().forEach(this::b);
|
||||
+ world.setSpawnFlags(worldData.getDifficulty() != EnumDifficulty.PEACEFUL && ((DedicatedServer)this).propertyManager.getProperties().spawnMonsters, this.getSpawnAnimals());
|
||||
+ //this.getPlayerList().getPlayers().forEach(this::b);
|
||||
+ // Paper start - fix per world difficulty
|
||||
+ public void setWorldDifficulty(WorldServer world, EnumDifficulty enumdifficulty, boolean forcefullySet) { this.a(world, enumdifficulty, forcefullySet); }
|
||||
+ public void a(WorldServer world, EnumDifficulty enumdifficulty, boolean flag) {
|
||||
+ WorldDataServer worldData = world.worldDataServer;
|
||||
+ if (flag || !worldData.isDifficultyLocked()) {
|
||||
+ worldData.setDifficulty(worldData.isHardcore() ? EnumDifficulty.HARD : enumdifficulty);
|
||||
+ world.setSpawnFlags(worldData.getDifficulty() != EnumDifficulty.PEACEFUL && ((DedicatedServer) this).propertyManager.getProperties().spawnMonsters, this.getSpawnAnimals());
|
||||
+ //this.getPlayerList().getPlayers().forEach(this::b); // Commented: WorldDataServer#setDifficulty handles updating players' difficulties
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue