From af1c0139f56e444dbcaf191664829a33eb4dfd59 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 10 Jul 2017 21:05:47 +1000 Subject: [PATCH] SPIGOT-3409: Improve performance of registering stupid amounts of permissions in plugin.yml --- src/main/java/org/bukkit/craftbukkit/CraftServer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index fc92b912f5..5eea272e30 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -143,7 +143,7 @@ public final class CraftServer implements Server { private final SimpleCommandMap commandMap = new SimpleCommandMap(this); private final SimpleHelpMap helpMap = new SimpleHelpMap(this); private final StandardMessenger messenger = new StandardMessenger(); - private final PluginManager pluginManager = new SimplePluginManager(this, commandMap); + private final SimplePluginManager pluginManager = new SimplePluginManager(this, commandMap); protected final MinecraftServer console; protected final DedicatedPlayerList playerList; private final Map worlds = new LinkedHashMap(); @@ -246,7 +246,7 @@ public final class CraftServer implements Server { saveCommandsConfig(); overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); - ((SimplePluginManager) pluginManager).useTimings(configuration.getBoolean("settings.plugin-profiling")); + pluginManager.useTimings(configuration.getBoolean("settings.plugin-profiling")); monsterSpawn = configuration.getInt("spawn-limits.monsters"); animalSpawn = configuration.getInt("spawn-limits.animals"); waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); @@ -352,11 +352,12 @@ public final class CraftServer implements Server { for (Permission perm : perms) { try { - pluginManager.addPermission(perm); + pluginManager.addPermission(perm, false); } catch (IllegalArgumentException ex) { getLogger().log(Level.WARNING, "Plugin " + plugin.getDescription().getFullName() + " tried to register permission '" + perm.getName() + "' but it's already registered", ex); } } + pluginManager.dirtyPermissibles(); pluginManager.enablePlugin(plugin); } catch (Throwable ex) {