This commit is contained in:
JaTiTV 2024-07-08 05:10:38 +02:00
parent 3b0a2fbe94
commit ffa4423b7c
3 changed files with 18 additions and 28 deletions

View File

@ -35,7 +35,7 @@ public class ConfigFileConverter {
if (!f.exists()) return; if (!f.exists()) return;
File[] fileArray = f.listFiles(); File[] fileArray = f.listFiles();
assert fileArray != null; if (fileArray == null) return;
for (File file : fileArray) { for (File file : fileArray) {
String sub = file.getName().substring(file.getName().length() - 4); String sub = file.getName().substring(file.getName().length() - 4);
if (sub.equals(".yml")) { if (sub.equals(".yml")) {
@ -75,16 +75,12 @@ public class ConfigFileConverter {
setConfig("Alias.Console.Message.Messages", AliasFile.VALUES.consoleMessages); setConfig("Alias.Console.Message.Messages", AliasFile.VALUES.consoleMessages);
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + file.getName()), AliasFile.VALUES.values(), false, Util.getConfigLogo()); T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + file.getName()), AliasFile.VALUES.values(), false, Util.getConfigLogo());
file.delete();
} }
} }
File fo = new File(Main.getPath() + "/OldConfig/"); File[] fileArray2 = f.listFiles();
if(!fo.exists())fo.mkdir(); if (fileArray2 != null) return;
f.delete();
if (f.renameTo(new File(Main.getPath() + "/OldConfig/Alias/"))) {
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4The Alias files in the plugins/T2C-Alias/Alias folder", false);
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4have been converted to the new folder plugins/T2C-Alias/alias!", false);
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4The old files have been moved to plugins/T2C-Alias/OldConfig/Alias.", false);
}
} }
private static void convertSubAlias() { private static void convertSubAlias() {
@ -133,15 +129,12 @@ public class ConfigFileConverter {
setConfig("SubAlias.Console.Message.Messages", SubAliasFile.VALUES.consoleMessages); setConfig("SubAlias.Console.Message.Messages", SubAliasFile.VALUES.consoleMessages);
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "subAlias/" + file.getName()), SubAliasFile.VALUES.values(), false, Util.getConfigLogo()); T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "subAlias/" + file.getName()), SubAliasFile.VALUES.values(), false, Util.getConfigLogo());
file.delete();
} }
} }
File fo = new File(Main.getPath() + "/OldConfig/"); File[] fileArray2 = f.listFiles();
if(!fo.exists())fo.mkdir(); if (fileArray2 != null) return;
if (f.renameTo(new File(Main.getPath() + "/OldConfig/SubAlias/"))) { f.delete();
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4The SubAlias files in the plugins/T2C-Alias/SubAlias folder", false);
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4have been converted to the new folder plugins/T2C-Alias/subAlias!", false);
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4The old files have been moved to plugins/T2C-Alias/OldConfig/SubAlias.", false);
}
} }
private static void setConfig(String path, T2C_ConfigItem item) { private static void setConfig(String path, T2C_ConfigItem item) {

View File

@ -238,7 +238,7 @@ public class AliasFile {
@Override @Override
public String getLanguagePath() { public String getLanguagePath() {
return Config.VALUES.language.getPath(); return Config.VALUES.language.getValue().toString();
} }
@Override @Override
@ -247,20 +247,18 @@ public class AliasFile {
} }
} }
public static void set(boolean isReload) { public static void set(boolean isReload) {
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/aliasexample.yml"), VALUES.values(), isReload, Util.getConfigLogo());
}
public static void select(boolean isReload) {
ConfigFileConverter.convert(); ConfigFileConverter.convert();
File f = new File(Main.getPath() + "/alias/"); File f = new File(Main.getPath() + "/alias/");
File[] fileArray = f.listFiles(); File[] fileArray = f.listFiles();
assert fileArray != null; if (fileArray == null){
for (File config_gui : fileArray) { T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/aliasexample.yml"), VALUES.values(), isReload, Util.getConfigLogo());
String sub = config_gui.getName().substring(config_gui.getName().length() - 4); }
for (File file : fileArray) {
String sub = file.getName().substring(file.getName().length() - 4);
if (sub.equals(".yml")) { if (sub.equals(".yml")) {
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + config_gui.getName()), VALUES.values(), isReload, Util.getConfigLogo()); T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + file.getName()), VALUES.values(), isReload, Util.getConfigLogo());
for (String s : (List<String>) VALUES.aliasList.value) { for (String s : (List<String>) VALUES.aliasList.value) {
if (s != null) { if (s != null) {
Main.allAliases.add(s); Main.allAliases.add(s);

View File

@ -53,10 +53,9 @@ public class Load {
Language.set(false); Language.set(false);
T2C_Template.onLoadSeparateStroke(Util.getPrefix()); T2C_Template.onLoadSeparateStroke(Util.getPrefix());
if (newInstall) { if (newInstall) {
AliasFile.set(false);
SubAliasFile.set(false); SubAliasFile.set(false);
} }
AliasFile.select(false); AliasFile.set(false);
SubAliasFile.select(false); SubAliasFile.select(false);