Compare commits

..

3 Commits

Author SHA1 Message Date
5f2c2cacbe Update ConvertT2ClibConfig.java 2024-07-14 12:13:33 +02:00
6ea2335bc2 Update T2C_LibConfig.java 2024-07-14 12:13:29 +02:00
7b574ffa02 16.7_beta-1 2024-07-11 15:22:02 +02:00
4 changed files with 15 additions and 14 deletions

View File

@@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>16.7_dev-27</version>
<version>16.7_beta-1</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->

View File

@@ -21,6 +21,7 @@ public class T2C_ConfigWriter {
private static FileConfiguration config;
public static void createConfig(String prefix, File configFile, T2C_ConfigItem[] values, boolean isReload, String... header) {
long long_ = System.currentTimeMillis();
boolean exist = configFile.exists();
if (!exist) {
configFile.getParentFile().mkdir();
@@ -62,21 +63,20 @@ public class T2C_ConfigWriter {
}
// Copy default values if they are missing
config.options().copyDefaults(true);
T2C_YmlWriter.saveConfigWithComments(configFile, config, comments, false,header);
readConfig(prefix, configFile, config, values, isReload);
T2C_YmlWriter.saveConfigWithComments(configFile, config, comments, false, header);
readConfig(prefix, configFile, config, values, isReload, long_);
}
private static void readConfig(String prefix, File configFile, FileConfiguration config, T2C_ConfigItem[] values, boolean isReload) {
private static void readConfig(String prefix, File configFile, FileConfiguration config, T2C_ConfigItem[] values, boolean isReload, long long_) {
for (T2C_ConfigItem value : values) {
value.setValue(config.get(value.getPath()));
}
T2C_Send.sendStartTextCenter(prefix, "§2" + configFile.getName() + " were successfully created / updated.", isReload);
T2C_Send.sendStartTextCenter(prefix, "§2Load successfully: §7" + configFile.getPath() + "/" + config.getName().replace("/","")+" §7- §e"+ (System.currentTimeMillis() - long_) + "ms", isReload);
// T2C_Send.sendStartTextCenter(prefix, "§2Has been successfully created / updated §7- §e" + (System.currentTimeMillis() - long_) + "ms", isReload);
//T2C_Send.sendStartTextCenter(prefix, "", isReload);
//T2C_Send.sendStartTextCenter(Util.getPrefix(), "§2opWhitelist.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms",isReload);
}
}

View File

@@ -8,7 +8,7 @@ import java.io.File;
public class ConvertT2ClibConfig {
private static YamlConfiguration yamlConfiguration;
private static YamlConfiguration yamlConfiguration;
public static void convert() {
@@ -18,7 +18,7 @@ public class ConvertT2ClibConfig {
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.contains("plugin.updateCheck.onJoin")) return;
if (yamlConfiguration.contains("proxy.serverUUID")) return;
set("Plugin.UpdateCheck.OnJoin", T2C_LibConfig.VALUES.updateCheckOnJoin);
set("Plugin.UpdateCheck.TimeInterval", T2C_LibConfig.VALUES.updateCheckTimeInterval);
@@ -29,12 +29,12 @@ public class ConvertT2ClibConfig {
set("Plugin.Not recommended to disable.developerTool", T2C_LibConfig.VALUES.developerTool);
set("BungeeCord.Enable", T2C_LibConfig.VALUES.proxy);
set("Player.Inventories.CloseByServerStop", T2C_LibConfig.VALUES.inventoriesCloseByServerStop);
set("Command.PermToggle.PermissionSetCommand", T2C_LibConfig.VALUES.updateCheckOnJoin);
set("Command.PermToggle.PermissionSetCommand", T2C_LibConfig.VALUES.commandPermToggleCommand);
config.delete();
}
private static void set(String path, T2C_ConfigItem item){
if (yamlConfiguration.contains(path)){
private static void set(String path, T2C_ConfigItem item) {
if (yamlConfiguration.contains(path)) {
item.setValue(yamlConfiguration.get(path));
}
}

View File

@@ -133,6 +133,7 @@ public class T2C_LibConfig {
public static void set(boolean isReload) {
long long_ = System.currentTimeMillis();
ConvertT2ClibConfig.convert();
T2C_ConfigWriter.createConfig(T2C_Util.getPrefix(), new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), isReload, T2C_Util.getConfigLogo());
}