diff --git a/README b/README index 940ac0a..2fa3401 100644 --- a/README +++ b/README @@ -82,6 +82,12 @@ gate-folder - The folder containing your .gate files ============= Changes ============= +[Version 0.22] + - Fixed multi-world stargates causing an NPE +[Version 0.21] + - Code cleanup + - Added a few more errors when a gate can't be loaded + - Hopefully fixed path issue on some Linux installs [Version 0.20] - Fixed the bug SIGN_CHANGE exception when using plugins such as Lockette [Version 0.19] diff --git a/src/net/TheDgtl/Stargate/Portal.java b/src/net/TheDgtl/Stargate/Portal.java index a3f4f66..f69442a 100644 --- a/src/net/TheDgtl/Stargate/Portal.java +++ b/src/net/TheDgtl/Stargate/Portal.java @@ -791,7 +791,7 @@ public class Portal { } Stargate.log.info("[Stargate] {" + world.getName() + "} Loaded " + portalCount + " stargates with " + OpenCount + " set as always-on"); } catch (Exception e) { - Stargate.log.log(Level.SEVERE, "Exception while reading stargates from " + location + ": " + l); + Stargate.log.log(Level.SEVERE, "Exception while reading stargates from " + db.getName() + ": " + l); e.printStackTrace(); } } else { diff --git a/src/net/TheDgtl/Stargate/Stargate.java b/src/net/TheDgtl/Stargate/Stargate.java index dfe9375..52539f2 100644 --- a/src/net/TheDgtl/Stargate/Stargate.java +++ b/src/net/TheDgtl/Stargate/Stargate.java @@ -449,13 +449,18 @@ public class Stargate extends JavaPlugin { private class wListener extends WorldListener { @Override public void onWorldLoaded(WorldEvent event) { - Portal.loadAllGates(event.getWorld()); + World w = event.getWorld(); + // We have to make sure the world is actually loaded. This gets called twice for some reason. + if (w.getBlockAt(w.getSpawnLocation()).getWorld() != null) { + Portal.loadAllGates(w); + } } } private class SGThread implements Runnable { public void run() { long time = System.currentTimeMillis() / 1000; + // Close open portals for (Iterator iter = Stargate.openList.iterator(); iter.hasNext();) { Portal p = iter.next(); if (time > p.getOpenTime() + Stargate.openLimit) { @@ -463,6 +468,7 @@ public class Stargate extends JavaPlugin { iter.remove(); } } + // Deactivate active portals for (Iterator iter = Stargate.activeList.iterator(); iter.hasNext();) { Portal p = iter.next(); if (time > p.getOpenTime() + Stargate.activeLimit) { diff --git a/src/plugin.yml b/src/plugin.yml index c4faf72..beec603 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Stargate main: net.TheDgtl.Stargate.Stargate -version: 0.20 +version: 0.22 description: Stargate mod for Bukkit author: Drakia website: http://www.thedgtl.net \ No newline at end of file