Make config and kits path configurable #232
@ -125,6 +125,7 @@ public class Config {
|
|||||||
public static final String LeaderDefault;
|
public static final String LeaderDefault;
|
||||||
public static final boolean PersonalKits;
|
public static final boolean PersonalKits;
|
||||||
public static final List<String> ForbiddenItems;
|
public static final List<String> ForbiddenItems;
|
||||||
|
public static final String KitFile;
|
||||||
|
|
||||||
//tech hider parameter
|
//tech hider parameter
|
||||||
public static final boolean TechhiderActive;
|
public static final boolean TechhiderActive;
|
||||||
@ -155,7 +156,8 @@ public class Config {
|
|||||||
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
||||||
IFightSystem.shutdown(null);
|
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();
|
IFightSystem.getPlugin().saveDefaultConfig();
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
||||||
IFightSystem.shutdown(null);
|
IFightSystem.shutdown(null);
|
||||||
@ -217,6 +219,7 @@ public class Config {
|
|||||||
|
|
||||||
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
|
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
|
||||||
|
|
||||||
|
KitFile = config.getString("Kits.File", "kits.data");
|
||||||
MemberDefault = config.getString("Kits.MemberDefault");
|
MemberDefault = config.getString("Kits.MemberDefault");
|
||||||
LeaderDefault = config.getString("Kits.LeaderDefault");
|
LeaderDefault = config.getString("Kits.LeaderDefault");
|
||||||
PersonalKits = config.getBoolean("Kits.PersonalKits");
|
PersonalKits = config.getBoolean("Kits.PersonalKits");
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.kit;
|
package de.steamwar.fightsystem.kit;
|
||||||
|
|
||||||
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -34,7 +35,7 @@ import java.util.logging.Level;
|
|||||||
public class KitManager {
|
public class KitManager {
|
||||||
private 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 FileConfiguration kitData = YamlConfiguration.loadConfiguration(kits);
|
||||||
|
|
||||||
private static final ArrayList<Kit> loadedKits = new ArrayList<>();
|
private static final ArrayList<Kit> loadedKits = new ArrayList<>();
|
||||||
@ -69,7 +70,7 @@ public class KitManager {
|
|||||||
public static void loadAllKits() {
|
public static void loadAllKits() {
|
||||||
if(!kits.exists()) {
|
if(!kits.exists()) {
|
||||||
saveAllKits();
|
saveAllKits();
|
||||||
Bukkit.getLogger().log(Level.INFO, "kits.data erstellt!");
|
Bukkit.getLogger().log(Level.SEVERE, "kit config fehlend!");
|
||||||
FightSystem.shutdown(null);
|
FightSystem.shutdown(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren