1.1.0_Snapshot-#3
This commit is contained in:
parent
9aed0f5895
commit
63f8a8a5e2
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>Alias</artifactId>
|
<artifactId>Alias</artifactId>
|
||||||
<version>1.1.0_Snapshot-#1</version>
|
<version>1.1.0_Snapshot-#3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>T2C-Alias</name>
|
<name>T2C-Alias</name>
|
||||||
|
@ -17,30 +17,32 @@ public class TabEvent implements Listener {
|
|||||||
public void onTab(TabCompleteEvent e) {
|
public void onTab(TabCompleteEvent e) {
|
||||||
String buffer = e.getBuffer();
|
String buffer = e.getBuffer();
|
||||||
String[] imp = buffer.replace("/", "").split(" ");
|
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());
|
List<String> list = new ArrayList<>(Collections.emptyList());
|
||||||
for (String sals : Main.allSubAliases) {
|
if (!Main.allAliases.contains(imp[0]) || !Main.allForSubAliases.contains(imp[0])){
|
||||||
SubAliasObject sal = Main.subAliasHashMap.get(sals);
|
e.setCompletions(list);
|
||||||
if (!buffer.contains(sal.subAliasFor)) continue;
|
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 input = buffer.replace("/" + im[0] + " ", "");
|
||||||
String[] args = input.split(" ", -1);
|
String[] args = input.split(" ", -1);
|
||||||
|
|
||||||
for (String al : sal.subAliasList) {
|
for (String al : aliasObject.subAliasList) {
|
||||||
arg1.put(al, "t2code.alias.use.subalias." + al.toLowerCase());
|
arg1.put(al, aliasObject.permission.replace("<alias>", al.toLowerCase()));
|
||||||
}
|
}
|
||||||
int arg = sal.subAliasArg;
|
int arg = aliasObject.subAliasArg;
|
||||||
if (args.length - 1 == arg) {
|
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])) {
|
if (Tab.hasPermission(e.getSender(), arg1.get(command)) && Tab.passend(command, args[arg])) {
|
||||||
list.add(command);
|
list.add(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
e.setCompletions(list);
|
e.setCompletions(list);
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ public class AliasConfigConverter {
|
|||||||
|
|
||||||
public static void convertAddPermission(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
|
public static void convertAddPermission(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
|
||||||
if (subalias) {
|
if (subalias) {
|
||||||
yamlConfiguration.set("Alias.Permission.Permission", "t2code.alias.use.<alias>");
|
yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias.<alias>");
|
||||||
} else yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias.<alias>");
|
} else yamlConfiguration.set("Alias.Permission.Permission", "t2code.alias.use.<alias>");
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config_gui);
|
yamlConfiguration.save(config_gui);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -47,8 +47,8 @@ public class AliasConfigConverter {
|
|||||||
|
|
||||||
public static void convertAddPermissionMSG(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
|
public static void convertAddPermissionMSG(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
|
||||||
if (subalias) {
|
if (subalias) {
|
||||||
yamlConfiguration.set("Alias.Permission.CustomNoPermissionMSG", "");
|
yamlConfiguration.set("SubAlias.Permission.CustomNoPermissionMSG", "");
|
||||||
} else yamlConfiguration.set("SubAlias.Permission.CustomNoPermissionMSG", "");
|
} else yamlConfiguration.set("Alias.Permission.CustomNoPermissionMSG", "");
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config_gui);
|
yamlConfiguration.save(config_gui);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user