From 9ef67b2cce4a0cc403a86bffdeaf07d7c265a25b Mon Sep 17 00:00:00 2001 From: Steven Scott Date: Thu, 26 Apr 2012 20:14:01 -0700 Subject: [PATCH] Reload all gates on world unload, this stops gates with invalid destinations being in memory. --- README | 2 ++ src/net/TheDgtl/Stargate/Stargate.java | 13 +++++++++++++ src/plugin.yml | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README b/README index 6a57228..2626415 100644 --- a/README +++ b/README @@ -205,6 +205,8 @@ createConflict=Gate conflicts with existing gate ============= Changes ============= +[Version 0.7.6.7] + - Reload all gates on world unload, this stops gates with invalid destinations being in memory. [Version 0.7.6.6] - Check move/portal/interact/signchange events for cancellation [Version 0.7.6.5] diff --git a/src/net/TheDgtl/Stargate/Stargate.java b/src/net/TheDgtl/Stargate/Stargate.java index 01145e1..a139628 100644 --- a/src/net/TheDgtl/Stargate/Stargate.java +++ b/src/net/TheDgtl/Stargate/Stargate.java @@ -44,6 +44,7 @@ import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.vehicle.VehicleMoveEvent; import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; @@ -1022,6 +1023,18 @@ public class Stargate extends JavaPlugin { Portal.loadAllGates(w); } } + + // We need to reload all gates on world unload, boo + @EventHandler + public void onWorldUnload(WorldUnloadEvent event) { + Stargate.debug("onWorldUnload", "Reloading all Stargates"); + World w = event.getWorld(); + Portal.clearGates(); + for (World world : server.getWorlds()) { + if (world.equals(w)) continue; + Portal.loadAllGates(world); + } + } } private class eListener implements Listener { diff --git a/src/plugin.yml b/src/plugin.yml index 0bc2966..1df7312 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Stargate main: net.TheDgtl.Stargate.Stargate -version: 0.7.6.6 +version: 0.7.6.7 description: Stargate mod for Bukkit author: Drakia website: http://www.thedgtl.net