Fixed registering already-existing permission

This commit is contained in:
Auxilor 2020-11-06 17:37:43 +00:00
parent d2130e4d20
commit f0c4e16635

View File

@ -74,13 +74,15 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Regist
if(!Prerequisite.areMet(prerequisites))
return;
Permission permission = new Permission(
"ecoenchants.fromtable." + permissionName,
"Allows getting " + permissionName + " from an Enchanting Table",
PermissionDefault.TRUE
);
permission.addParent(Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.*"), true);
Bukkit.getPluginManager().addPermission(permission);
if(Bukkit.getPluginManager().getPermission("ecoenchants.fromtable." + permissionName) == null) {
Permission permission = new Permission(
"ecoenchants.fromtable." + permissionName,
"Allows getting " + permissionName + " from an Enchanting Table",
PermissionDefault.TRUE
);
permission.addParent(Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.*"), true);
Bukkit.getPluginManager().addPermission(permission);
}
this.update();
this.add();