71 lines
2.8 KiB
Java
71 lines
2.8 KiB
Java
package net.t2code.lib.Spigot.system.config;
|
|
|
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
|
import net.t2code.lib.Spigot.system.Main;
|
|
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
|
|
|
|
public class ConfigCreate {
|
|
|
|
private static Boolean UpdateCheckOnJoin = true;
|
|
private static Integer UpdateCheckTimeInterval = 60;
|
|
private static Boolean Debug = false;
|
|
private static String language = "english";
|
|
|
|
|
|
private static Boolean mySQL = false;
|
|
private static String Storage = "YML";
|
|
private static String ip = "localhost";
|
|
private static Integer port = 3306;
|
|
private static String database = "database";
|
|
private static String user = "root";
|
|
private static String password = "password";
|
|
private static Boolean SSL = false;
|
|
|
|
private static Boolean Bungee = false;
|
|
private static String thisServer = "server";
|
|
|
|
public static void configCreate() {
|
|
Long long_ = Long.valueOf(System.currentTimeMillis());
|
|
if (new File(Main.getPath(), "config.yml").exists()){
|
|
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Main.prefix + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
|
} else send.console(Main.prefix + " §4config.yml are created...");
|
|
|
|
|
|
File config = new File(Main.getPath(), "config.yml");
|
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
|
|
Config.set("Plugin.UpdateCheck.OnJoin", UpdateCheckOnJoin, yamlConfiguration);
|
|
Config.set("Plugin.UpdateCheck.TimeInterval", UpdateCheckTimeInterval, yamlConfiguration);
|
|
Config.set("Plugin.language", language, yamlConfiguration);
|
|
|
|
Config.set("BungeeCord.Enable", Bungee, yamlConfiguration);
|
|
Config.set("BungeeCord.ThisServer", thisServer, yamlConfiguration);
|
|
Config.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
|
|
|
// Config.set("Storage.MySQL.Enable", mySQL, yamlConfiguration);
|
|
// Config.set("Storage.Type", Storage, yamlConfiguration);
|
|
// Config.set("Storage.MySQL.IP", ip, yamlConfiguration);
|
|
// Config.set("Storage.MySQL.Port", port, yamlConfiguration);
|
|
// Config.set("Storage.MySQL.Database", database, yamlConfiguration);
|
|
// Config.set("Storage.MySQL.User", user, yamlConfiguration);
|
|
// Config.set("Storage.MySQL.Password", password, yamlConfiguration);
|
|
// Config.set("Storage.MySQL.SSL", SSL, yamlConfiguration);
|
|
|
|
|
|
|
|
try {
|
|
yamlConfiguration.save(config);
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
send.console(Main.prefix + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
|
|
|
}
|
|
}
|