1.1.0 | SubAlias, MiniMessage and more #3

Merged
JaTiTV merged 9 commits from 1.1 into main 2022-07-14 19:57:24 +00:00
3 changed files with 19 additions and 17 deletions
Showing only changes of commit 63f8a8a5e2 - Show all commits

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>Alias</artifactId>
<version>1.1.0_Snapshot-#1</version>
<version>1.1.0_Snapshot-#3</version>
<packaging>jar</packaging>
<name>T2C-Alias</name>

View File

@ -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<String> 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("<alias>", 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);
}

View File

@ -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.<alias>");
} else yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias.<alias>");
yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias.<alias>");
} else yamlConfiguration.set("Alias.Permission.Permission", "t2code.alias.use.<alias>");
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) {