From efb7650d6f0109fcc2b4989691c8cb8224f7a5dc Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 11 Jun 2019 18:02:07 -0400 Subject: [PATCH] Fix some reload issues. And some unload issues. --- .../java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 3 ++- .../com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 38d82dc25..7b5af1a62 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -315,7 +315,8 @@ public class BukkitWorld extends AbstractWorld { } else if (other == null) { return false; } else if ((other instanceof BukkitWorld)) { - return ((BukkitWorld) other).getWorld().equals(getWorld()); + World otherWorld = ((BukkitWorld) other).worldRef.get(); + return otherWorld != null && otherWorld.equals(getWorld()); } else if (other instanceof com.sk89q.worldedit.world.World) { return ((com.sk89q.worldedit.world.World) other).getName().equals(getName()); } else { 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 18a7d69d2..4ac9a3ee1 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 @@ -136,10 +136,15 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { // these don't stick around between reload loadAdapter(); loadConfig(); + WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); } catch (Throwable ignored) { } } else { getServer().getPluginManager().registerEvents((worldInitListener = new WorldInitListener()), this); + loadAdapter(); // Need an adapter to work with special blocks with NBT data + setupRegistries(); + WorldEdit.getInstance().loadMappings(); + loadConfig(); // Load configuration } // Enable metrics @@ -148,12 +153,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { } private void setupWorldData() { - loadAdapter(); // Need an adapter to work with special blocks with NBT data - setupRegistries(); - WorldEdit.getInstance().loadMappings(); - loadConfig(); // Load configuration setupTags(); - WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); }