SteamWar/FightSystem
Archiviert
13
1

Make config and kits path configurable #232

Manuell gemergt
Lixfel hat 2 Commits von dynamicConfig nach master 2021-02-13 08:19:07 +01:00 zusammengeführt
2 geänderte Dateien mit 12 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -125,6 +125,7 @@ public class Config {
public static final String LeaderDefault;
public static final boolean PersonalKits;
public static final List<String> ForbiddenItems;
public static final String KitFile;
//tech hider parameter
public static final boolean TechhiderActive;
@ -150,17 +151,18 @@ public class Config {
public static final int spectatePort = 2222;
static{
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
if(!worldConfigFile.exists()) {
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
IFightSystem.shutdown(null);
}
if(!new File(IFightSystem.getPlugin().getDataFolder(), "config.yml").exists()) {
if(!new File(IFightSystem.getPlugin().getDataFolder(), System.getProperty("config", "config.yml")).exists()) {
IFightSystem.getPlugin().saveDefaultConfig();
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
IFightSystem.shutdown(null);
}
FileConfiguration config = IFightSystem.getPlugin().getConfig();
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), config.getString("Arenaconfig", "config.yml"));
if(!worldConfigFile.exists()) {
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
IFightSystem.shutdown(null);
}
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
NoPlayerOnlineDuration = config.getInt("Times.NoPlayersOnlineDuration");
@ -217,6 +219,7 @@ public class Config {
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
KitFile = config.getString("Kits.File", "kits.data");
MemberDefault = config.getString("Kits.MemberDefault");
LeaderDefault = config.getString("Kits.LeaderDefault");
PersonalKits = config.getBoolean("Kits.PersonalKits");

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.fightsystem.kit;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
@ -34,7 +35,7 @@ import java.util.logging.Level;
public class KitManager {
private KitManager(){}
private static final File kits = new File(FightSystem.getPlugin().getDataFolder(), "kits.data");
private static final File kits = new File(FightSystem.getPlugin().getDataFolder(), Config.KitFile);
private static final FileConfiguration kitData = YamlConfiguration.loadConfiguration(kits);
private static final ArrayList<Kit> loadedKits = new ArrayList<>();
@ -69,7 +70,7 @@ public class KitManager {
public static void loadAllKits() {
if(!kits.exists()) {
saveAllKits();
Bukkit.getLogger().log(Level.INFO, "kits.data erstellt!");
Bukkit.getLogger().log(Level.SEVERE, "kit config fehlend!");
FightSystem.shutdown(null);
return;
}