From 8d03e698062591f02a8077ce38ae322c5c0b6ec3 Mon Sep 17 00:00:00 2001 From: creatorfromhell Date: Sun, 3 Dec 2023 12:28:37 -0500 Subject: [PATCH] Fix difficulty defaulting to null. --- .../parameters/suggestion/WorldFolderSuggestion.java | 3 ++- .../java/me/lokka30/phantomworlds/managers/WorldManager.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/WorldFolderSuggestion.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/WorldFolderSuggestion.java index 516d577..95b2f33 100644 --- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/WorldFolderSuggestion.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/WorldFolderSuggestion.java @@ -43,7 +43,8 @@ public class WorldFolderSuggestion implements SuggestionProvider { final File directory = Bukkit.getWorldContainer(); for(File file : directory.listFiles()) { - if(file.isDirectory()) { + final File levelDat = new File(file, "level.dat"); + if(file.isDirectory() && levelDat.exists()) { folders.add(file.getName()); } } diff --git a/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java b/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java index ef67a51..4ba2498 100644 --- a/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java +++ b/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java @@ -122,7 +122,7 @@ public PhantomWorld getPhantomWorldFromData(final String name) { PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "spawnAnimals", true), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "keepSpawnInMemory", false), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "allowPvP", true), - Difficulty.valueOf(PhantomWorlds.instance().data.getConfig().getString(cfgPath + "difficulty", null)), + Difficulty.valueOf(PhantomWorlds.instance().data.getConfig().getString(cfgPath + "difficulty", "NORMAL")), GameMode.valueOf(PhantomWorlds.instance().data.getConfig().getString(cfgPath + "gameMode", "SURVIVAL")) );