From d442c0d6f37444999a093c847b7a8f145119dd1c Mon Sep 17 00:00:00 2001 From: William Date: Fri, 18 Mar 2016 03:30:17 -0400 Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index d482589b3b..95345d28be 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1863,5 +1863,23 @@ public final class CraftServer implements Server { return false; } } + + @Override + public void reloadPermissions() { + pluginManager.clearPermissions(); + if (com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); + for (Plugin plugin : pluginManager.getPlugins()) { + for (Permission perm : plugin.getDescription().getPermissions()) { + try { + pluginManager.addPermission(perm); + } catch (IllegalArgumentException ex) { + getLogger().log(Level.WARNING, "Plugin " + plugin.getDescription().getFullName() + " tried to register permission '" + perm.getName() + "' but it's already registered", ex); + } + } + } + if (!com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); + DefaultPermissions.registerCorePermissions(); + CraftDefaultPermissions.registerCorePermissions(); + } // Paper end } -- 2.18.0