Reload all gates on world unload, this stops gates with invalid destinations being in memory.

This commit is contained in:
Steven Scott 2012-04-26 20:14:01 -07:00
parent 49120b1f8d
commit 9ef67b2cce
3 changed files with 16 additions and 1 deletions

2
README
View File

@ -205,6 +205,8 @@ createConflict=Gate conflicts with existing gate
============= =============
Changes 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] [Version 0.7.6.6]
- Check move/portal/interact/signchange events for cancellation - Check move/portal/interact/signchange events for cancellation
[Version 0.7.6.5] [Version 0.7.6.5]

View File

@ -44,6 +44,7 @@ import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.vehicle.VehicleMoveEvent; import org.bukkit.event.vehicle.VehicleMoveEvent;
import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@ -1022,6 +1023,18 @@ public class Stargate extends JavaPlugin {
Portal.loadAllGates(w); 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 { private class eListener implements Listener {

View File

@ -1,6 +1,6 @@
name: Stargate name: Stargate
main: net.TheDgtl.Stargate.Stargate main: net.TheDgtl.Stargate.Stargate
version: 0.7.6.6 version: 0.7.6.7
description: Stargate mod for Bukkit description: Stargate mod for Bukkit
author: Drakia author: Drakia
website: http://www.thedgtl.net website: http://www.thedgtl.net