Commits

md_5 authored 60c17193545
SPIGOT-2618: Register permissions before plugin enabled.

Brings behaviour in line with command registration, and won't affect plugins which don't already error.
No tags

src/main/java/org/bukkit/craftbukkit/CraftServer.java

Modified
310 310 public void enablePlugins(PluginLoadOrder type) {
311 311 if (type == PluginLoadOrder.STARTUP) {
312 312 helpMap.clear();
313 313 helpMap.initializeGeneralTopics();
314 314 }
315 315
316 316 Plugin[] plugins = pluginManager.getPlugins();
317 317
318 318 for (Plugin plugin : plugins) {
319 319 if ((!plugin.isEnabled()) && (plugin.getDescription().getLoad() == type)) {
320 - loadPlugin(plugin);
320 + enablePlugin(plugin);
321 321 }
322 322 }
323 323
324 324 if (type == PluginLoadOrder.POSTWORLD) {
325 325 commandMap.setFallbackCommands();
326 326 setVanillaCommands();
327 327 commandMap.registerServerAliases();
328 328 loadCustomPermissions();
329 329 DefaultPermissions.registerCorePermissions();
330 330 CraftDefaultPermissions.registerCorePermissions();
336 336 pluginManager.disablePlugins();
337 337 }
338 338
339 339 private void setVanillaCommands() {
340 340 Map<String, ICommand> commands = new CommandDispatcher(console).getCommands();
341 341 for (ICommand cmd : commands.values()) {
342 342 commandMap.register("minecraft", new VanillaCommandWrapper((CommandAbstract) cmd, LocaleI18n.get(cmd.getUsage(null))));
343 343 }
344 344 }
345 345
346 - private void loadPlugin(Plugin plugin) {
346 + private void enablePlugin(Plugin plugin) {
347 347 try {
348 - pluginManager.enablePlugin(plugin);
349 -
350 348 List<Permission> perms = plugin.getDescription().getPermissions();
351 349
352 350 for (Permission perm : perms) {
353 351 try {
354 352 pluginManager.addPermission(perm);
355 353 } catch (IllegalArgumentException ex) {
356 354 getLogger().log(Level.WARNING, "Plugin " + plugin.getDescription().getFullName() + " tried to register permission '" + perm.getName() + "' but it's already registered", ex);
357 355 }
358 356 }
357 +
358 + pluginManager.enablePlugin(plugin);
359 359 } catch (Throwable ex) {
360 360 Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " loading " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
361 361 }
362 362 }
363 363
364 364 @Override
365 365 public String getName() {
366 366 return serverName;
367 367 }
368 368

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut