diff --git a/pom.xml b/pom.xml index 42455b8..0b47090 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ net.t2code Alias - 1.6_beta-1 + 1.6_dev-23 @@ -101,7 +101,7 @@ net.t2code T2CodeLib 16.7 - dev-21 + dev-23 provided diff --git a/src/main/java/net/t2code/alias/Spigot/config/alias/AliasFile.java b/src/main/java/net/t2code/alias/Spigot/config/alias/AliasFile.java index f0a5069..2d57a22 100644 --- a/src/main/java/net/t2code/alias/Spigot/config/alias/AliasFile.java +++ b/src/main/java/net/t2code/alias/Spigot/config/alias/AliasFile.java @@ -303,7 +303,7 @@ public class AliasFile { } } } - new AliasRegister(Main.getInstance()); + new AliasRegister(Main.getInstance(),isReload); } } diff --git a/src/main/java/net/t2code/alias/Spigot/config/subAlias/SubAliasFile.java b/src/main/java/net/t2code/alias/Spigot/config/subAlias/SubAliasFile.java index e010896..d03c890 100644 --- a/src/main/java/net/t2code/alias/Spigot/config/subAlias/SubAliasFile.java +++ b/src/main/java/net/t2code/alias/Spigot/config/subAlias/SubAliasFile.java @@ -32,7 +32,7 @@ public class SubAliasFile { 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, + subAliasFor("subAlias.subAliasFor", "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 "," - aliasexample2 test -> aliasexample2 test ")); @@ -43,7 +43,7 @@ public class SubAliasFile { 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, + permission("subAlias.permission.permission", "t2c.alias.sub.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 is the alias name.", "If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.")); @@ -91,7 +91,7 @@ public class SubAliasFile { 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, + commandAsConsole("subAlias.command.commandAsConsole", false, 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")); @@ -113,7 +113,7 @@ public class SubAliasFile { put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message.")); }}), - messages("subAlias.message.messages", Arrays.asList("This is a test alias", "With this you can use several functions such as colored text, Use Command'>clickable texts, For example Warps'>shorten commands of other plugins and much more.", "http://dc.t2code.net'>If you have any questions, please contact our support Discord."), true, + messages("subAlias.message.messages", List.of("This is a test subvcommand of T2C-Alias."), 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")); @@ -273,9 +273,10 @@ public class SubAliasFile { Main.allSubAliases.add(s); } } - Main.allForSubAliases.add((String) VALUES.subAliasFor.value); + int subAliasArg = 0; - if ((String) VALUES.subAliasFor.value != null) { + if (VALUES.subAliasFor.value != null) { + Main.allForSubAliases.add((String) VALUES.subAliasFor.value); 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!"); @@ -323,7 +324,6 @@ public class SubAliasFile { } } } - new AliasRegister(Main.getInstance()); } } diff --git a/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java b/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java index fb2a221..e372610 100644 --- a/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java +++ b/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java @@ -4,8 +4,6 @@ import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.cmdManagement.RegisterCommands; import net.t2code.alias.util.Util; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send; -import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion; -import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.plugin.SimplePluginManager; @@ -16,12 +14,12 @@ import java.util.Objects; public class AliasRegister { private Main main; - public AliasRegister(Main main) { + public AliasRegister(Main main, boolean isReload) { this.main = main; - loadAliasCommands(); + loadAliasCommands(isReload); } - private void loadAliasCommands() { + private void loadAliasCommands(boolean isReload) { CommandMap commandMap = getCommandMap(); unregister(commandMap); if (commandMap == null) { @@ -30,12 +28,11 @@ public class AliasRegister { } for (String alias : Main.allAliases) { - if (Main.aliasHashMap.get(alias).aliasEnable){ + if (Main.aliasHashMap.get(alias).aliasEnable) { - // Registrieren des Befehls -System.out.println("Alias: " +alias); - commandMap.register(main.getDescription().getName(), new RegisterCommands(alias)); - T2C_Send.console(Util.getPrefix() + " §aAlias §e" + alias + " §aregister"); + // Registrieren des Befehls + commandMap.register(main.getDescription().getName(), new RegisterCommands(alias)); + T2C_Send.sendStartTextCenter(Util.getPrefix(), "§aAlias §e" + alias + " §aregister", isReload); Main.loadAliasHashMap.put(alias, true); } else Main.loadAliasHashMap.put(alias, false); @@ -57,11 +54,10 @@ System.out.println("Alias: " +alias); } - private void unregister(CommandMap commandMap) { if (commandMap == null) return; for (Map.Entry entry : Main.loadAliasHashMap.entrySet()) { - if (entry.getValue()){ + if (entry.getValue()) { Objects.requireNonNull(commandMap.getCommand(entry.getKey())).unregister(commandMap); } } diff --git a/src/main/java/net/t2code/alias/Spigot/system/Load.java b/src/main/java/net/t2code/alias/Spigot/system/Load.java index 693fb31..1b045e6 100644 --- a/src/main/java/net/t2code/alias/Spigot/system/Load.java +++ b/src/main/java/net/t2code/alias/Spigot/system/Load.java @@ -36,9 +36,9 @@ public class Load { T2C_UpdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(), (Boolean) Config.VALUES.updateCheckOnJoin.getValue(), (Boolean) Config.VALUES.updateCheckSeePreReleaseUpdates.getValue(), (Integer) Config.VALUES.updateCheckTimeInterval.getValue()); - T2C_Template.onLoadFooter(prefix, long_); T2C_Register.listener(new PluginEvents(), plugin); Metrics.Bstats(plugin, bstatsID); + T2C_Template.onLoadFooter(prefix, long_); } private static ChatConfirm chatListener; @@ -49,8 +49,8 @@ public class Load { HandlerList.unregisterAll(guiListener); boolean newInstall = !new File(Main.getPath(), "config.yml").exists(); Config.set(isReload); - T2C_Template.onLoadSeparateStroke(Util.getPrefix()); Language.set(false); + T2C_Template.onLoadSeparateStroke(Util.getPrefix()); if (newInstall) { AliasFile.set(false); SubAliasFile.set(false); @@ -59,8 +59,6 @@ public class Load { SubAliasFile.select(false); - T2C_Template.onLoadSeparateStroke(Util.getPrefix()); - T2C_Template.onLoadSeparateStroke(Util.getPrefix()); if ((Boolean) Config.VALUES.subAliasTab.getValue()) { T2C_Register.listener(new TabEvent(), plugin); }