-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPermissions.java
More file actions
31 lines (27 loc) · 1.19 KB
/
Permissions.java
File metadata and controls
31 lines (27 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package pro.cloudnode.smp.enchantbookplus;
import org.bukkit.Registry;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull;
public final class Permissions {
public static @NotNull String enchant(final @NotNull Enchantment enchantment) {
return "enchantbookplus.enchant." + enchantment.getKey().getKey();
}
public static @NotNull String RELOAD = "enchantbookplus.reload";
public static void init() {
final @NotNull PluginManager pm = EnchantBookPlus.getInstance().getServer().getPluginManager();
pm.addPermission(new Permission(
RELOAD,
"Reload plugin config using `/enchantbookplus reload`",
PermissionDefault.OP
));
for (Enchantment enchantment : Registry.ENCHANTMENT)
pm.addPermission(new Permission(
enchant(enchantment),
"Allow enchanting " + enchantment.getKey() + "above the vanilla level, as configured in the plugin",
PermissionDefault.TRUE
));
}
}