From 0c7aa20cbebab46feae719a8593b4d96f93a3034 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 18 Jul 2014 17:37:03 -0700 Subject: [PATCH] [Bukkit] Ignore missing adapter if another platform is registered. --- .../sk89q/worldedit/bukkit/WorldEditPlugin.java | 16 ++++++++++++++-- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/bukkit/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/src/bukkit/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 29df49ad9..9b0ff432d 100644 --- a/src/bukkit/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/src/bukkit/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -40,6 +40,8 @@ import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CylinderRegion; @@ -94,7 +96,6 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { WorldEdit worldEdit = WorldEdit.getInstance(); - loadAdapter(); // Need an adapter to work with special blocks with NBT data loadConfig(); // Load configuration PermissionsResolverManager.initialize(this); // Setup permission resolver @@ -116,6 +117,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { // Forge WorldEdit and there's (probably) not going to be any other // platforms to be worried about... at the current time of writing WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); + + loadAdapter(); // Need an adapter to work with special blocks with NBT data } private void loadConfig() { @@ -126,6 +129,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { } private void loadAdapter() { + WorldEdit worldEdit = WorldEdit.getInstance(); + // Attempt to load a Bukkit adapter BukkitImplLoader adapterLoader = new BukkitImplLoader(); @@ -144,7 +149,14 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { bukkitAdapter = adapterLoader.loadAdapter(); log.log(Level.INFO, "Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter"); } catch (AdapterLoadException e) { - log.log(Level.WARNING, e.getMessage()); + Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING); + if (platform instanceof BukkitServerInterface) { + log.log(Level.WARNING, e.getMessage()); + } else { + log.log(Level.INFO, "WorldEdit could not find a Bukkit adapter for this MC version, " + + "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") " + + "that handles the world editing."); + } } } diff --git a/src/forge/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/src/forge/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index e6e740533..6b706a08f 100644 --- a/src/forge/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/src/forge/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -97,7 +97,7 @@ public class ForgeWorldEdit { } @EventHandler - public void serverStarting(FMLServerStartingEvent event) { + public void serverAboutToSTart(FMLServerAboutToStartEvent event) { if (this.platform != null) { logger.warning("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't"); WorldEdit.getInstance().getPlatformManager().unregister(platform);