Paper/Spigot-Server-Patches/0061-Allow-Reloading-of-Custom-Permissions.patch
Aikar a96d3e8984
[Auto] Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
dc7c3c61f SPIGOT-5921: Improve setNoDamageTicks for Players
53849f57f SPIGOT-5922: Smithing recipes not registering
2020-07-01 21:27:09 -04:00

36 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William <admin@domnian.com>
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 aa74c838147d67c9cbfcff1f9b0dc653808fb109..7c4ef70f540de9d5486d1ccef65ef8d82580694e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2168,5 +2168,23 @@ public final class CraftServer implements Server {
return null;
}
}
+
+ @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
}