Skip to content

Commit

Permalink
Fix world difficulty (#3921)
Browse files Browse the repository at this point in the history
Fix world difficulty not spawning monsters sometimes after changing from peaceful to others
  • Loading branch information
AyhamAl-Ali authored Apr 26, 2021
1 parent 6a89ee4 commit 4f5ac2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/ch/njol/skript/expressions/ExprDifficulty.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
Difficulty difficulty = (Difficulty) delta[0];
for (World world : getExpr().getArray(e)) {
world.setDifficulty(difficulty);
if (difficulty != Difficulty.PEACEFUL)
world.setSpawnFlags(true, world.getAllowAnimals()); // Force enable spawn monsters as changing difficulty won't change this by itself
}
}

Expand Down

0 comments on commit 4f5ac2e

Please sign in to comment.