From 94a138b9ec9456468979f54a2bb3821e22807241 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 31 Dec 2019 13:02:15 +0100 Subject: [PATCH] Fixing sections.yml --- .../src/de/steamwar/bausystem/BauSystem.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) 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());