71 lines
2.9 KiB
Java
71 lines
2.9 KiB
Java
// This claas was created by JaTiTV
|
|
|
|
package de.jatitv.papitest.config;
|
|
|
|
import de.jatitv.papitest.Util;
|
|
import de.jatitv.papitest.system.Main;
|
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
|
|
public class Config {
|
|
|
|
public static Integer ConfigVersion = 1;
|
|
|
|
public static Boolean updateCheckOnJoin = true;
|
|
public static Boolean updateCheckSeePreReleaseUpdates = true;
|
|
public static Integer updateCheckTimeInterval = 60;
|
|
public static Boolean Titel = true;
|
|
|
|
public static void configCreate() {
|
|
|
|
File configYML = new File(Main.getPlugin().getDataFolder(), "Config.yml");
|
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(configYML);
|
|
|
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Config.yml load...");
|
|
|
|
yamlConfiguration.set("ConfigVersion", ConfigVersion);
|
|
|
|
if (yamlConfiguration.contains("Plugin.updateCheck.onJoin")) {
|
|
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
|
|
} else {
|
|
yamlConfiguration.set("Plugin.updateCheck.onJoin", true);
|
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6updateCheck onJoin §4was added to §9Config.yml§4!");
|
|
}
|
|
|
|
if (yamlConfiguration.contains("Plugin.updateCheck.seePreReleaseUpdates")) {
|
|
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
|
|
} else {
|
|
yamlConfiguration.set("Plugin.updateCheck.seePreReleaseUpdates", true);
|
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6updateCheck seePreReleaseUpdates §4was added to §9Config.yml§4!");
|
|
}
|
|
|
|
if (yamlConfiguration.contains("Plugin.updateCheck.timeInterval")) {
|
|
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
|
|
} else {
|
|
yamlConfiguration.set("Plugin.updateCheck.timeInterval", 60);
|
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6updateCheck timeInterval §4was added to §9Config.yml§4!");
|
|
}
|
|
|
|
if (!T2CmcVersion.isMc1_8()) {
|
|
if (yamlConfiguration.contains("Titel.Enable")) {
|
|
Titel = yamlConfiguration.getBoolean("Titel.Enable");
|
|
} else {
|
|
yamlConfiguration.set("Titel.Enable", true);
|
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6Titel Enable §4was added to §9Config.yml§4!");
|
|
}
|
|
}
|
|
|
|
try {
|
|
yamlConfiguration.save(configYML);
|
|
} catch (
|
|
IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2Config.yml loaded successfully.");
|
|
}
|
|
}
|