PaperMC/Spigot-Server-Patches/0061-Allow-Reloading-of-Custom-Permissions.patch

39 lines
1.6 KiB
Diff
Raw Normal View History

2019-12-11 03:43:21 +01:00
From 7f46adeb924e999511d8a4a236380f3228374ce1 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
2019-12-11 03:43:21 +01:00
index cf12da15c..110fee6b6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2019-12-11 03:43:21 +01:00
@@ -2051,5 +2051,23 @@ public final class CraftServer implements Server {
2019-06-22 21:04:26 +02:00
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
}
--
2019-12-11 03:43:21 +01:00
2.24.0