2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Fri, 18 Mar 2016 13:17:38 -0400
|
|
|
|
Subject: [PATCH] Default loading permissions.yml before plugins
|
|
|
|
|
|
|
|
Under previous behavior, plugins were not able to check if a player had a permission
|
|
|
|
if it was defined in permissions.yml. there is no clean way for a plugin to fix that either.
|
|
|
|
|
|
|
|
This will change the order so that by default, permissions.yml loads BEFORE plugins instead of after.
|
|
|
|
|
|
|
|
This gives plugins expected permission checks.
|
|
|
|
|
|
|
|
It also helps improve the expected logic, as servers should set the initial defaults, and then let plugins
|
|
|
|
modify that. Under the previous logic, plugins were unable (cleanly) override permissions.yml.
|
|
|
|
|
|
|
|
A config option has been added for those who depend on the previous behavior, but I don't expect that.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
index 429b74474ced04d8dd8f038b8590b8dfe178bf4d..716f285e67019b8a62922d09c15883c99f9421aa 100644
|
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
@@ -222,4 +222,9 @@ public class PaperConfig {
|
|
|
|
private static void useDisplayNameInQuit() {
|
|
|
|
useDisplayNameInQuit = getBoolean("use-display-name-in-quit-message", useDisplayNameInQuit);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean loadPermsBeforePlugins = true;
|
|
|
|
+ private static void loadPermsBeforePlugins() {
|
|
|
|
+ loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2021-06-21 10:41:00 +02:00
|
|
|
index 43b0ecb3b1c06bbb3b7476c67b29e6deab424ac6..9ca44d8e2de750b821b0d760d49193e94001885a 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2021-06-21 10:41:00 +02:00
|
|
|
@@ -400,6 +400,7 @@ public final class CraftServer implements Server {
|
|
|
|
if (type == PluginLoadOrder.STARTUP) {
|
|
|
|
this.helpMap.clear();
|
|
|
|
this.helpMap.initializeGeneralTopics();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ if (com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) loadCustomPermissions(); // Paper
|
|
|
|
}
|
|
|
|
|
2021-06-21 10:41:00 +02:00
|
|
|
Plugin[] plugins = this.pluginManager.getPlugins();
|
2021-06-12 02:57:04 +02:00
|
|
|
@@ -419,7 +420,7 @@ public final class CraftServer implements Server {
|
|
|
|
this.commandMap.registerServerAliases();
|
2021-06-11 14:02:28 +02:00
|
|
|
DefaultPermissions.registerCorePermissions();
|
|
|
|
CraftDefaultPermissions.registerCorePermissions();
|
2021-06-12 02:57:04 +02:00
|
|
|
- this.loadCustomPermissions();
|
|
|
|
+ if (!com.destroystokyo.paper.PaperConfig.loadPermsBeforePlugins) this.loadCustomPermissions(); // Paper
|
|
|
|
this.helpMap.initializeCommands();
|
|
|
|
this.syncCommands();
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|