SteamWar/BauSystem
Archiviert
13
0

Fixing sections.yml

Dieser Commit ist enthalten in:
Lixfel 2019-12-31 13:02:15 +01:00
Ursprung a389fa9756
Commit 94a138b9ec

Datei anzeigen

@ -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());