Update AliasRegisterPermissions.java

Bugfix: The permissions of the alias commands were not registered
This commit is contained in:
JaTiTV 2023-07-16 08:10:18 +02:00
parent 987370586a
commit 0c1d32e0e8

View File

@ -1,15 +1,30 @@
package net.t2code.alias.Spigot.system; package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister; import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
public class AliasRegisterPermissions { public class AliasRegisterPermissions {
public static void onPermRegister() { public static void onPermRegister() {
for (String alias : Main.allAliases){
if (Bukkit.getPluginManager().getPermission("t2code.alias.use." + alias.toLowerCase()) == null) { for (AliasObject aliasObject : Main.aliasHashMap.values()) {
T2Cregister.permission("t2code.alias.use." + alias.toLowerCase(), Main.getPlugin()); if (Bukkit.getPluginManager().getPermission(aliasObject.permission.toLowerCase()) == null) {
T2Cregister.permission(aliasObject.permission.toLowerCase(), Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.toLowerCase()) == null) {
T2Cregister.permission(aliasObject.adminPermission.toLowerCase(), Main.getPlugin());
}
}
for (SubAliasObject subAliasObject : Main.subAliasHashMap.values()) {
if (Bukkit.getPluginManager().getPermission(subAliasObject.permission.toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.permission.toLowerCase(), Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.adminPermission.toLowerCase(), Main.getPlugin());
} }
} }
} }