SPIGOT-3409: Improve performance of registering stupid amounts of permissions in plugin.yml

This commit is contained in:
md_5 2017-07-10 21:05:47 +10:00
parent 50b75cd65d
commit af1c0139f5

View file

@ -143,7 +143,7 @@ public final class CraftServer implements Server {
private final SimpleCommandMap commandMap = new SimpleCommandMap(this); private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
private final SimpleHelpMap helpMap = new SimpleHelpMap(this); private final SimpleHelpMap helpMap = new SimpleHelpMap(this);
private final StandardMessenger messenger = new StandardMessenger(); 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 MinecraftServer console;
protected final DedicatedPlayerList playerList; protected final DedicatedPlayerList playerList;
private final Map<String, World> worlds = new LinkedHashMap<String, World>(); private final Map<String, World> worlds = new LinkedHashMap<String, World>();
@ -246,7 +246,7 @@ public final class CraftServer implements Server {
saveCommandsConfig(); saveCommandsConfig();
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); 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"); monsterSpawn = configuration.getInt("spawn-limits.monsters");
animalSpawn = configuration.getInt("spawn-limits.animals"); animalSpawn = configuration.getInt("spawn-limits.animals");
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
@ -352,11 +352,12 @@ public final class CraftServer implements Server {
for (Permission perm : perms) { for (Permission perm : perms) {
try { try {
pluginManager.addPermission(perm); pluginManager.addPermission(perm, false);
} 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);
} }
} }
pluginManager.dirtyPermissibles();
pluginManager.enablePlugin(plugin); pluginManager.enablePlugin(plugin);
} catch (Throwable ex) { } catch (Throwable ex) {