Parse difficulty safely. Fixes #1634.
This commit is contained in:
parent
cc3dfe9fd4
commit
618986e216
|
@ -749,7 +749,14 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||||
|
|
||||||
// migrate difficulty
|
// migrate difficulty
|
||||||
if (section.isString("difficulty")) {
|
if (section.isString("difficulty")) {
|
||||||
final Difficulty difficulty = Difficulty.valueOf(section.getString("difficulty").toUpperCase());
|
Difficulty difficulty;
|
||||||
|
try {
|
||||||
|
difficulty = Difficulty.valueOf(section.getString("difficulty").toUpperCase());
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
this.log(Level.WARNING, "Could not parse difficulty: " + section.getString("difficulty"));
|
||||||
|
this.log(Level.WARNING, "Setting world " + entry.getKey() + " difficulty to NORMAL");
|
||||||
|
difficulty = Difficulty.NORMAL;
|
||||||
|
}
|
||||||
if (difficulty != null) {
|
if (difficulty != null) {
|
||||||
world.setDifficulty(difficulty);
|
world.setDifficulty(difficulty);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue