diff --git a/pom.xml b/pom.xml index e6de707..9c61c66 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code Alias - 1.1.0_Snapshot-#1 + 1.1.0_Snapshot-#3 jar T2C-Alias diff --git a/src/main/java/net/t2code/alias/Spigot/cmdManagement/TabEvent.java b/src/main/java/net/t2code/alias/Spigot/cmdManagement/TabEvent.java index 47e85ec..1fa238a 100644 --- a/src/main/java/net/t2code/alias/Spigot/cmdManagement/TabEvent.java +++ b/src/main/java/net/t2code/alias/Spigot/cmdManagement/TabEvent.java @@ -17,30 +17,32 @@ public class TabEvent implements Listener { 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; + if (!Main.allAliases.contains(imp[0]) || !Main.allForSubAliases.contains(imp[0])){ + e.setCompletions(list); + return; + } + arg1.clear(); - String[] im = sal.subAliasFor.split(" "); + for (String sals : Main.allSubAliases) { + SubAliasObject aliasObject = Main.subAliasHashMap.get(sals); + if (!buffer.contains(aliasObject.subAliasFor)) continue; + + String[] im = aliasObject.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()); + for (String al : aliasObject.subAliasList) { + arg1.put(al, aliasObject.permission.replace("", al.toLowerCase())); } - int arg = sal.subAliasArg; + int arg = aliasObject.subAliasArg; if (args.length - 1 == arg) { - for (String command : sal.subAliasList) { + for (String command : aliasObject.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/alias/AliasConfigConverter.java b/src/main/java/net/t2code/alias/Spigot/config/alias/AliasConfigConverter.java index 44f020c..2056e2c 100644 --- a/src/main/java/net/t2code/alias/Spigot/config/alias/AliasConfigConverter.java +++ b/src/main/java/net/t2code/alias/Spigot/config/alias/AliasConfigConverter.java @@ -36,8 +36,8 @@ public class AliasConfigConverter { public static void convertAddPermission(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) { if (subalias) { - yamlConfiguration.set("Alias.Permission.Permission", "t2code.alias.use."); - } else yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias."); + yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias."); + } else yamlConfiguration.set("Alias.Permission.Permission", "t2code.alias.use."); try { yamlConfiguration.save(config_gui); } catch (IOException e) { @@ -47,8 +47,8 @@ public class AliasConfigConverter { public static void convertAddPermissionMSG(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) { if (subalias) { - yamlConfiguration.set("Alias.Permission.CustomNoPermissionMSG", ""); - } else yamlConfiguration.set("SubAlias.Permission.CustomNoPermissionMSG", ""); + yamlConfiguration.set("SubAlias.Permission.CustomNoPermissionMSG", ""); + } else yamlConfiguration.set("Alias.Permission.CustomNoPermissionMSG", ""); try { yamlConfiguration.save(config_gui); } catch (IOException e) {