1.6_beta-1

Config descriptions not yet complete, otherwise ready
This commit is contained in:
JaTiTV 2024-07-05 12:31:57 +02:00
parent bc7803831c
commit 4735f9f6fe
11 changed files with 538 additions and 629 deletions

View File

@ -7,7 +7,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>Alias</artifactId> <artifactId>Alias</artifactId>
<version>1.6_DEV-22</version> <version>1.6_beta-1</version>
<!--version>VERSION_snapshot-0</version--> <!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version--> <!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version--> <!--version>VERSION_dev-0</version-->

View File

@ -0,0 +1,152 @@
// This class was created by JaTiTV.
package net.t2code.alias.Spigot.config;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.alias.AliasFile;
import net.t2code.alias.Spigot.config.subAlias.SubAliasFile;
import net.t2code.alias.util.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
import net.t2code.t2codelib.util.T2C_ConfigItem;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class ConfigFileConverter {
private static YamlConfiguration yamlConfiguration;
public static void convert() {
File configDeclaration = new File(Main.getPath() + "X_configDeclaration_X.yml");
if (configDeclaration.exists()) configDeclaration.delete();
File aliasDeclaration = new File(Main.getPath() + "/Alias/X_aliasDeclaration_X.yml");
if (aliasDeclaration.exists()) aliasDeclaration.delete();
File subaliasDeclaration = new File(Main.getPath() + "/SubAlias/X_subAliasDeclaration_X.yml");
if (subaliasDeclaration.exists()) subaliasDeclaration.delete();
convertAlias();
convertSubAlias();
}
private static void convertAlias() {
File f = new File(Main.getPath() + "/Alias/");
if (!f.exists()) return;
File[] fileArray = f.listFiles();
assert fileArray != null;
for (File file : fileArray) {
String sub = file.getName().substring(file.getName().length() - 4);
if (sub.equals(".yml")) {
yamlConfiguration = YamlConfiguration.loadConfiguration(file);
setConfig("Alias.Enable", AliasFile.VALUES.aliasEnable);
setConfig("Alias.AliasList", AliasFile.VALUES.aliasList);
setConfig("Alias.Permission.Necessary", AliasFile.VALUES.permNecessary);
setConfig("Alias.Permission.Permission", AliasFile.VALUES.permission);
setConfig("Alias.Permission.CustomNoPermissionMSG", AliasFile.VALUES.permissionMSG);
setConfig("Alias.CooldownInSec.Global", AliasFile.VALUES.cooldownGlobal);
setConfig("Alias.CooldownInSec.Player", AliasFile.VALUES.cooldownPlayer);
setConfig("Alias.Cost.Enable", AliasFile.VALUES.costEnable);
setConfig("Alias.Cost.Confirm", AliasFile.VALUES.costConfirm);
setConfig("Alias.Cost.Price", AliasFile.VALUES.costPrice);
setConfig("Alias.Cost.AllowByPass", AliasFile.VALUES.costAllowBypass);
setConfig("Alias.Command.Enable", AliasFile.VALUES.commandEnable);
setConfig("Alias.Command.CommandAsConsole", AliasFile.VALUES.commandAsConsole);
setConfig("Alias.Command.BungeeCommand", AliasFile.VALUES.bungeeCommand);
setConfig("Alias.Command.Commands", AliasFile.VALUES.command);
setConfig("Alias.Message.Enable", AliasFile.VALUES.messageEnable);
setConfig("Alias.Message.Messages", AliasFile.VALUES.messages);
setConfig("Alias.Admin.Enable", AliasFile.VALUES.adminEnable);
setConfig("Alias.Admin.Permission", AliasFile.VALUES.adminPermission);
setConfig("Alias.Admin.Command.Enable", AliasFile.VALUES.adminCommandEnable);
setConfig("Alias.Admin.Command.CommandAsConsole", AliasFile.VALUES.adminCommandAsConsole);
setConfig("Alias.Admin.Command.BungeeCommand", AliasFile.VALUES.adminBungeeCommand);
setConfig("Alias.Admin.Command.Commands", AliasFile.VALUES.adminCommands);
setConfig("Alias.Admin.Message.Enable", AliasFile.VALUES.adminMessageEnable);
setConfig("Alias.Admin.Message.Messages", AliasFile.VALUES.adminMessages);
setConfig("Alias.Console.Enable", AliasFile.VALUES.consoleEnable);
setConfig("Alias.Console.Command.Enable", AliasFile.VALUES.consoleCommandEnable);
setConfig("Alias.Console.Command.BungeeCommand", AliasFile.VALUES.consoleBungeeCommand);
setConfig("Alias.Console.Command.Commands", AliasFile.VALUES.consoleCommands);
setConfig("Alias.Console.Message.Enable", AliasFile.VALUES.consoleMessageEnable);
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 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);
}
}
private static void convertSubAlias() {
File f = new File(Main.getPath() + "/SubAlias/");
if (!f.exists()) return;
File[] fileArray = f.listFiles();
assert fileArray != null;
for (File file : fileArray) {
String sub = file.getName().substring(file.getName().length() - 4);
if (sub.equals(".yml")) {
yamlConfiguration = YamlConfiguration.loadConfiguration(file);
setConfig("SubAlias.Enable", SubAliasFile.VALUES.aliasEnable);
setConfig("SubAlias.SubAliasList", SubAliasFile.VALUES.subAliasList);
setConfig("SubAlias.SubAliasFor", SubAliasFile.VALUES.subAliasFor);
setConfig("SubAlias.Permission.Necessary", SubAliasFile.VALUES.permNecessary);
setConfig("SubAlias.Permission.Permission", SubAliasFile.VALUES.permission);
setConfig("SubAlias.Permission.CustomNoPermissionMSG", SubAliasFile.VALUES.permissionMSG);
setConfig("SubAlias.CooldownInSec.Global", SubAliasFile.VALUES.cooldownGlobal);
setConfig("SubAlias.CooldownInSec.Player", SubAliasFile.VALUES.cooldownPlayer);
setConfig("SubAlias.Cost.Enable", SubAliasFile.VALUES.costEnable);
setConfig("SubAlias.Cost.Confirm", SubAliasFile.VALUES.costConfirm);
setConfig("SubAlias.Cost.Price", SubAliasFile.VALUES.costPrice);
setConfig("SubAlias.Cost.AllowByPass", SubAliasFile.VALUES.costAllowBypass);
setConfig("SubAlias.Command.Enable", SubAliasFile.VALUES.commandEnable);
setConfig("SubAlias.Command.CommandAsConsole", SubAliasFile.VALUES.commandAsConsole);
setConfig("SubAlias.Command.BungeeCommand", SubAliasFile.VALUES.bungeeCommand);
setConfig("SubAlias.Command.Commands", SubAliasFile.VALUES.command);
setConfig("SubAlias.Message.Enable", SubAliasFile.VALUES.messageEnable);
setConfig("SubAlias.Message.Messages", SubAliasFile.VALUES.messages);
setConfig("SubAlias.Admin.Enable", SubAliasFile.VALUES.adminEnable);
setConfig("SubAlias.Admin.Permission", SubAliasFile.VALUES.adminPermission);
setConfig("SubAlias.Admin.Command.Enable", SubAliasFile.VALUES.adminCommandEnable);
setConfig("SubAlias.Admin.Command.CommandAsConsole", SubAliasFile.VALUES.adminCommandAsConsole);
setConfig("SubAlias.Admin.Command.BungeeCommand", SubAliasFile.VALUES.adminBungeeCommand);
setConfig("SubAlias.Admin.Command.Commands", SubAliasFile.VALUES.adminCommands);
setConfig("SubAlias.Admin.Message.Enable", SubAliasFile.VALUES.adminMessageEnable);
setConfig("SubAlias.Admin.Message.Messages", SubAliasFile.VALUES.adminMessages);
setConfig("SubAlias.Console.Enable", SubAliasFile.VALUES.consoleEnable);
setConfig("SubAlias.Console.Command.Enable", SubAliasFile.VALUES.consoleCommandEnable);
setConfig("SubAlias.Console.Command.BungeeCommand", SubAliasFile.VALUES.consoleBungeeCommand);
setConfig("SubAlias.Console.Command.Commands", SubAliasFile.VALUES.consoleCommands);
setConfig("SubAlias.Console.Message.Enable", SubAliasFile.VALUES.consoleMessageEnable);
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 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);
}
}
private static void setConfig(String path, T2C_ConfigItem item) {
if (yamlConfiguration.contains(path)) {
item.setValue(yamlConfiguration.get(path));
}
}
}

View File

@ -1,90 +0,0 @@
package net.t2code.alias.Spigot.config.alias;
import net.t2code.alias.Spigot.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
public class AliasConfigConverter {
/**
* Converter 1.1
*
* @param yamlConfiguration
* @param config_gui
*/
public static void convertAliasList(YamlConfiguration yamlConfiguration, File config_gui) {
yamlConfiguration.set("Alias.AliasList", Collections.singletonList(config_gui.getName().replace(".yml", "")));
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
T2C_Send.error(Main.getInstance(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2C_Send.error(Main.getInstance(), "");
T2C_Send.warning(Main.getInstance(), "The " + config_gui.getName() + " file is converted to the new config format.");
T2C_Send.warning(Main.getInstance(), "The alias is no longer the filename, this is now adjustable in the file under 'Alias.AliasList'!");
T2C_Send.warning(Main.getInstance(), "This allows a function to have multiple alias commands without creating multiple files!");
T2C_Send.error(Main.getInstance(), "");
T2C_Send.error(Main.getInstance(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
public static void convertAddPermission(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("SubAlias.Permission.Permission", "t2c.alias.sub.use.[alias]");
} else yamlConfiguration.set("Alias.Permission.Permission", "t2c.alias.use.[alias]");
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void convertAddCooldownInSecGlobal(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("Alias.CooldownInSec.Global", 0);
} else yamlConfiguration.set("Alias.CooldownInSec.Global", 0);
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void convertAddCooldownInSecPlayer(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("Alias.CooldownInSec.Player", 0);
} else yamlConfiguration.set("Alias.CooldownInSec.Player", 0);
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void convertAddPermissionMSG(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("SubAlias.Permission.CustomNoPermissionMSG", "");
} else yamlConfiguration.set("Alias.Permission.CustomNoPermissionMSG", "");
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void convertAddCostConfirm(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("SubAlias.Cost.Confirm", false);
} else yamlConfiguration.set("Alias.Cost.Confirm", false);
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -1,10 +1,10 @@
// This class was created by JaTiTV. // This class was created by JaTiTV.
package net.t2code.alias.Spigot.config.alias.newConfig; package net.t2code.alias.Spigot.config.alias;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.ConfigFileConverter;
import net.t2code.alias.Spigot.config.config.Config; import net.t2code.alias.Spigot.config.config.Config;
import net.t2code.alias.Spigot.config.config.Language;
import net.t2code.alias.Spigot.objects.AliasObject; import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Spigot.system.AliasRegister; import net.t2code.alias.Spigot.system.AliasRegister;
import net.t2code.alias.util.Util; import net.t2code.alias.util.Util;
@ -56,7 +56,7 @@ public class AliasFile {
cooldownPlayer("alias.cooldownInSec.player", 0, true, cooldownPlayer("alias.cooldownInSec.player", 0, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can set a player-specific cooldown for this alias.","The value corresponds to the seconds.","At 0, the cooldown is deactivated.","The placeholder [alias] is the alias name.","Bypass permission: t2c.alias.cooldown.player.[alias].bypass")); put(T2C_LanguageEnum.english, List.of("Here you can set a player-specific cooldown for this alias.", "The value corresponds to the seconds.", "At 0, the cooldown is deactivated.", "The placeholder [alias] is the alias name.", "Bypass permission: t2c.alias.cooldown.player.[alias].bypass"));
}}), }}),
costEnable("alias.cost.enable", false, true, costEnable("alias.cost.enable", false, true,
@ -67,7 +67,7 @@ public class AliasFile {
costConfirm("alias.cost.confirm", true, true, costConfirm("alias.cost.confirm", true, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can set if you have to confirm if you want to pay before executing the command","In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command.")); put(T2C_LanguageEnum.english, List.of("Here you can set if you have to confirm if you want to pay before executing the command", "In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command."));
}}), }}),
costPrice("alias.cost.price", 0.0, true, costPrice("alias.cost.price", 0.0, true,
new HashMap<>() {{ new HashMap<>() {{
@ -93,12 +93,12 @@ public class AliasFile {
bungeeCommand("alias.command.proxyCommand", false, true, bungeeCommand("alias.command.proxyCommand", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.","For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!","(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled).")); put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
}}), }}),
command("alias.command.commands", List.of(), true, command("alias.command.commands", List.of(), true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.","Placeholder: [player] = The player who executes the alias")); put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
}}), }}),
messageEnable("alias.message.enable", true, true, messageEnable("alias.message.enable", true, true,
@ -110,91 +110,97 @@ public class AliasFile {
messages("alias.message.messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), true, messages("alias.message.messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
}}), }}),
admin("alias.admin", null, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify that players with the permission () have a different function than other players.", "For example, you can say that players should come to a certain point and players with the admin function only to the server to the position where they were before.", "Example:", "Player: /warp CityBuild", "Player with Admin Perm: /server CityBuild"));
}}),
adminEnable("alias.admin.enable", false, true, adminEnable("alias.admin.enable", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can enable or disable the admin function"));
}}), }}),
adminPermission("alias.admin.permission", "t2c.alias.[alias].admin", true, adminPermission("alias.admin.permission", "t2c.alias.[alias].admin", true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you set the permission for the admin function","The placeholder [alias] is the alias name.","If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias."));
}}), }}),
adminCommandEnable("alias.admin.command.enable", true, true, adminCommandEnable("alias.admin.command.enable", true, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
}}), }}),
adminCommandAsConsole("alias.admin.command.commandAsConsole", true, true, adminCommandAsConsole("alias.admin.command.commandAsConsole", true, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
}}), }}),
adminBungeeCommand("alias.admin.command.proxyCommand", false, true, adminBungeeCommand("alias.admin.command.proxyCommand", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
}}), }}),
adminCommands("alias.admin.command.commands", Collections.singletonList("say hi"), true, adminCommands("alias.admin.command.commands", Collections.singletonList("say hi"), true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
}}), }}),
adminMessageEnable("alias.admin.message.enable", false, true, adminMessageEnable("alias.admin.message.enable", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
}}), }}),
adminMessages("alias.admin.message.messages", List.of(), true, adminMessages("alias.admin.message.messages", List.of(), true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
}}), }}),
consoleEnable("alias.console.enable", false, true, consoleEnable("alias.console.enable", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can define if the alias is also usable in the console and what it should do from there."));
}}), }}),
consoleCommandEnable("alias.console.command.enable", false, true, consoleCommandEnable("alias.console.command.enable", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
}}), }}),
consoleBungeeCommand("alias.console.command.proxyCommand", false, true, consoleBungeeCommand("alias.console.command.proxyCommand", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
}}), }}),
consoleCommands("alias.console.command.commands", List.of(), true, consoleCommands("alias.console.command.commands", List.of(), true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed."));
}}), }}),
consoleMessageEnable("alias.console.message.enable", false, true, consoleMessageEnable("alias.console.message.enable", false, true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
}}), }}),
consoleMessages("alias.console.message.messages", List.of(), true, consoleMessages("alias.console.message.messages", List.of(), true,
new HashMap<>() {{ new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("")); put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get."));
}}), }}),
; ;
@ -247,7 +253,7 @@ public class AliasFile {
public static void select(boolean isReload) { public static void select(boolean isReload) {
AliasConverter.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; assert fileArray != null;

View File

@ -1,71 +0,0 @@
package net.t2code.alias.Spigot.config.alias;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.util.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_Config;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_Config;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
public class CreateExampleAliasConfig {
public static void configCreate() {
long long_ = System.currentTimeMillis();
T2C_Send.console(Util.getPrefix() + " §4Alias/aliasexample.yml are created...");
File config = new File(Main.getPath(), "Alias/aliasexample.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
T2C_Config.set("Alias.Enable", true, yamlConfiguration);
T2C_Config.set("Alias.AliasList", Arrays.asList("aliasexample1","t2caliasexample"),yamlConfiguration);
T2C_Config.set("Alias.Permission.Necessary", true, yamlConfiguration);
T2C_Config.set("Alias.Permission.Permission", "t2c.alias.use.[alias]", yamlConfiguration);
T2C_Config.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
T2C_Config.set("Alias.CooldownInSec.Global", 0, yamlConfiguration);
T2C_Config.set("Alias.CooldownInSec.Player", 0, yamlConfiguration);
T2C_Config.set("Alias.Cost.Enable", false,yamlConfiguration);
T2C_Config.set("Alias.Cost.Confirm", true,yamlConfiguration);
T2C_Config.set("Alias.Cost.Price", 0.0,yamlConfiguration);
T2C_Config.set("Alias.Cost.AllowByPass", true,yamlConfiguration);
T2C_Config.set("Alias.Command.Enable", false, yamlConfiguration);
T2C_Config.set("Alias.Command.CommandAsConsole", true, yamlConfiguration);
T2C_Config.set("Alias.Command.BungeeCommand", false, yamlConfiguration);
T2C_Config.set("Alias.Command.Commands", Arrays.asList(), yamlConfiguration);
T2C_Config.set("Alias.Message.Enable", true, yamlConfiguration);
T2C_Config.set("Alias.Message.Messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), yamlConfiguration);
T2C_Config.set("Alias.Admin.Enable", false, yamlConfiguration);
T2C_Config.set("Alias.Admin.Permission", "t2c.alias.[alias].admin", yamlConfiguration);
T2C_Config.set("Alias.Admin.Command.Enable", true, yamlConfiguration);
T2C_Config.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
T2C_Config.set("Alias.Admin.Command.BungeeCommand", false, yamlConfiguration);
T2C_Config.set("Alias.Admin.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
T2C_Config.set("Alias.Admin.Message.Enable", false, yamlConfiguration);
T2C_Config.set("Alias.Admin.Message.Messages", Arrays.asList(), yamlConfiguration);
T2C_Config.set("Alias.Console.Enable", false, yamlConfiguration);
T2C_Config.set("Alias.Console.Command.Enable", false, yamlConfiguration);
T2C_Config.set("Alias.Console.Command.BungeeCommand", false, yamlConfiguration);
T2C_Config.set("Alias.Console.Command.Commands", Arrays.asList(), yamlConfiguration);
T2C_Config.set("Alias.Console.Message.Enable", false, yamlConfiguration);
T2C_Config.set("Alias.Console.Message.Messages", Arrays.asList(), yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
T2C_Send.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}

View File

@ -1,131 +0,0 @@
package net.t2code.alias.Spigot.config.alias;
import com.google.common.base.Preconditions;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.system.AliasRegister;
import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.util.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
public class SelectAlias {
private static String Prefix = Util.getPrefix();
public SelectAlias(Main main){
onSelect(main);
}
private void onSelect(Main main) {
Main.aliasHashMap.clear();
Main.allAliases.clear();
File f = new File(Main.getPath() + "/Alias/");
File[] fileArray = f.listFiles();
for (File config_gui : fileArray) {
if (config_gui.getName().equals("X_aliasDeclaration_X.yml")) continue;
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
if (sub.equals(".yml")) {
YamlConfiguration yamlConfiguration;
try {
Preconditions.checkArgument(config_gui != null, "File cannot be null");
YamlConfiguration config = new YamlConfiguration();
config.load(config_gui);
yamlConfiguration = config;
} catch (FileNotFoundException var3) {
continue;
} catch (IOException var4) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var4);
continue;
} catch (InvalidConfigurationException var5) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var5);
continue;
}
Boolean aliasEnable = yamlConfiguration.getBoolean("Alias.Enable");
List<String> aliasList;
if (yamlConfiguration.get("Alias.AliasList") == null) {
AliasConfigConverter.convertAliasList(yamlConfiguration, config_gui);
}
aliasList = yamlConfiguration.getStringList("Alias.AliasList");
Boolean permNecessary = yamlConfiguration.getBoolean("Alias.Permission.Necessary");
if (yamlConfiguration.get("Alias.Permission.Permission") == null) {
AliasConfigConverter.convertAddPermission(yamlConfiguration, config_gui, false);
}
String permission = yamlConfiguration.getString("Alias.Permission.Permission");
if (yamlConfiguration.get("Alias.Permission.CustomNoPermissionMSG") == null) {
AliasConfigConverter.convertAddPermissionMSG(yamlConfiguration, config_gui, false);
}
String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG");
if (yamlConfiguration.get("Alias.CooldownInSec.Global") == null) {
AliasConfigConverter.convertAddCooldownInSecGlobal(yamlConfiguration, config_gui, false);
}
Integer cooldownGlobal = yamlConfiguration.getInt("Alias.CooldownInSec.Global");
if (yamlConfiguration.get("Alias.CooldownInSec.Player") == null) {
AliasConfigConverter.convertAddCooldownInSecPlayer(yamlConfiguration, config_gui, false);
}
Integer cooldownPlayer = yamlConfiguration.getInt("Alias.CooldownInSec.Player");
Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable");
if (yamlConfiguration.get("Alias.Cost.Confirm") == null) {
AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, false);
}
Boolean costConfirm = yamlConfiguration.getBoolean("Alias.Cost.Confirm");
Double costPrice = yamlConfiguration.getDouble("Alias.Cost.Price");
Boolean costAllowBypass = yamlConfiguration.getBoolean("Alias.Cost.AllowByPass");
Boolean commandEnable = yamlConfiguration.getBoolean("Alias.Command.Enable");
Boolean commandAsConsole = yamlConfiguration.getBoolean("Alias.Command.CommandAsConsole");
Boolean bungeeCommand = yamlConfiguration.getBoolean("Alias.Command.BungeeCommand");
List<String> command = yamlConfiguration.getStringList("Alias.Command.Commands");
Boolean messageEnable = yamlConfiguration.getBoolean("Alias.Message.Enable");
List<String> messages = yamlConfiguration.getStringList("Alias.Message.Messages");
Boolean adminEnable = yamlConfiguration.getBoolean("Alias.Admin.Enable");
String adminPermission = yamlConfiguration.getString("Alias.Admin.Permission");
Boolean adminCommandEnable = yamlConfiguration.getBoolean("Alias.Admin.Command.Enable");
Boolean adminCommandAsConsole = yamlConfiguration.getBoolean("Alias.Admin.Command.CommandAsConsole");
Boolean adminBungeeCommand = yamlConfiguration.getBoolean("Alias.Admin.Command.BungeeCommand");
List<String> adminCommands = yamlConfiguration.getStringList("Alias.Admin.Command.Commands");
Boolean adminMessageEnable = yamlConfiguration.getBoolean("Alias.Admin.Message.Enable");
List<String> adminMessages = yamlConfiguration.getStringList("Alias.Admin.Message.Messages");
Boolean consoleEnable = yamlConfiguration.getBoolean("Alias.Console.Enable");
Boolean consoleCommandEnable = yamlConfiguration.getBoolean("Alias.Console.Command.Enable");
Boolean consoleBungeeCommand = yamlConfiguration.getBoolean("Alias.Console.Command.BungeeCommand");
List<String> consoleCommands = yamlConfiguration.getStringList("Alias.Console.Command.Commands");
Boolean consoleMessageEnable = yamlConfiguration.getBoolean("Alias.Console.Message.Enable");
List<String> consoleMessages = yamlConfiguration.getStringList("Alias.Console.Message.Messages");
Main.allAliases.addAll(aliasList);
AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, permission, permissionMSG, cooldownGlobal, cooldownPlayer, costEnable, costConfirm, costPrice, costAllowBypass, commandEnable,
commandAsConsole, bungeeCommand, command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands, adminMessageEnable,
adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
for (String al : aliasList) {
Main.aliasHashMap.put(al, alias);
}
T2C_Send.console(Prefix + " §aAlias file §e" + config_gui.getName() + " §awas loaded");
}
}
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
new AliasRegister(main);
}
private YamlConfiguration loadFile(File file) throws InvalidConfigurationException {
return YamlConfiguration.loadConfiguration(file);
}
}

View File

@ -1,93 +0,0 @@
// This class was created by JaTiTV.
package net.t2code.alias.Spigot.config.alias.newConfig;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.util.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
import net.t2code.t2codelib.util.T2C_ConfigItem;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
public class AliasConverter {
private static YamlConfiguration yamlConfiguration;
public static void convert() {
File configDeclaration = new File(Main.getPath() + "X_configDeclaration_X.yml");
if (configDeclaration.exists()) configDeclaration.delete();
File aliasDeclaration = new File(Main.getPath() + "/Alias/X_aliasDeclaration_X.yml");
if (aliasDeclaration.exists()) aliasDeclaration.delete();
File subaliasDeclaration = new File(Main.getPath() + "/SubAlias/X_subAliasDeclaration_X.yml");
if (subaliasDeclaration.exists()) subaliasDeclaration.delete();
convertAlias();
convertSubAlias();
}
private static void convertAlias() {
File f = new File(Main.getPath() + "/Alias/");
if (!f.exists()) return;
File[] fileArray = f.listFiles();
assert fileArray != null;
for (File file : fileArray) {
String sub = file.getName().substring(file.getName().length() - 4);
if (sub.equals(".yml")) {
yamlConfiguration = YamlConfiguration.loadConfiguration(file);
setConfig("Alias.Enable", AliasFile.VALUES.aliasEnable);
setConfig("Alias.AliasList", AliasFile.VALUES.aliasList);
setConfig("Alias.Permission.Necessary", AliasFile.VALUES.permNecessary);
setConfig("Alias.Permission.Permission", AliasFile.VALUES.permission);
setConfig("Alias.Permission.CustomNoPermissionMSG", AliasFile.VALUES.permissionMSG);
setConfig("Alias.CooldownInSec.Global", AliasFile.VALUES.cooldownGlobal);
setConfig("Alias.CooldownInSec.Player", AliasFile.VALUES.cooldownPlayer);
setConfig("Alias.Cost.Enable", AliasFile.VALUES.costEnable);
setConfig("Alias.Cost.Confirm", AliasFile.VALUES.costConfirm);
setConfig("Alias.Cost.Price", AliasFile.VALUES.costPrice);
setConfig("Alias.Cost.AllowByPass", AliasFile.VALUES.costAllowBypass);
setConfig("Alias.Command.Enable", AliasFile.VALUES.commandEnable);
setConfig("Alias.Command.CommandAsConsole", AliasFile.VALUES.commandAsConsole);
setConfig("Alias.Command.BungeeCommand", AliasFile.VALUES.bungeeCommand);
setConfig("Alias.Command.Commands", AliasFile.VALUES.command);
setConfig("Alias.Message.Enable", AliasFile.VALUES.messageEnable);
setConfig("Alias.Message.Messages", AliasFile.VALUES.messages);
setConfig("Alias.Admin.Enable", AliasFile.VALUES.adminEnable);
setConfig("Alias.Admin.Permission", AliasFile.VALUES.adminPermission);
setConfig("Alias.Admin.Command.Enable", AliasFile.VALUES.adminCommandEnable);
setConfig("Alias.Admin.Command.CommandAsConsole", AliasFile.VALUES.adminCommandAsConsole);
setConfig("Alias.Admin.Command.BungeeCommand", AliasFile.VALUES.adminBungeeCommand);
setConfig("Alias.Admin.Command.Commands", AliasFile.VALUES.adminCommands);
setConfig("Alias.Admin.Message.Enable", AliasFile.VALUES.adminMessageEnable);
setConfig("Alias.Admin.Message.Messages", AliasFile.VALUES.adminMessages);
setConfig("Alias.Console.Enable", AliasFile.VALUES.consoleEnable);
setConfig("Alias.Console.Command.Enable", AliasFile.VALUES.consoleCommandEnable);
setConfig("Alias.Console.Command.BungeeCommand", AliasFile.VALUES.consoleBungeeCommand);
setConfig("Alias.Console.Command.Commands", AliasFile.VALUES.consoleCommands);
setConfig("Alias.Console.Message.Enable", AliasFile.VALUES.consoleMessageEnable);
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());
}
}
if (f.renameTo(new File(Main.getPath() + "/OldConfig/Alias/"))) {
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4Die Alias Dateien im Ordner plugins/T2C-Alias/Alias", false);
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4wurden in den neuen Ordner plugins/T2C-Alias/alias konvertiert!", false);
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4Die alten dateien wurden in plugins/T2C-Alias/OldConfig/Alias verschoben.", false);
}
}
private static void convertSubAlias() {
}
private static void setConfig(String path, T2C_ConfigItem item) {
if (yamlConfiguration.contains(path)) {
item.setValue(yamlConfiguration.get(path));
}
}
}

View File

@ -1,70 +0,0 @@
package net.t2code.alias.Spigot.config.subAlias;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.util.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_Config;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
public class CreateExampleSubAliasConfig {
public static void configCreate() {
long long_ = System.currentTimeMillis();
T2C_Send.console(Util.getPrefix() + " §4SubAlias/aliasexample.yml are created...");
File config = new File(Main.getPath(), "SubAlias/aliasexample.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
T2C_Config.set("SubAlias.Enable", true, yamlConfiguration);
T2C_Config.set("SubAlias.SubAliasList", Arrays.asList("test"), yamlConfiguration);
T2C_Config.set("SubAlias.SubAliasFor", "aliasexample1", yamlConfiguration);
T2C_Config.set("SubAlias.Permission.Necessary", true, yamlConfiguration);
T2C_Config.set("SubAlias.Permission.Permission", "t2c.alias.sub.use.[alias]", yamlConfiguration);
T2C_Config.set("SubAlias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
T2C_Config.set("SubAlias.CooldownInSec.Global", 0, yamlConfiguration);
T2C_Config.set("SubAlias.CooldownInSec.Player", 0, yamlConfiguration);
T2C_Config.set("SubAlias.Cost.Enable", false, yamlConfiguration);
T2C_Config.set("SubAlias.Cost.Confirm", true,yamlConfiguration);
T2C_Config.set("SubAlias.Cost.Price", 0.0, yamlConfiguration);
T2C_Config.set("SubAlias.Cost.AllowByPass", true, yamlConfiguration);
T2C_Config.set("SubAlias.Command.Enable", true, yamlConfiguration);
T2C_Config.set("SubAlias.Command.CommandAsConsole", true, yamlConfiguration);
T2C_Config.set("SubAlias.Command.BungeeCommand", false, yamlConfiguration);
T2C_Config.set("SubAlias.Command.Commands", Arrays.asList("say hi"), yamlConfiguration);
T2C_Config.set("SubAlias.Message.Enable", false, yamlConfiguration);
T2C_Config.set("SubAlias.Message.Messages",Arrays.asList(), yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Enable", false, yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Permission", "t2c.alias.admin", yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Command.Enable", true, yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Command.BungeeCommand", false, yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Command.Commands", Arrays.asList("say subalias hi"), yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Message.Enable", false, yamlConfiguration);
T2C_Config.set("SubAlias.Admin.Message.Messages",Arrays.asList(), yamlConfiguration);
T2C_Config.set("SubAlias.Console.Enable", false, yamlConfiguration);
T2C_Config.set("SubAlias.Console.Command.Enable", false, yamlConfiguration);
T2C_Config.set("SubAlias.Console.Command.BungeeCommand", false, yamlConfiguration);
T2C_Config.set("SubAlias.Console.Command.Commands",Arrays.asList(), yamlConfiguration);
T2C_Config.set("SubAlias.Console.Message.Enable", false, yamlConfiguration);
T2C_Config.set("SubAlias.Console.Message.Messages",Arrays.asList(), yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
T2C_Send.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}

View File

@ -1,127 +0,0 @@
package net.t2code.alias.Spigot.config.subAlias;
import com.google.common.base.Preconditions;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.alias.AliasConfigConverter;
import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.alias.util.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
public class SelectSubAlias {
private static String Prefix = Util.getPrefix();
public static void onSelect() {
Main.subAliasHashMap.clear();
Main.allSubAliases.clear();
File f = new File(Main.getPath() + "/SubAlias/");
File[] fileArray = f.listFiles();
for (File config_gui : fileArray) {
if (config_gui.getName().equals("X_subAliasDeclaration_X.yml")) continue;
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
if (sub.equals(".yml")) {
YamlConfiguration yamlConfiguration;
try {
Preconditions.checkArgument(config_gui != null, "File cannot be null");
YamlConfiguration config = new YamlConfiguration();
config.load(config_gui);
yamlConfiguration = config;
} catch (FileNotFoundException var3) {
continue;
} catch (IOException var4) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var4);
continue;
} catch (InvalidConfigurationException var5) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var5);
continue;
}
Boolean aliasEnable = yamlConfiguration.getBoolean("SubAlias.Enable");
List<String> subAliasList = yamlConfiguration.getStringList("SubAlias.SubAliasList");
String subAliasFor = yamlConfiguration.getString("SubAlias.SubAliasFor");
int subAliasArg = 0;
if (subAliasFor != null) {
String[] imp = subAliasFor.split(" ");
if (!Main.allAliases.contains(imp[0])) {
T2C_Send.error(Main.getInstance(), "The alias " + imp[0] + " in the file " + config_gui.getName() + " does not exist!");
}
String[] args = subAliasFor.split(" ");
subAliasArg = args.length - 1;
}
Boolean permNecessary = yamlConfiguration.getBoolean("SubAlias.Permission.Necessary");
if (yamlConfiguration.get("SubAlias.Permission.Permission") == null) {
AliasConfigConverter.convertAddPermission(yamlConfiguration, config_gui, true);
}
String permission = yamlConfiguration.getString("SubAlias.Permission.Permission");
if (yamlConfiguration.get("SubAlias.Permission.CustomNoPermissionMSG") == null) {
AliasConfigConverter.convertAddPermissionMSG(yamlConfiguration, config_gui, true);
}
String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG");
if (yamlConfiguration.get("SubAlias.CooldownInSec.Global") == null) {
AliasConfigConverter.convertAddCooldownInSecGlobal(yamlConfiguration, config_gui, true);
}
Integer cooldownGlobal = yamlConfiguration.getInt("SubAlias.CooldownInSec.Global");
if (yamlConfiguration.get("SubAlias.CooldownInSec.Player") == null) {
AliasConfigConverter.convertAddCooldownInSecPlayer(yamlConfiguration, config_gui, true);
}
Integer cooldownPlayer = yamlConfiguration.getInt("SubAlias.CooldownInSec.Player");
Boolean costEnable = yamlConfiguration.getBoolean("SubAlias.Cost.Enable");
if (yamlConfiguration.get("SubAlias.Cost.Confirm") == null) {
AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, true);
}
Boolean costConfirm = yamlConfiguration.getBoolean("SubAlias.Cost.Confirm");
Double costPrice = yamlConfiguration.getDouble("SubAlias.Cost.Price");
Boolean costAllowBypass = yamlConfiguration.getBoolean("SubAlias.Cost.AllowByPass");
Boolean commandEnable = yamlConfiguration.getBoolean("SubAlias.Command.Enable");
Boolean commandAsConsole = yamlConfiguration.getBoolean("SubAlias.Command.CommandAsConsole");
Boolean bungeeCommand = yamlConfiguration.getBoolean("SubAlias.Command.BungeeCommand");
List<String> command = yamlConfiguration.getStringList("SubAlias.Command.Commands");
Boolean messageEnable = yamlConfiguration.getBoolean("SubAlias.Message.Enable");
List<String> messages = yamlConfiguration.getStringList("SubAlias.Message.Messages");
Boolean adminEnable = yamlConfiguration.getBoolean("SubAlias.Admin.Enable");
String adminPermission = yamlConfiguration.getString("SubAlias.Admin.Permission");
Boolean adminCommandEnable = yamlConfiguration.getBoolean("SubAlias.Admin.Command.Enable");
Boolean adminCommandAsConsole = yamlConfiguration.getBoolean("SubAlias.Admin.Command.CommandAsConsole");
Boolean adminBungeeCommand = yamlConfiguration.getBoolean("SubAlias.Admin.Command.BungeeCommand");
List<String> adminCommands = yamlConfiguration.getStringList("SubAlias.Admin.Command.Commands");
Boolean adminMessageEnable = yamlConfiguration.getBoolean("SubAlias.Admin.Message.Enable");
List<String> adminMessages = yamlConfiguration.getStringList("SubAlias.Admin.Message.Messages");
Boolean consoleEnable = yamlConfiguration.getBoolean("SubAlias.Console.Enable");
Boolean consoleCommandEnable = yamlConfiguration.getBoolean("SubAlias.Console.Command.Enable");
Boolean consoleBungeeCommand = yamlConfiguration.getBoolean("SubAlias.Console.Command.BungeeCommand");
List<String> consoleCommands = yamlConfiguration.getStringList("SubAlias.Console.Command.Commands");
Boolean consoleMessageEnable = yamlConfiguration.getBoolean("SubAlias.Console.Message.Enable");
List<String> consoleMessages = yamlConfiguration.getStringList("SubAlias.Console.Message.Messages");
SubAliasObject subAlias = new SubAliasObject(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, permission, permissionMSG, cooldownGlobal, cooldownPlayer, costEnable, costConfirm,
costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand, command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole,
adminBungeeCommand, adminCommands, adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
for (String sal : subAliasList) {
Main.subAliasHashMap.put(sal, subAlias);
}
Main.allSubAliases.addAll(subAliasList);
Main.allForSubAliases.add(subAliasFor);
T2C_Send.console(Prefix + " §aSubAlias file §e" + config_gui.getName() + " §awas loaded");
}
}
}
}

View File

@ -0,0 +1,351 @@
// This class was created by JaTiTV.
package net.t2code.alias.Spigot.config.subAlias;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.ConfigFileConverter;
import net.t2code.alias.Spigot.config.config.Config;
import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.alias.Spigot.system.AliasRegister;
import net.t2code.alias.util.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
import net.t2code.t2codelib.util.T2C_ConfigItem;
import net.t2code.t2codelib.util.T2C_LanguageEnum;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
public class SubAliasFile {
public enum VALUES implements T2C_ConfigItem {
aliasEnable("subAlias.enable", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can disable the alias."));
}}),
subAliasList("subAlias.subAliasList", List.of("subaliasexample1"), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Specify here what the SubAlias commands should be for this function"));
}}),
subAliasFor("subAlias.subAliasFor", List.of("aliasexample1"), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Enter here the alias command where the subalias should follow.","For example:"," - aliasexample1 -> aliasexample1 <this SubAlias>"," - aliasexample2 test -> aliasexample2 test <this SubAlias>"));
}}),
permNecessary("subAlias.permission.necessary", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can say if a permission is needed to use the alias."));
}}),
permission("subAlias.permission.permission", "t2c.alias.use.[alias]", true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can set the permission for the alias.", "The placeholder <alias> is the alias name.", "If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias."));
}}),
permissionMSG("subAlias.permission.customNoPermissionMSG", "", true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank."));
}}),
cooldownGlobal("subAlias.cooldownInSec.global", 0, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can set a global cooldown for this alias.", "The value corresponds to the seconds.", "At 0, the cooldown is deactivated.", "The placeholder [alias] is the alias name.", "Bypass permission: t2c.alias.cooldown.global.[alias].bypass", "(The global cooldown is above the player cooldown)."));
}}),
cooldownPlayer("subAlias.cooldownInSec.player", 0, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can set a player-specific cooldown for this alias.", "The value corresponds to the seconds.", "At 0, the cooldown is deactivated.", "The placeholder [alias] is the alias name.", "Bypass permission: t2c.alias.cooldown.player.[alias].bypass"));
}}),
costEnable("subAlias.cost.enable", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can say if you have to pay for the alias."));
}}),
costConfirm("subAlias.cost.confirm", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can set if you have to confirm if you want to pay before executing the command", "In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command."));
}}),
costPrice("subAlias.cost.price", 0.0, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you set the price."));
}}),
costAllowBypass("subAlias.Cost.allowByPass", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you define if the bypass is activated or if you have to pay despite the bypass (t2c.alias.buy.[alias].bypass)."));
}}),
commandEnable("subAlias.command.enable", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
}}),
commandAsConsole("subAlias.command.commandAsConsole", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
}}),
bungeeCommand("subAlias.command.proxyCommand", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
}}),
command("subAlias.command.commands", List.of(), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
}}),
messageEnable("subAlias.message.enable", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
}}),
messages("subAlias.message.messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
}}),
admin("subAlias.admin", null, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify that players with the permission () have a different function than other players.", "For example, you can say that players should come to a certain point and players with the admin function only to the server to the position where they were before.", "Example:", "Player: /warp CityBuild", "Player with Admin Perm: /server CityBuild"));
}}),
adminEnable("subAlias.admin.enable", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can enable or disable the admin function"));
}}),
adminPermission("subAlias.admin.permission", "t2c.alias.[alias].admin", true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you set the permission for the admin function","The placeholder [alias] is the alias name.","If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias."));
}}),
adminCommandEnable("subAlias.admin.command.enable", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
}}),
adminCommandAsConsole("subAlias.admin.command.commandAsConsole", true, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
}}),
adminBungeeCommand("subAlias.admin.command.proxyCommand", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
}}),
adminCommands("subAlias.admin.command.commands", Collections.singletonList("say hi"), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
}}),
adminMessageEnable("subAlias.admin.message.enable", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
}}),
adminMessages("subAlias.admin.message.messages", List.of(), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
}}),
consoleEnable("subAlias.console.enable", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can define if the alias is also usable in the console and what it should do from there."));
}}),
consoleCommandEnable("subAlias.console.command.enable", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
}}),
consoleBungeeCommand("subAlias.console.command.proxyCommand", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
}}),
consoleCommands("subAlias.console.command.commands", List.of(), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed."));
}}),
consoleMessageEnable("subAlias.console.message.enable", false, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
}}),
consoleMessages("subAlias.console.message.messages", List.of(), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get."));
}}),
;
private final String path;
private Object value;
private final boolean forceSet;
private final HashMap<T2C_LanguageEnum, List<String>> comments;
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
this.path = path;
this.value = value;
this.forceSet = forceSet;
this.comments = comments;
}
@Override
public String getPath() {
return path;
}
@Override
public Object getValue() {
return value;
}
@Override
public boolean getForceSet() {
return forceSet;
}
@Override
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
return comments;
}
@Override
public String getLanguagePath() {
return Config.VALUES.language.getPath();
}
@Override
public void setValue(Object newValue) {
value = newValue;
}
}
public static void set(boolean isReload) {
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "subAlias/subaliasexample.yml"), VALUES.values(), isReload, Util.getConfigLogo());
}
public static void select(boolean isReload) {
ConfigFileConverter.convert();
File f = new File(Main.getPath() + "/subAlias/");
File[] fileArray = f.listFiles();
assert fileArray != null;
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(), "subAlias/" + file.getName()), VALUES.values(), isReload, Util.getConfigLogo());
for (String s : (List<String>) VALUES.subAliasList.value) {
if (s != null) {
Main.allSubAliases.add(s);
}
}
Main.allForSubAliases.add((String) VALUES.subAliasFor.value);
int subAliasArg = 0;
if ((String) VALUES.subAliasFor.value != null) {
String[] imp = ((String) VALUES.subAliasFor.value).split(" ");
if (!Main.allAliases.contains(imp[0])) {
T2C_Send.error(Main.getInstance(), "The alias " + imp[0] + " in the file " + file.getName() + " does not exist!");
}
String[] args = ((String) VALUES.subAliasFor.value).split(" ");
subAliasArg = args.length - 1;
}
SubAliasObject subAlias = new SubAliasObject(
(boolean) VALUES.aliasEnable.value,
(List<String>) VALUES.subAliasList.value,
(String) VALUES.subAliasFor.value,
subAliasArg,
(boolean) VALUES.permNecessary.value,
(String) VALUES.permission.value,
(String) VALUES.permissionMSG.value,
(int) VALUES.cooldownGlobal.value,
(int) VALUES.cooldownPlayer.value,
(boolean) VALUES.costEnable.value,
(boolean) VALUES.costConfirm.value,
(double) VALUES.costPrice.value,
(boolean) VALUES.costAllowBypass.value,
(boolean) VALUES.commandEnable.value,
(boolean) VALUES.commandAsConsole.value,
(boolean) VALUES.bungeeCommand.value,
(List<String>) VALUES.command.value,
(boolean) VALUES.messageEnable.value,
(List<String>) VALUES.messages.value,
(boolean) VALUES.adminEnable.value,
(String) VALUES.adminPermission.value,
(boolean) VALUES.adminCommandEnable.value,
(boolean) VALUES.adminCommandAsConsole.value,
(boolean) VALUES.adminBungeeCommand.value,
(List<String>) VALUES.adminCommands.value,
(boolean) VALUES.adminMessageEnable.value,
(List<String>) VALUES.adminMessages.value,
(boolean) VALUES.consoleEnable.value,
(boolean) VALUES.consoleCommandEnable.value,
(boolean) VALUES.consoleBungeeCommand.value,
(List<String>) VALUES.consoleCommands.value,
(boolean) VALUES.consoleMessageEnable.value,
(List<String>) VALUES.consoleMessages.value);
for (String sal : (List<String>) VALUES.subAliasList.value) {
Main.subAliasHashMap.put(sal, subAlias);
}
}
}
new AliasRegister(Main.getInstance());
}
}

View File

@ -3,11 +3,10 @@ package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter; import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
import net.t2code.alias.Spigot.cmdManagement.TabEvent; import net.t2code.alias.Spigot.cmdManagement.TabEvent;
import net.t2code.alias.Spigot.config.alias.newConfig.AliasFile; import net.t2code.alias.Spigot.config.alias.AliasFile;
import net.t2code.alias.Spigot.config.config.Config; import net.t2code.alias.Spigot.config.config.Config;
import net.t2code.alias.Spigot.config.config.Language; import net.t2code.alias.Spigot.config.config.Language;
import net.t2code.alias.Spigot.config.subAlias.CreateExampleSubAliasConfig; import net.t2code.alias.Spigot.config.subAlias.SubAliasFile;
import net.t2code.alias.Spigot.config.subAlias.SelectSubAlias;
import net.t2code.alias.Spigot.confirm.ChatConfirm; import net.t2code.alias.Spigot.confirm.ChatConfirm;
import net.t2code.alias.Spigot.confirm.gui.GuiListener; import net.t2code.alias.Spigot.confirm.gui.GuiListener;
import net.t2code.alias.Spigot.enums.Confirm; import net.t2code.alias.Spigot.enums.Confirm;
@ -16,6 +15,7 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register; import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register;
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI; import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig; import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
import net.t2code.t2codelib.util.T2C_Util;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -51,34 +51,16 @@ public class Load {
Config.set(isReload); Config.set(isReload);
T2C_Template.onLoadSeparateStroke(Util.getPrefix()); T2C_Template.onLoadSeparateStroke(Util.getPrefix());
Language.set(false); Language.set(false);
if (newInstall) { //todo old
// try {
// CreateExampleAliasConfig.configCreate();
//} catch (Exception e) {
// e.printStackTrace();
// }
try {
CreateExampleSubAliasConfig.configCreate();
} catch (Exception e) {
e.printStackTrace();
}
}
if (newInstall) { if (newInstall) {
AliasFile.set(false); AliasFile.set(false);
SubAliasFile.set(false);
} }
AliasFile.select(false); AliasFile.select(false);
SubAliasFile.select(false);
try {
plugin.saveResource("SubAlias/X_subAliasDeclaration_X.yml", true);
} catch (Exception e) {
e.printStackTrace();
}
T2C_Template.onLoadSeparateStroke(Util.getPrefix()); T2C_Template.onLoadSeparateStroke(Util.getPrefix());
T2C_Template.onLoadSeparateStroke(Util.getPrefix()); T2C_Template.onLoadSeparateStroke(Util.getPrefix());
SelectSubAlias.onSelect();
if ((Boolean) Config.VALUES.subAliasTab.getValue()) { if ((Boolean) Config.VALUES.subAliasTab.getValue()) {
T2C_Register.listener(new TabEvent(), plugin); T2C_Register.listener(new TabEvent(), plugin);
} }
@ -87,7 +69,7 @@ public class Load {
guiListener = new GuiListener(); guiListener = new GuiListener();
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.GUI) T2C_Register.listener(guiListener, plugin); if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.GUI) T2C_Register.listener(guiListener, plugin);
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) { if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd"); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyCommand());
} }
AliasRegisterPermissions.onPermRegister(); AliasRegisterPermissions.onPermRegister();
} }