From a389fa975684f7feb0fe0e4099a8eb4d4b6f2a92 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 31 Dec 2019 12:58:55 +0100 Subject: [PATCH] Allowing UserID as WorldName --- .../src/de/steamwar/bausystem/BauSystem.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index e06f6e1..b00d2b5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -34,12 +34,17 @@ public class BauSystem extends JavaPlugin implements Listener { public void onEnable() { plugin = this; + String worldName = Bukkit.getWorlds().get(0).getName(); try{ - owner = UUID.fromString(Bukkit.getWorlds().get(0).getName()); + owner = UUID.fromString(worldName); }catch(IllegalArgumentException e){ - getLogger().log(Level.SEVERE, "owner is no UUID", e); - Bukkit.shutdown(); - return; + try{ + owner = SteamwarUser.get(Integer.parseInt(worldName)).getUUID(); + }catch(NumberFormatException ex){ + getLogger().log(Level.SEVERE, "owner is no UUID", e); + Bukkit.shutdown(); + return; + } } try {