Fix custom permissions reloading (#1325)

This commit is contained in:
prplz 2018-08-11 09:39:04 -04:00 committed by Aikar
parent 6ef9abeec2
commit 895a4dcafc
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
5 changed files with 25 additions and 22 deletions

View File

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

View File

@ -1,4 +1,4 @@
From bd9e06a79e32b2c983c41827e7c4127c3436f6cc Mon Sep 17 00:00:00 2001 From a964d8e89b27279f8eca687c7b5f9d7d45d7ae8d Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com> From: willies952002 <admin@domnian.com>
Date: Mon, 28 Nov 2016 10:21:52 -0500 Date: Mon, 28 Nov 2016 10:21:52 -0500
Subject: [PATCH] Allow Reloading of Command Aliases Subject: [PATCH] Allow Reloading of Command Aliases
@ -6,12 +6,12 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d3165763c..41357cb0e 100644 index 7743cc6abd..21a6f839d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1889,5 +1889,24 @@ public final class CraftServer implements Server { @@ -1892,5 +1892,24 @@ public final class CraftServer implements Server {
}); DefaultPermissions.registerCorePermissions();
} CraftDefaultPermissions.registerCorePermissions();
} }
+ +
+ @Override + @Override

View File

@ -1,4 +1,4 @@
From fc82e20fac8adc748ef554d6de4eab73fb2e2a08 Mon Sep 17 00:00:00 2001 From 9e4ac9b3daad415fb19f41d43e09c3375b9d3069 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Fri, 9 Jun 2017 07:24:34 -0700 Date: Fri, 9 Jun 2017 07:24:34 -0700
Subject: [PATCH] Add configuration option to prevent player names from being Subject: [PATCH] Add configuration option to prevent player names from being
@ -6,7 +6,7 @@ Subject: [PATCH] Add configuration option to prevent player names from being
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index ea6fcb39f..dbafef023 100644 index ea6fcb39f4..dbafef023e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -271,4 +271,9 @@ public class PaperConfig { @@ -271,4 +271,9 @@ public class PaperConfig {
@ -20,10 +20,10 @@ index ea6fcb39f..dbafef023 100644
+ } + }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 41357cb0e..27c6caddc 100644 index 21a6f839d8..93a24c77f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1908,5 +1908,10 @@ public final class CraftServer implements Server { @@ -1911,5 +1911,10 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases(); commandMap.registerServerAliases();
return true; return true;
} }

View File

@ -1,4 +1,4 @@
From 9fc6ead2cb78a551d09710035213395077e6f795 Mon Sep 17 00:00:00 2001 From 7f0b79af24fa42dffa0b72a0e191ddb03f241d47 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 22:11:48 -0500 Date: Mon, 15 Jan 2018 22:11:48 -0500
Subject: [PATCH] Basic PlayerProfile API Subject: [PATCH] Basic PlayerProfile API
@ -485,7 +485,7 @@ index 7ce08eb8bb..6a750c25eb 100644
private UserCacheEntry(GameProfile gameprofile, Date date) { private UserCacheEntry(GameProfile gameprofile, Date date) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 77c16fe2c4..2dd7ed96a4 100644 index be78ce2ad9..5b1aae5587 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -135,6 +135,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; @@ -135,6 +135,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@ -499,7 +499,7 @@ index 77c16fe2c4..2dd7ed96a4 100644
public final class CraftServer implements Server { public final class CraftServer implements Server {
private final String serverName = "Paper"; private final String serverName = "Paper";
private final String serverVersion; private final String serverVersion;
@@ -1923,5 +1927,21 @@ public final class CraftServer implements Server { @@ -1926,5 +1930,21 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() { public boolean suggestPlayerNamesWhenNullTabCompletions() {
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
} }

View File

@ -1,4 +1,4 @@
From d5626a994903ac7997f1fd6e1efa7ede3d180588 Mon Sep 17 00:00:00 2001 From 72e3adc2cacaffcbfc61561568f1ae6d0a02069d Mon Sep 17 00:00:00 2001
From: egg82 <phantom_zero@ymail.com> From: egg82 <phantom_zero@ymail.com>
Date: Tue, 7 Aug 2018 01:24:23 -0600 Date: Tue, 7 Aug 2018 01:24:23 -0600
Subject: [PATCH] Use ConcurrentHashMap in JsonList Subject: [PATCH] Use ConcurrentHashMap in JsonList
@ -25,7 +25,7 @@ The point of this is readability, but does have a side-benefit of a small microp
Finally, added a couple obfhelpers for the modified code Finally, added a couple obfhelpers for the modified code
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 0859c7eb2..93111cc24 100644 index 0859c7eb2b..93111cc240 100644
--- a/src/main/java/net/minecraft/server/JsonList.java --- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -26,6 +26,7 @@ import java.util.Collection; @@ -26,6 +26,7 @@ import java.util.Collection;
@ -110,5 +110,5 @@ index 0859c7eb2..93111cc24 100644
String s = this.b.toJson(collection); String s = this.b.toJson(collection);
BufferedWriter bufferedwriter = null; BufferedWriter bufferedwriter = null;
-- --
2.18.0.windows.1 2.18.0