diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index b00d2b5..7054767 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -37,14 +37,21 @@ public class BauSystem extends JavaPlugin implements Listener { String worldName = Bukkit.getWorlds().get(0).getName(); try{ owner = UUID.fromString(worldName); + sections = ArenaSection.loadFromFile(new File(Bukkit.getWorldContainer().getPath() + '/' + owner.toString() + "/sections.yml")); }catch(IllegalArgumentException e){ try{ - owner = SteamwarUser.get(Integer.parseInt(worldName)).getUUID(); - }catch(NumberFormatException ex){ - getLogger().log(Level.SEVERE, "owner is no UUID", e); + int ownerID = Integer.parseInt(worldName); + owner = SteamwarUser.get(ownerID).getUUID(); + sections = ArenaSection.loadFromFile(new File(Bukkit.getWorldContainer().getPath() + '/' + ownerID + "/sections.yml")); + }catch(NumberFormatException | IOException | InvalidConfigurationException ex){ + getLogger().log(Level.SEVERE, "owner is no UUID / failed to load sections.yml", e); Bukkit.shutdown(); return; } + } catch (InvalidConfigurationException | IOException e) { + getLogger().log(Level.SEVERE, "Failed to load sections.yml", e); + Bukkit.shutdown(); + return; } try { @@ -58,14 +65,6 @@ public class BauSystem extends JavaPlugin implements Listener { return; } - try { - sections = ArenaSection.loadFromFile(new File(Bukkit.getWorldContainer().getPath() + '/' + owner.toString() + "/sections.yml")); - } catch (IOException | InvalidConfigurationException e) { - getLogger().log(Level.SEVERE, "Failed to load sections.yml", e); - Bukkit.shutdown(); - return; - } - getCommand("trace").setExecutor(new CommandTrace()); getCommand("nightvision").setExecutor(new CommandNV()); getCommand("reset").setExecutor(new CommandReset());