diff --git a/pom.xml b/pom.xml
index 275cc13..5d30bc4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,7 +69,8 @@
net.t2code
T2CodeLib
- 12.0
+ 12.4
+ dev-1
net.t2code
@@ -82,94 +83,10 @@
3.0
- net.t2code.minecraft.1_18.r2
+ net.t2code.minecraft.1_19.r1
spigot
- 1.18r2
-
-
- net.t2code.minecraft.1_18.r1
- spigot
- 1.18r1
-
-
- net.t2code.minecraft.1_17.r1
- spigot
- 1.17r1
-
-
- net.t2code.minecraft.1_16.r3
- spigot
- 1.16r3
-
-
- net.t2code.minecraft.1_16.r2
- spigot
- 1.16r2
-
-
- net.t2code.minecraft.1_16.r1
- spigot
- 1.16r1
-
-
- net.t2code.minecraft.1_15.r1
- spigot
- 1.15r1
-
-
- net.t2code.minecraft.1_14.r1
- spigot
- 1.14r1
-
-
- net.t2code.minecraft.1_13.r2
- spigot
- 1.13r2
-
-
- net.t2code.minecraft.1_13.r1
- spigot
- 1.13r1
-
-
- net.t2code.minecraft.1_12.r1
- spigot
- 1.12r1
-
-
- net.t2code.minecraft.1_11.r1
- spigot
- 1.11r1
-
-
- net.t2code.minecraft.1_10.r1
- spigot
- 1.10r1
-
-
- net.t2code.minecraft.1_9.r2
- spigot
- 1.9r2
-
-
- net.t2code.minecraft.1_9.r1
- spigot
- 1.9r1
-
-
- net.t2code.minecraft.1_8.r3
- spigot
- 1.8r3
-
-
- net.t2code.minecraft.1_8.r2
- spigot
- 1.8r2
-
-
- net.t2code.minecraft.1_8.r1
- spigot
- 1.8r1
+ 1.19r1
+
diff --git a/src/main/java/net/t2code/alias/Spigot/Main.java b/src/main/java/net/t2code/alias/Spigot/Main.java
index 6531807..6a93d36 100644
--- a/src/main/java/net/t2code/alias/Spigot/Main.java
+++ b/src/main/java/net/t2code/alias/Spigot/Main.java
@@ -1,7 +1,7 @@
package net.t2code.alias.Spigot;
-import net.t2code.alias.Spigot.objects.AliasObjekt;
-import net.t2code.alias.Spigot.objects.SubAliasObjekt;
+import net.t2code.alias.Spigot.objects.AliasObject;
+import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.alias.Spigot.system.Load;
import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
@@ -12,7 +12,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.Objects;
import java.util.logging.Level;
public final class Main extends JavaPlugin {
@@ -23,10 +22,11 @@ public final class Main extends JavaPlugin {
public static String version;
public static List autor;
public static Main plugin;
- public static HashMap aliasHashMap = new HashMap<>();
- public static HashMap subAliasHashMap = new HashMap<>();
+ public static HashMap aliasHashMap = new HashMap<>();
+ public static HashMap subAliasHashMap = new HashMap<>();
public static ArrayList allAliases = new ArrayList<>();
public static ArrayList allSubAliases = new ArrayList<>();
+ public static ArrayList allForSubAliases = new ArrayList<>();
@Override
public void onEnable() {
@@ -47,17 +47,32 @@ public final class Main extends JavaPlugin {
T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
}
- public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
+ public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
- Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: " +
- "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
+ Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
+ + "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return true;
} else {
- if (Double.parseDouble(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion()) < ver) {
+ String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
+ if (ver.contains("_")) {
+ if (!plVer.equals(ver)) {
+ plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
+ Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
+ + ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
+ + pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
+ Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
+ return true;
+ }
+ return false;
+ }
+ String[] split = plVer.split("_");
+ if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
- Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2" + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " + plugin.getDescription().getName() + ".");
+ Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
+ + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
+ + " §4to use this version of " + plugin.getDescription().getName() + ".");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return true;
}
diff --git a/src/main/java/net/t2code/alias/Spigot/cmdManagement/AliasCmdExecuter.java b/src/main/java/net/t2code/alias/Spigot/cmdManagement/AliasCmdExecuter.java
index 90982f5..d9d9a81 100644
--- a/src/main/java/net/t2code/alias/Spigot/cmdManagement/AliasCmdExecuter.java
+++ b/src/main/java/net/t2code/alias/Spigot/cmdManagement/AliasCmdExecuter.java
@@ -1,5 +1,6 @@
package net.t2code.alias.Spigot.cmdManagement;
+import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.languages.SelectMessages;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.command.Command;
@@ -9,6 +10,7 @@ import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -60,6 +62,11 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
List list = new ArrayList<>();
if (sender instanceof Player) {
Player p = (Player) sender;
+ send.debugmsg(Main.plugin, "------------");
+ send.debugmsg(Main.plugin, "tab a: " + 0);
+ send.debugmsg(Main.plugin, "tab a: " + args.length);
+ send.debugmsg(Main.plugin, "tab a: " + Arrays.toString(args));
+ send.debugmsg(Main.plugin, "tab a: " + arg1.toString());
if (args.length == 1) {
for (String command : arg1.keySet()) {
Boolean passend = true;
diff --git a/src/main/java/net/t2code/alias/Spigot/cmdManagement/ExecuteAlias.java b/src/main/java/net/t2code/alias/Spigot/cmdManagement/ExecuteAlias.java
new file mode 100644
index 0000000..5598262
--- /dev/null
+++ b/src/main/java/net/t2code/alias/Spigot/cmdManagement/ExecuteAlias.java
@@ -0,0 +1,288 @@
+package net.t2code.alias.Spigot.cmdManagement;
+
+import net.t2code.alias.Spigot.config.config.SelectConfig;
+import net.t2code.alias.Spigot.config.languages.SelectMessages;
+import net.t2code.alias.Spigot.objects.AliasObject;
+import net.t2code.alias.Spigot.objects.SubAliasObject;
+import net.t2code.alias.Spigot.system.BCommandSenderReciver;
+import net.t2code.alias.Util;
+import net.t2code.lib.Spigot.Lib.commands.Cmd;
+import net.t2code.lib.Spigot.Lib.eco.Eco;
+import net.t2code.lib.Spigot.Lib.messages.send;
+import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
+import net.t2code.lib.Spigot.Lib.replace.Replace;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class ExecuteAlias {
+ private static final String prefix = Util.getPrefix();
+
+ protected static void aliasPlayer(CommandSender sender, AliasObject aliasObject, String alias) {
+ Player player = (Player) sender;
+
+ if (aliasObject.adminEnable) {
+ if (player.hasPermission(aliasObject.adminPermission)) {
+ if (aliasObject.adminCommandEnable) {
+ aliasAdminCommand(aliasObject, player);
+ }
+ if (aliasObject.adminMessageEnable) {
+ aliasAdminMessage(aliasObject, player);
+ }
+ return;
+ }
+ }
+
+ if (aliasObject.permNecessary) {
+ if (!(player.hasPermission("t2code.alias.use." + alias.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) {
+ send.player(player, SelectMessages.noPermissionForCommand.replace("[cmd]", "/" + alias.toLowerCase())
+ .replace("[perm]", "t2code.alias.use." + alias.toLowerCase()));
+ return;
+ }
+ }
+ if (aliasObject.costEnable) {
+ if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
+ if (!Eco.moneyRemove(prefix, player, aliasObject.costPrice)) {
+ send.player(player, SelectMessages.noMoney);
+ return;
+ }
+ if (SelectConfig.buyMessage) send.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
+ }
+ }
+ if (aliasObject.commandEnable) {
+ aliasCommand(aliasObject, player);
+ }
+ if (aliasObject.messageEnable) {
+ aliasMessage(aliasObject, player);
+ }
+ }
+
+ protected static void subAliasPlayer(CommandSender sender, SubAliasObject aliasObject, String alias) {
+ if (!aliasObject.subAliasEnable) {
+ send.sender(sender, SelectMessages.aliasDisabled);
+ return;
+ }
+
+ if (sender instanceof Player) {
+ Player player = (Player) sender;
+
+ if (aliasObject.adminEnable) {
+ if (player.hasPermission(aliasObject.adminPermission)) {
+ if (aliasObject.adminCommandEnable) {
+ subAliasAdminCommand(aliasObject, player);
+ }
+ if (aliasObject.adminMessageEnable) {
+ subAliasAdminMessage(aliasObject, player);
+ }
+ return;
+ }
+ }
+
+ if (aliasObject.permNecessary) {
+ if (!(player.hasPermission("t2code.alias.use.subalias." + alias.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) {
+ send.player(player, SelectMessages.noPermissionForCommand.replace("[cmd]", "/" + alias.toLowerCase())
+ .replace("[perm]", "t2code.alias.subalias.use." + alias.toLowerCase()));
+ return;
+ }
+ }
+ if (aliasObject.costEnable) {
+ if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
+ if (!Eco.moneyRemove(prefix, player, aliasObject.costPrice)) {
+ send.player(player, SelectMessages.noMoney);
+ return;
+ }
+ if (SelectConfig.buyMessage) send.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
+ }
+ }
+ if (aliasObject.commandEnable) {
+ subAliasCommand(aliasObject, player);
+ }
+ if (aliasObject.messageEnable) {
+ subAliasMessage(aliasObject, player);
+ }
+ } else {
+ if (aliasObject.consoleEnable) {
+ subAliasConsole(aliasObject, sender);
+ } else send.sender(sender, SelectMessages.onlyForPlayer);
+ }
+ }
+
+ protected static void aliasConsole(AliasObject alias, CommandSender sender, String prefix) {
+ if (alias.consoleCommandEnable) {
+ for (String cmd : alias.consoleCommands) {
+ if (alias.consoleBungeeCommand) {
+ if (SelectConfig.Bungee) {
+ BCommandSenderReciver.sendToBungee(sender, cmd, true);
+ } else {
+ send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ }
+ } else {
+ Cmd.console(cmd);
+ }
+ }
+ }
+ if (alias.consoleMessageEnable) {
+ for (String msg : alias.consoleMessages) {
+ send.console(Replace.replace(prefix, msg));
+ }
+ }
+ }
+
+ private static void subAliasConsole(SubAliasObject alias, CommandSender sender) {
+ if (alias.consoleCommandEnable) {
+ for (String cmd : alias.consoleCommands) {
+ if (alias.consoleBungeeCommand) {
+ if (SelectConfig.Bungee) {
+ BCommandSenderReciver.sendToBungee(sender, cmd, true);
+ } else {
+ send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ }
+ } else {
+ Cmd.console(cmd);
+ }
+ }
+ }
+ if (alias.consoleMessageEnable) {
+ for (String msg : alias.consoleMessages) {
+ send.console(Replace.replace(prefix, msg));
+ }
+ }
+ }
+
+ private static void aliasAdminCommand(AliasObject alias, Player player) {
+ for (String cmd : alias.adminCommands) {
+ if (alias.adminBungeeCommand) {
+ if (SelectConfig.Bungee) {
+ BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), alias.adminCommandAsConsole);
+
+ } else {
+ send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ }
+ } else {
+ if (alias.adminCommandAsConsole) {
+ Cmd.console(cmd.replace("[player]", player.getName()));
+ } else {
+ Cmd.player(player, cmd.replace("[player]", player.getName()));
+ }
+ }
+ }
+ }
+
+ private static void subAliasAdminCommand(SubAliasObject alias, Player player) {
+ for (String cmd : alias.adminCommands) {
+ if (alias.adminBungeeCommand) {
+ if (SelectConfig.Bungee) {
+ BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), alias.adminCommandAsConsole);
+
+ } else {
+ send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ }
+ } else {
+ if (alias.adminCommandAsConsole) {
+ Cmd.console(cmd.replace("[player]", player.getName()));
+ } else {
+ Cmd.player(player, cmd.replace("[player]", player.getName()));
+ }
+ }
+ }
+ }
+
+ private static void aliasAdminMessage(AliasObject alias, Player player) {
+ for (String msg : alias.adminMessages) {
+ String text;
+ String hover;
+ if (PluginCheck.papi()) {
+ text = Replace.replace(prefix, player, replacePlayer(msg, player));
+ } else {
+ text = Replace.replace(prefix, replacePlayer(msg, player));
+ }
+ send.player(player, text);
+ }
+ }
+
+ private static void subAliasAdminMessage(SubAliasObject alias, Player player) {
+ for (String msg : alias.adminMessages) {
+ String text;
+ String hover;
+ if (PluginCheck.papi()) {
+ text = Replace.replace(prefix, player, replacePlayer(msg, player));
+ } else {
+ text = Replace.replace(prefix, replacePlayer(msg, player));
+ }
+ send.player(player, text);
+ }
+ }
+
+ private static void aliasCommand(AliasObject alias, Player player) {
+ for (String cmd : alias.command) {
+ if (alias.bungeeCommand) {
+ if (SelectConfig.Bungee) {
+ BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), alias.commandAsConsole);
+
+ } else {
+ send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ }
+ } else {
+ if (alias.commandAsConsole) {
+ Cmd.console(cmd.replace("[player]", player.getName()));
+ } else {
+ Cmd.player(player, cmd.replace("[player]", player.getName()));
+ }
+ }
+ }
+ }
+
+ private static void subAliasCommand(SubAliasObject alias, Player player) {
+ for (String cmd : alias.command) {
+ if (alias.bungeeCommand) {
+ if (SelectConfig.Bungee) {
+ BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), alias.commandAsConsole);
+
+ } else {
+ send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
+ }
+ } else {
+ if (alias.commandAsConsole) {
+ Cmd.console(cmd.replace("[player]", player.getName()));
+ } else {
+ Cmd.player(player, cmd.replace("[player]", player.getName()));
+ }
+ }
+ }
+ }
+
+ private static void aliasMessage(AliasObject alias, Player player) {
+ for (String msg : alias.messages) {
+ String text;
+ String hover;
+ if (PluginCheck.papi()) {
+ text = Replace.replace(prefix, player, replacePlayer(msg, player));
+ } else {
+ text = Replace.replace(prefix, replacePlayer(msg, player));
+ }
+ send.player(player, text);
+ }
+ }
+
+ private static void subAliasMessage(SubAliasObject alias, Player player) {
+ for (String msg : alias.messages) {
+ String text;
+ String hover;
+ if (PluginCheck.papi()) {
+ text = Replace.replace(prefix, player, replacePlayer(msg, player));
+ } else {
+ text = Replace.replace(prefix, replacePlayer(msg, player));
+ }
+ send.player(player, text);
+ }
+ }
+
+ private static String replacePlayer(String s, Player player) {
+ return s.replace("[player]", player.getName());
+ }
+}
diff --git a/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java b/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java
index 074f234..431d992 100644
--- a/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java
+++ b/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterCommands.java
@@ -1,28 +1,16 @@
package net.t2code.alias.Spigot.cmdManagement;
import net.t2code.alias.Spigot.Main;
-import net.t2code.alias.Spigot.config.config.SelectConfig;
import net.t2code.alias.Spigot.config.languages.SelectMessages;
-import net.t2code.alias.Spigot.objects.AliasObjekt;
-import net.t2code.alias.Spigot.objects.SubAliasObjekt;
-import net.t2code.alias.Spigot.system.*;
+import net.t2code.alias.Spigot.objects.AliasObject;
+import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.alias.Util;
-import net.t2code.lib.Spigot.Lib.commands.Cmd;
-import net.t2code.lib.Spigot.Lib.commands.Tab;
-import net.t2code.lib.Spigot.Lib.eco.Eco;
import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
-import net.t2code.lib.Spigot.Lib.replace.Replace;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class RegisterCommands extends Command implements TabCompleter {
+public class RegisterCommands extends Command {
private String alias;
private String prefix = Util.getPrefix();
@@ -33,7 +21,8 @@ public class RegisterCommands extends Command implements TabCompleter {
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
- AliasObjekt alias = Main.aliasHashMap.get(this.alias);
+ send.debugmsg(Main.plugin, "tabevent");
+ AliasObject alias = Main.aliasHashMap.get(this.alias);
if (!alias.aliasEnable) {
send.sender(sender, SelectMessages.aliasDisabled);
@@ -41,19 +30,20 @@ public class RegisterCommands extends Command implements TabCompleter {
}
if (args.length == 0) {
if (sender instanceof Player) {
- exPlayer(sender, alias);
+ ExecuteAlias.aliasPlayer(sender, alias, this.alias);
} else {
if (alias.consoleEnable) {
- console(alias, sender, prefix);
+ ExecuteAlias.aliasConsole(alias, sender, prefix);
} else send.sender(sender, SelectMessages.onlyForPlayer);
}
} else {
+ if (!Main.allForSubAliases.contains(this.alias)) return false;
for (String sals : Main.allSubAliases) {
- SubAliasObjekt sal = Main.subAliasHashMap.get(sals);
- if (args.length == sal.subAliasArg) {
+ SubAliasObject sal = Main.subAliasHashMap.get(sals);
+ if (args.length == sal.subAliasArg + 1) {
for (String al : sal.subAliasList) {
if (args[sal.subAliasArg].toLowerCase().equals(al)) {
- RegisterSubAliasCommands.execute(sender, sal, al);
+ ExecuteAlias.subAliasPlayer(sender, sal, al);
}
}
}
@@ -61,156 +51,5 @@ public class RegisterCommands extends Command implements TabCompleter {
}
return true;
}
-
- private void exPlayer(CommandSender sender, AliasObjekt alias) {
- Player player = (Player) sender;
-
- if (alias.adminEnable) {
- if (player.hasPermission(alias.adminPermission)) {
- if (alias.adminCommandEnable) {
- adminCommand(alias, player);
- }
- if (alias.adminMessageEnable) {
- adminMessage(alias, player, prefix);
- }
- return;
- }
- }
-
- if (alias.permNecessary) {
- if (!(player.hasPermission("t2code.alias.use." + this.alias.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) {
- send.player(player, SelectMessages.noPermissionForCommand.replace("[cmd]", "/" + this.alias.toLowerCase())
- .replace("[perm]", "t2code.alias.use." + this.alias.toLowerCase()));
- return;
- }
- }
- if (alias.costEnable) {
- if (!(alias.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
- if (!Eco.moneyRemove(prefix, player, alias.costPrice)) {
- send.player(player, SelectMessages.noMoney);
- return;
- }
- if (SelectConfig.buyMessage) send.player(player, SelectMessages.buy.replace("[price]", alias.costPrice.toString()));
- }
- }
- if (alias.commandEnable) {
- command(alias, player);
- }
- if (alias.messageEnable) {
- message(alias, player, prefix);
- }
- }
-
- private static void adminCommand(AliasObjekt alias, Player player) {
- for (String cmd : alias.adminCommands) {
- if (alias.adminBungeeCommand) {
- if (SelectConfig.Bungee) {
- if (alias.adminCommandAsConsole) {
- BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
- } else BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
-
- } else {
- send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- }
- } else {
- if (alias.adminCommandAsConsole) {
- Cmd.console(cmd.replace("[player]", player.getName()));
- } else {
- Cmd.player(player, cmd.replace("[player]", player.getName()));
- }
- }
- }
- }
-
- private static void adminMessage(AliasObjekt alias, Player player, String prefix) {
- for (String msg : alias.adminMessages) {
- String text;
- String hover;
- if (PluginCheck.papi()) {
- text = Replace.replace(prefix, player, replacePlayer(msg, player));
- } else {
- text = Replace.replace(prefix, replacePlayer(msg, player));
- }
- send.player(player, text);
- }
- }
-
- private static void command(AliasObjekt alias, Player player) {
- for (String cmd : alias.command) {
- if (alias.bungeeCommand) {
- if (SelectConfig.Bungee) {
- if (alias.commandAsConsole) {
- BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
- } else BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
-
- } else {
- send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- }
- } else {
- if (alias.commandAsConsole) {
- Cmd.console(cmd.replace("[player]", player.getName()));
- } else {
- Cmd.player(player, cmd.replace("[player]", player.getName()));
- }
- }
- }
- }
-
- private static void message(AliasObjekt alias, Player player, String prefix) {
- for (String msg : alias.messages) {
- String text;
- String hover;
- if (PluginCheck.papi()) {
- text = Replace.replace(prefix, player, replacePlayer(msg, player));
- } else {
- text = Replace.replace(prefix, replacePlayer(msg, player));
- }
- send.player(player, text);
- }
- }
-
- private static void console(AliasObjekt alias, CommandSender sender, String prefix) {
- if (alias.consoleCommandEnable) {
- for (String cmd : alias.consoleCommands) {
- if (alias.consoleBungeeCommand) {
- if (SelectConfig.Bungee) {
- BCommandSenderReciver.sendToBungee(sender, cmd, true);
- } else {
- send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- }
- } else {
- Cmd.console(cmd);
- }
- }
- }
- if (alias.consoleMessageEnable) {
- for (String msg : alias.consoleMessages) {
- send.console(Replace.replace(prefix, msg));
- }
- }
- }
-
- private static String replacePlayer(String s, Player player) {
- return s.replace("[player]", player.getName());
- }
-
- private static HashMap arg1 = new HashMap();
-
- @Override
- public List onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
- List list = new ArrayList<>();
- arg1.clear();
- for (String sals : Main.allSubAliases) {
- SubAliasObjekt sal = Main.subAliasHashMap.get(sals);
- for (String al : sal.subAliasList) {
- arg1.put(al, "t2code.alias.use.subalias." + al.toLowerCase());
- }
- Tab.tab(list, sender, sal.subAliasArg, args, arg1);
- }
- return list;
- }
}
diff --git a/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterSubAliasCommands.java b/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterSubAliasCommands.java
deleted file mode 100644
index 05e97da..0000000
--- a/src/main/java/net/t2code/alias/Spigot/cmdManagement/RegisterSubAliasCommands.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package net.t2code.alias.Spigot.cmdManagement;
-
-import net.t2code.alias.Spigot.config.config.SelectConfig;
-import net.t2code.alias.Spigot.config.languages.SelectMessages;
-import net.t2code.alias.Spigot.objects.SubAliasObjekt;
-import net.t2code.alias.Spigot.system.BCommandSenderReciver;
-import net.t2code.alias.Util;
-import net.t2code.lib.Spigot.Lib.commands.Cmd;
-import net.t2code.lib.Spigot.Lib.eco.Eco;
-import net.t2code.lib.Spigot.Lib.messages.send;
-import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
-import net.t2code.lib.Spigot.Lib.replace.Replace;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-public class RegisterSubAliasCommands {
- private static String prefix = Util.getPrefix();
-
-
-
- public static void execute(CommandSender sender, SubAliasObjekt alias, String aliasString) {
- if (!alias.subAliasEnable) {
- send.sender(sender, SelectMessages.aliasDisabled);
- return ;
- }
- if (sender instanceof Player) {
- Player player = (Player) sender;
-
- if (alias.adminEnable) {
- if (player.hasPermission(alias.adminPermission)) {
- if (alias.adminCommandEnable) {
- adminCommand(alias, player);
- }
- if (alias.adminMessageEnable) {
- adminMessage(alias, player, prefix);
- }
- return ;
- }
- }
-
- if (alias.permNecessary) {
- if (!(player.hasPermission("t2code.alias.use.subalias." + aliasString.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) {
- send.player(player, SelectMessages.noPermissionForCommand.replace("[cmd]", "/" +aliasString.toLowerCase())
- .replace("[perm]", "t2code.alias.subalias.use." + aliasString.toLowerCase()));
- return ;
- }
- }
- if (alias.costEnable) {
- if (!(alias.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
- if (!Eco.moneyRemove(prefix, player, alias.costPrice)) {
- send.player(player, SelectMessages.noMoney);
- return ;
- }
- if (SelectConfig.buyMessage) send.player(player, SelectMessages.buy.replace("[price]", alias.costPrice.toString()));
- }
- }
- if (alias.commandEnable) {
- command(alias, player);
- }
- if (alias.messageEnable) {
- message(alias, player, prefix);
- }
- } else {
- if (alias.consoleEnable) {
- console(alias, sender, prefix);
- } else send.sender(sender, SelectMessages.onlyForPlayer);
- }
- }
-
- private static void adminCommand(SubAliasObjekt alias, Player player) {
- for (String cmd : alias.adminCommands) {
- if (alias.adminBungeeCommand) {
- if (SelectConfig.Bungee) {
- if (alias.adminCommandAsConsole) {
- BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
- } else BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
-
- } else {
- send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- }
- } else {
- if (alias.adminCommandAsConsole) {
- Cmd.console(cmd.replace("[player]", player.getName()));
- } else {
- Cmd.player(player, cmd.replace("[player]", player.getName()));
- }
- }
- }
- }
-
- private static void adminMessage(SubAliasObjekt alias, Player player, String prefix) {
- for (String msg : alias.adminMessages) {
- String text;
- String hover;
- if (PluginCheck.papi()) {
- text = Replace.replace(prefix, player, replacePlayer(msg, player));
- } else {
- text = Replace.replace(prefix, replacePlayer(msg, player));
- }
- send.player(player, text);
- }
- }
-
- private static void command(SubAliasObjekt alias, Player player) {
- for (String cmd : alias.command) {
- if (alias.bungeeCommand) {
- if (SelectConfig.Bungee) {
- if (alias.commandAsConsole) {
- BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
- } else BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
-
- } else {
- send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- }
- } else {
- if (alias.commandAsConsole) {
- Cmd.console(cmd.replace("[player]", player.getName()));
- } else {
- Cmd.player(player, cmd.replace("[player]", player.getName()));
- }
- }
- }
- }
-
- private static void message(SubAliasObjekt alias, Player player, String prefix) {
- for (String msg : alias.messages) {
- String text;
- String hover;
- if (PluginCheck.papi()) {
- text = Replace.replace(prefix, player, replacePlayer(msg, player));
- } else {
- text = Replace.replace(prefix, replacePlayer(msg, player));
- }
- send.player(player, text);
- }
- }
-
- private static void console(SubAliasObjekt alias, CommandSender sender, String prefix) {
- if (alias.consoleCommandEnable) {
- for (String cmd : alias.consoleCommands) {
- if (alias.consoleBungeeCommand) {
- if (SelectConfig.Bungee) {
- BCommandSenderReciver.sendToBungee(sender, cmd, true);
- } else {
- send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
- }
- } else {
- Cmd.console(cmd);
- }
- }
- }
- if (alias.consoleMessageEnable) {
- for (String msg : alias.consoleMessages) {
- send.console(Replace.replace(prefix, msg));
- }
- }
- }
-
- private static String replacePlayer(String s, Player player) {
- return s.replace("[player]", player.getName());
- }
-}
-
diff --git a/src/main/java/net/t2code/alias/Spigot/cmdManagement/TabEvent.java b/src/main/java/net/t2code/alias/Spigot/cmdManagement/TabEvent.java
new file mode 100644
index 0000000..2cf59cd
--- /dev/null
+++ b/src/main/java/net/t2code/alias/Spigot/cmdManagement/TabEvent.java
@@ -0,0 +1,49 @@
+package net.t2code.alias.Spigot.cmdManagement;
+
+import net.t2code.alias.Spigot.Main;
+import net.t2code.alias.Spigot.objects.SubAliasObject;
+import net.t2code.lib.Spigot.Lib.commands.Tab;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.server.TabCompleteEvent;
+import org.bukkit.plugin.Plugin;
+
+import java.util.*;
+
+public class TabEvent implements Listener {
+
+ Plugin plugin = Main.plugin;
+ private static HashMap arg1 = new HashMap();
+
+ @EventHandler
+ public void onTab(TabCompleteEvent e) {
+ String buffer = e.getBuffer();
+ String[] imp = buffer.replace("/", "").split(" ");
+ if (!Main.allAliases.contains(imp[0])) return;
+ if (!Main.allForSubAliases.contains(imp[0])) return;
+ arg1.clear();
+ List list = new ArrayList<>(Collections.emptyList());
+ for (String sals : Main.allSubAliases) {
+ SubAliasObject sal = Main.subAliasHashMap.get(sals);
+ if (!buffer.contains(sal.subAliasFor)) continue;
+
+ String[] im = sal.subAliasFor.split(" ");
+ String input = buffer.replace("/" + im[0] + " ", "");
+ String[] args = input.split(" ", -1);
+
+ for (String al : sal.subAliasList) {
+ arg1.put(al, "t2code.alias.use.subalias." + al.toLowerCase());
+ }
+ int arg = sal.subAliasArg;
+ if (args.length - 1 == arg) {
+ for (String command : sal.subAliasList) {
+ if (Tab.hasPermission(e.getSender(), arg1.get(command)) && Tab.passend(command, args[arg])) {
+ list.add(command);
+ }
+ }
+ }
+
+ }
+ e.setCompletions(list);
+ }
+}
diff --git a/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleSubAliasConfig.java b/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleSubAliasConfig.java
index 8fcb520..42c439d 100644
--- a/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleSubAliasConfig.java
+++ b/src/main/java/net/t2code/alias/Spigot/config/config/CreateExampleSubAliasConfig.java
@@ -22,7 +22,7 @@ public class CreateExampleSubAliasConfig {
Config.set("SubAlias.Enable", true, yamlConfiguration);
Config.set("SubAlias.SubAliasList", Arrays.asList("test"),yamlConfiguration);
- Config.set("SubAlias.SubAliasFor", Arrays.asList("aliasexample1"),yamlConfiguration);
+ Config.set("SubAlias.SubAliasFor", "aliasexample1",yamlConfiguration);
Config.set("SubAlias.Permission.Necessary", true, yamlConfiguration);
@@ -49,7 +49,7 @@ public class CreateExampleSubAliasConfig {
Config.set("SubAlias.Admin.Command.Enable", true, yamlConfiguration);
Config.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
Config.set("SubAlias.Admin.Command.BungeeCommand", false, yamlConfiguration);
- Config.set("SubAlias.Admin.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
+ Config.set("SubAlias.Admin.Command.Commands", Collections.singletonList("say subalias hi"), yamlConfiguration);
Config.set("SubAlias.Admin.Message.Enable", false, yamlConfiguration);
Config.set("SubAlias.Admin.Message.Messages", Collections.emptyList(), yamlConfiguration);
diff --git a/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java b/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java
index e027862..ae1c1ca 100644
--- a/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java
+++ b/src/main/java/net/t2code/alias/Spigot/config/config/SelectAlias.java
@@ -1,16 +1,13 @@
package net.t2code.alias.Spigot.config.config;
-import net.minecraft.world.level.levelgen.DensityFunctions;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.system.AliasRegister;
-import net.t2code.alias.Spigot.objects.AliasObjekt;
+import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
-import java.lang.reflect.Array;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -69,11 +66,12 @@ public class SelectAlias {
List consoleMessages = yamlConfiguration.getStringList("Alias.Console.Message.Messages");
Main.allAliases.addAll(aliasList);
- AliasObjekt alias = new AliasObjekt(aliasEnable, aliasList, permNecessary, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
+ AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, costEnable, 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) {
+ send.debugmsg(Main.plugin,"put " + al);
Main.aliasHashMap.put(al, alias);
}
}
diff --git a/src/main/java/net/t2code/alias/Spigot/config/config/SelectSubAlias.java b/src/main/java/net/t2code/alias/Spigot/config/config/SelectSubAlias.java
index ae8bac4..349c21f 100644
--- a/src/main/java/net/t2code/alias/Spigot/config/config/SelectSubAlias.java
+++ b/src/main/java/net/t2code/alias/Spigot/config/config/SelectSubAlias.java
@@ -1,10 +1,7 @@
package net.t2code.alias.Spigot.config.config;
-import net.minecraft.world.level.levelgen.DensityFunctions;
import net.t2code.alias.Spigot.Main;
-import net.t2code.alias.Spigot.objects.SubAliasObjekt;
-import net.t2code.alias.Spigot.system.AliasRegister;
-import net.t2code.alias.Spigot.objects.AliasObjekt;
+import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -17,8 +14,8 @@ public class SelectSubAlias {
public static void onSelect() {
- Main.aliasHashMap.clear();
- Main.allAliases.clear();
+ Main.subAliasHashMap.clear();
+ Main.allSubAliases.clear();
File f = new File(Main.getPath() + "/SubAlias/");
File[] fileArray = f.listFiles();
for (File config_gui : fileArray) {
@@ -31,7 +28,16 @@ public class SelectSubAlias {
Boolean aliasEnable = yamlConfiguration.getBoolean("SubAlias.Enable");
List subAliasList = yamlConfiguration.getStringList("SubAlias.SubAliasList");
String subAliasFor = yamlConfiguration.getString("SubAlias.SubAliasFor");
- Integer subAliasArg = yamlConfiguration.getInt("SubAlias.SubAliasArg");
+ String[] imp = subAliasFor.split(" ");
+ if (!Main.allAliases.contains(imp[0])) {
+ send.error(Main.plugin, "Den Alias " + imp[0] + " in der Datei " + config_gui.getName() + " existiert nicht!");
+ }
+ int subAliasArg = 0;
+ if (subAliasFor != null) {
+ String[] args = subAliasFor.split(" ");
+ send.debugmsg(Main.plugin, config_gui.getName() + " " +String.valueOf(args.length));
+ subAliasArg = args.length - 1;
+ }
Boolean permNecessary = yamlConfiguration.getBoolean("SubAlias.Permission.Necessary");
Boolean costEnable = yamlConfiguration.getBoolean("SubAlias.Cost.Enable");
@@ -64,13 +70,14 @@ public class SelectSubAlias {
Boolean consoleMessageEnable = yamlConfiguration.getBoolean("SubAlias.Console.Message.Enable");
List consoleMessages = yamlConfiguration.getStringList("SubAlias.Console.Message.Messages");
- SubAliasObjekt subAlias = new SubAliasObjekt(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
+ SubAliasObject subAlias = new SubAliasObject(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, costEnable, 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);
}
}
}
diff --git a/src/main/java/net/t2code/alias/Spigot/objects/AliasObjekt.java b/src/main/java/net/t2code/alias/Spigot/objects/AliasObject.java
similarity index 97%
rename from src/main/java/net/t2code/alias/Spigot/objects/AliasObjekt.java
rename to src/main/java/net/t2code/alias/Spigot/objects/AliasObject.java
index cf9be93..4400520 100644
--- a/src/main/java/net/t2code/alias/Spigot/objects/AliasObjekt.java
+++ b/src/main/java/net/t2code/alias/Spigot/objects/AliasObject.java
@@ -2,7 +2,7 @@ package net.t2code.alias.Spigot.objects;
import java.util.List;
-public class AliasObjekt {
+public class AliasObject {
public Boolean aliasEnable;
public List aliasList;
@@ -35,7 +35,7 @@ public class AliasObjekt {
public Boolean consoleMessageEnable;
public List consoleMessages;
- public AliasObjekt(Boolean aliasEnable,
+ public AliasObject(Boolean aliasEnable,
List aliasList,
Boolean permNecessary,
diff --git a/src/main/java/net/t2code/alias/Spigot/objects/SubAliasObjekt.java b/src/main/java/net/t2code/alias/Spigot/objects/SubAliasObject.java
similarity index 97%
rename from src/main/java/net/t2code/alias/Spigot/objects/SubAliasObjekt.java
rename to src/main/java/net/t2code/alias/Spigot/objects/SubAliasObject.java
index d03f441..565cbd7 100644
--- a/src/main/java/net/t2code/alias/Spigot/objects/SubAliasObjekt.java
+++ b/src/main/java/net/t2code/alias/Spigot/objects/SubAliasObject.java
@@ -2,7 +2,7 @@ package net.t2code.alias.Spigot.objects;
import java.util.List;
-public class SubAliasObjekt {
+public class SubAliasObject {
public Boolean subAliasEnable;
public List subAliasList;
public Integer subAliasArg;
@@ -37,7 +37,7 @@ public class SubAliasObjekt {
public Boolean consoleMessageEnable;
public List consoleMessages;
- public SubAliasObjekt(Boolean subAliasEnable,
+ public SubAliasObject(Boolean subAliasEnable,
List subAliasList,
String subAliasFor,
Integer subAliasArg,
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 62009a1..ecde443 100644
--- a/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java
+++ b/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java
@@ -1,6 +1,7 @@
package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main;
+import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
import net.t2code.alias.Spigot.cmdManagement.RegisterCommands;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
@@ -19,12 +20,10 @@ public class AliasRegister {
if (Main.aliasHashMap.get(alias).aliasEnable) {
try {
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
-
bukkitCommandMap.setAccessible(true);
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
-
commandMap.register(alias, new RegisterCommands(alias));
- } catch(Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
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 c62027f..96607a8 100644
--- a/src/main/java/net/t2code/alias/Spigot/system/Load.java
+++ b/src/main/java/net/t2code/alias/Spigot/system/Load.java
@@ -2,12 +2,14 @@ package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
+import net.t2code.alias.Spigot.cmdManagement.TabEvent;
import net.t2code.alias.Spigot.config.config.*;
import net.t2code.alias.Spigot.config.languages.LanguagesCreate;
import net.t2code.alias.Spigot.config.languages.SelectMessages;
import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send;
+import net.t2code.lib.Spigot.Lib.register.Register;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
@@ -18,6 +20,7 @@ import java.util.List;
public class Load {
static Plugin plugin = Main.plugin;
+
public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
Main.plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
@@ -25,7 +28,7 @@ public class Load {
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
- T2CodeTemplate.onLoadFooter(prefix, long_,version);
+ T2CodeTemplate.onLoadFooter(prefix, long_, version);
Metrics.Bstats(plugin, bstatsID);
}
@@ -35,18 +38,20 @@ public class Load {
CreateExampleAliasConfig.configCreate();
} catch (Exception e) {
e.printStackTrace();
- }try {
+ }
+ try {
CreateExampleSubAliasConfig.configCreate();
} catch (Exception e) {
e.printStackTrace();
}
}
try {
- plugin.saveResource("Alias/X_aliasDeclaration_X.yml",true);
+ plugin.saveResource("Alias/X_aliasDeclaration_X.yml", true);
} catch (Exception e) {
e.printStackTrace();
- }try {
- plugin.saveResource("SubAlias/X_subaliasDeclaration_X.yml",true);
+ }
+ try {
+ plugin.saveResource("SubAlias/X_subAliasDeclaration_X.yml", true);
} catch (Exception e) {
e.printStackTrace();
}
@@ -56,6 +61,7 @@ public class Load {
SelectMessages.onSelect(Util.getPrefix());
SelectAlias.onSelect();
SelectSubAlias.onSelect();
+ Register.listener(new TabEvent(), plugin);
if (SelectConfig.Bungee) {
Main.plugin.getServer().getMessenger().registerOutgoingPluginChannel(Main.plugin, "BungeeCord");
@@ -63,11 +69,11 @@ public class Load {
}
AliasRegisterPermissions.onPermRegister();
- send.debugmsg(plugin,Main.aliasHashMap.toString());
- send.debugmsg(plugin,Main.allAliases.toString());
- send.debugmsg(plugin,Main.subAliasHashMap.toString());
+ send.debugmsg(plugin, Main.aliasHashMap.toString());
+ send.debugmsg(plugin, Main.allAliases.toString());
+ send.debugmsg(plugin, Main.subAliasHashMap.toString());
- send.debugmsg(plugin,Main.allSubAliases.toString());
+ send.debugmsg(plugin, Main.allSubAliases.toString());
}
}
diff --git a/src/main/java/net/t2code/alias/Util.java b/src/main/java/net/t2code/alias/Util.java
index 0a6fe2f..bec38fb 100644
--- a/src/main/java/net/t2code/alias/Util.java
+++ b/src/main/java/net/t2code/alias/Util.java
@@ -1,14 +1,14 @@
package net.t2code.alias;
public class Util {
- private static double requiredT2CodeLibVersion = 11.6;
+ private static String requiredT2CodeLibVersion = "12.4_dev-1";
private static String Prefix = "§8[§4T2Code§7-§aAlias§8]";
private static Integer SpigotID = 96389;
private static Integer BstatsID = 12517;
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
private static String Discord = "http://dc.t2code.net";
- public static double getRequiredT2CodeLibVersion() {
+ public static String getRequiredT2CodeLibVersion() {
return requiredT2CodeLibVersion;
}
diff --git a/src/main/resources/SubAlias/X_subaliasDeclaration_X.yml b/src/main/resources/SubAlias/X_subAliasDeclaration_X.yml
similarity index 100%
rename from src/main/resources/SubAlias/X_subaliasDeclaration_X.yml
rename to src/main/resources/SubAlias/X_subAliasDeclaration_X.yml