From e626bf5ab038b1770910657b904760ee8311b212 Mon Sep 17 00:00:00 2001 From: Yaruma3341 Date: Sat, 8 Jun 2019 13:47:31 +0200 Subject: [PATCH] split up config Signed-off-by: Yaruma3341 --- src/me/yaruma/fightsystem/utils/Config.java | 34 ++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/me/yaruma/fightsystem/utils/Config.java b/src/me/yaruma/fightsystem/utils/Config.java index c537ba9..e7df061 100644 --- a/src/me/yaruma/fightsystem/utils/Config.java +++ b/src/me/yaruma/fightsystem/utils/Config.java @@ -7,6 +7,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; import java.util.List; @@ -84,31 +85,36 @@ public class Config { public static int ObfuscateWith; public static void load(){ - if(!new File("plugins/" + FightSystem.getPlugin().getName() + "/config.yml").exists()) { + if(!new File(Bukkit.getWorldContainer().getPath() + Bukkit.getWorlds().get(0) + "/config.yml").exists()) { FightSystem.getPlugin().saveDefaultConfig(); System.out.println(FightSystem.PREFIX + "config.yml erstellt und geladen!"); Bukkit.shutdown(); } + if(!new File("plugins/" + FightSystem.getPlugin().getName() + "/config.yml").exists()) { + System.out.println(FightSystem.PREFIX + "config.yml fehlt!"); + Bukkit.shutdown(); + } FileConfiguration config = FightSystem.getPlugin().getConfig(); + YamlConfiguration worldconfig = YamlConfiguration.loadConfiguration(new File("plugins/" + FightSystem.getPlugin().getName() + "/config.yml")); NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration"); SetupDuration = config.getInt("Times.SetupDuration"); PreFightDuration = config.getInt("Times.PreFightDuration"); SpectatorDuration = config.getInt("Times.SpectatorDuration"); - SchemsizeX = config.getInt("Arena.Schemsize.x"); - SchemsizeY = config.getInt("Arena.Schemsize.y"); - SchemsizeZ = config.getInt("Arena.Schemsize.z"); - TeamBlueCornerX = config.getInt("Arena.TeamBlueCorner.x"); - TeamBlueCornerY = config.getInt("Arena.TeamBlueCorner.y"); - TeamBlueCornerZ = config.getInt("Arena.TeamBlueCorner.z"); - TeamBluetoReddistanceX = config.getInt("Arena.TeamBluetoReddistance.x"); - TeamBluetoReddistanceY = config.getInt("Arena.TeamBluetoReddistance.y"); - TeamBluetoReddistanceZ = config.getInt("Arena.TeamBluetoReddistance.z"); - Schem2BorderX = config.getInt("Arena.Schem2Border.x"); - Schem2BorderZ = config.getInt("Arena.Schem2Border.z"); - underArenaBorder = config.getInt("Arena.underArenaBorder"); - BorderFromSchematic = config.getInt("Arena.BorderFromSchematic"); + SchemsizeX = worldconfig.getInt("Arena.Schemsize.x"); + SchemsizeY = worldconfig.getInt("Arena.Schemsize.y"); + SchemsizeZ = worldconfig.getInt("Arena.Schemsize.z"); + TeamBlueCornerX = worldconfig.getInt("Arena.TeamBlueCorner.x"); + TeamBlueCornerY = worldconfig.getInt("Arena.TeamBlueCorner.y"); + TeamBlueCornerZ = worldconfig.getInt("Arena.TeamBlueCorner.z"); + TeamBluetoReddistanceX = worldconfig.getInt("Arena.TeamBluetoReddistance.x"); + TeamBluetoReddistanceY = worldconfig.getInt("Arena.TeamBluetoReddistance.y"); + TeamBluetoReddistanceZ = worldconfig.getInt("Arena.TeamBluetoReddistance.z"); + Schem2BorderX = worldconfig.getInt("Arena.Schem2Border.x"); + Schem2BorderZ = worldconfig.getInt("Arena.Schem2Border.z"); + underArenaBorder = worldconfig.getInt("Arena.underArenaBorder"); + BorderFromSchematic = worldconfig.getInt("Arena.BorderFromSchematic"); OnlyPublicSchematics = config.getBoolean("Schematic.OnlyPublicSchematics"); SchematicDirectory = config.getString("Schematic.Directory");