Fixed multi-world stargates causing an NPE

Code cleanup
Added a few more errors when a gate can't be loaded
Hopefully fixed path issue on some Linux installs
This commit is contained in:
Drakia 2011-03-10 13:26:14 -08:00
parent e851b395d2
commit 896dc04e7a
4 changed files with 15 additions and 3 deletions

6
README
View File

@ -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]

View File

@ -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 {

View File

@ -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<Portal> 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<Portal> iter = Stargate.activeList.iterator(); iter.hasNext();) {
Portal p = iter.next();
if (time > p.getOpenTime() + Stargate.activeLimit) {

View File

@ -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