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;
File[] fileArray = f.listFiles();
assert fileArray != null;
if (fileArray == null) return;
for (File file : fileArray) {
String sub = file.getName().substring(file.getName().length() - 4);
if (sub.equals(".yml")) {
@ -75,16 +75,12 @@ public class ConfigFileConverter {
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());
file.delete();
}
}
File fo = new File(Main.getPath() + "/OldConfig/");
if(!fo.exists())fo.mkdir();
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);
}
File[] fileArray2 = f.listFiles();
if (fileArray2 != null) return;
f.delete();
}
private static void convertSubAlias() {
@ -133,15 +129,12 @@ public class ConfigFileConverter {
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());
file.delete();
}
}
File fo = new File(Main.getPath() + "/OldConfig/");
if(!fo.exists())fo.mkdir();
if (f.renameTo(new File(Main.getPath() + "/OldConfig/SubAlias/"))) {
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);
}
File[] fileArray2 = f.listFiles();
if (fileArray2 != null) return;
f.delete();
}
private static void setConfig(String path, T2C_ConfigItem item) {

View File

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

View File

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