From 9762849407f492af9efe6cd11fd996a0f1f39d1a Mon Sep 17 00:00:00 2001 From: willies952002 Date: Tue, 19 Apr 2016 17:29:33 -0400 Subject: [PATCH] Also Reload Plugin Defined Permissions Closes https://github.com/PaperMC/Paper/issues/210 --- Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch | 4 ++-- .../Allow-Reloading-of-Custom-Permissions.patch | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch b/Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch index 59a588c444..78240cdbe8 100644 --- a/Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch +++ b/Spigot-Server-Patches/Add-getEntity-by-UUID-API.patch @@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.craftbukkit.generator.CraftChunkData; import org.bukkit.craftbukkit.help.SimpleHelpMap; @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - ((SimplePluginManager) pluginManager).clearPermissions(); - loadCustomPermissions(); + }); + } } + + @Override diff --git a/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch b/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch index baa7b6f608..db2b994f13 100644 --- a/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch +++ b/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch @@ -19,6 +19,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void reloadPermissions() { + ((SimplePluginManager) pluginManager).clearPermissions(); + loadCustomPermissions(); ++ for (Plugin plugin : pluginManager.getPlugins()) { ++ plugin.getDescription().getPermissions().forEach((perm) -> { ++ 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); ++ } ++ }); ++ } + } + // Paper end }