From c885f70c7b561dc7bc1f603fac5eae380c48fb09 Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 15 Mar 2019 18:20:12 -0400 Subject: [PATCH] Load Bukkit plugin at startup. This should allow plugins that use WorldEdit to do things on world load. --- .../main/java/com/sk89q/wepif/VaultResolver.java | 3 +++ .../sk89q/worldedit/bukkit/WorldEditPlugin.java | 15 +++++++++------ worldedit-bukkit/src/main/resources/plugin.yml | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java index a97017ceb..a918d601a 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/VaultResolver.java @@ -35,6 +35,9 @@ public class VaultResolver implements PermissionsResolver { return null; } RegisteredServiceProvider rsp = server.getServicesManager().getRegistration(Permission.class); + if (rsp == null) { + return null; + } perms = rsp.getProvider(); if (perms == null) { return null; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index d09578472..9b50aa982 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -86,13 +86,9 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { private BukkitServerInterface server; private BukkitConfiguration config; - /** - * Called on plugin enable. - */ - @SuppressWarnings("AccessStaticViaInstance") @Override - public void onEnable() { - this.INSTANCE = this; + public void onLoad() { + INSTANCE = this; //noinspection ResultOfMethodCallIgnored getDataFolder().mkdirs(); @@ -107,6 +103,13 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { worldEdit.loadMappings(); loadConfig(); // Load configuration + } + + /** + * Called on plugin enable. + */ + @Override + public void onEnable() { PermissionsResolverManager.initialize(this); // Setup permission resolver // Register CUI diff --git a/worldedit-bukkit/src/main/resources/plugin.yml b/worldedit-bukkit/src/main/resources/plugin.yml index 9afc2c5a5..27808257f 100644 --- a/worldedit-bukkit/src/main/resources/plugin.yml +++ b/worldedit-bukkit/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: WorldEdit main: com.sk89q.worldedit.bukkit.WorldEditPlugin version: "${internalVersion}" -softdepend: [Spout] #hack to fix trove errors +load: STARTUP api-version: 1.13 # Permissions aren't here. Read http://wiki.sk89q.com/wiki/WEPIF/DinnerPerms