Fixed a loading bug in which invalid gates caused file truncation

This commit is contained in:
Drakia 2011-03-11 00:34:43 -08:00
parent 896dc04e7a
commit a9461846de
4 changed files with 17 additions and 12 deletions

4
README
View File

@ -82,6 +82,10 @@ gate-folder - The folder containing your .gate files
=============
Changes
=============
[Version 0.24]
- Fixed a loading bug in which invalid gates caused file truncation
[Version 0.23]
- Added a check to make sure "nethergate.gate" exists, otherwise create it
[Version 0.22]
- Fixed multi-world stargates causing an NPE
[Version 0.21]

View File

@ -764,15 +764,6 @@ public class Portal {
Portal portal = new Portal(topLeft, modX, modZ, rotX, sign, button, dest, name, false, network, gate, owner, hidden, alwaysOn, priv);
portal.close(true);
// Verify portal integrity/register portal
if (!portal.isVerified() || !portal.checkIntegrity()) {
portal.unregister();
Stargate.log.info("[Stargate] Destroying stargate at " + portal.toString());
} else {
portal.drawSign();
portalCount++;
}
}
scanner.close();
@ -780,8 +771,18 @@ public class Portal {
int OpenCount = 0;
for (Portal portal : allPortals) {
if (portal == null) continue;
// Verify portal integrity/register portal
if (!portal.isVerified() || !portal.checkIntegrity()) {
portal.unregister();
Stargate.log.info("[Stargate] Destroying stargate at " + portal.toString());
continue;
} else {
portal.drawSign();
portalCount++;
}
if (!portal.isAlwaysOn()) continue;
if (!portal.wasVerified()) continue;
Portal dest = portal.getDestination();
if (dest != null) {

View File

@ -148,7 +148,7 @@ public class Stargate extends JavaPlugin {
public void reloadGates() {
Gate.loadGates(gateFolder);
// Replace nethergate.gate if it doesn't have an exit point.
if (Gate.getGateByName("nethergate.gate").getExit() == null) {
if (Gate.getGateByName("nethergate.gate") == null || Gate.getGateByName("nethergate.gate").getExit() == null) {
Gate.populateDefaults(gateFolder);
}

View File

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