From 94d5a3b0a3db4f338238621e5e6292b27df02699 Mon Sep 17 00:00:00 2001 From: Drakia Date: Fri, 18 Feb 2011 22:24:46 -0800 Subject: [PATCH] Fixed infinite loop in fixed gates. Fixed gate destination will not open when dialed into. --- README | 3 +++ src/net/TheDgtl/Stargate/Portal.java | 34 ++++++++++------------------ src/plugin.yml | 2 +- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/README b/README index 6293361..0f7d0fb 100644 --- a/README +++ b/README @@ -79,6 +79,9 @@ gate-folder - The folder containing your .gate files ============= Changes ============= +[Version 0.14] + - Fixed infinite loop in fixed gates. + - Fixed gate destination will not open when dialed into. [Version 0.13] - Fixed gates no longer show in destination list. [Version 0.12] diff --git a/src/net/TheDgtl/Stargate/Portal.java b/src/net/TheDgtl/Stargate/Portal.java index 5b1e618..5c98f95 100644 --- a/src/net/TheDgtl/Stargate/Portal.java +++ b/src/net/TheDgtl/Stargate/Portal.java @@ -50,7 +50,6 @@ public class Portal { private Blox[] entrances; private boolean verified; private boolean fixed; - private boolean gracePeriod; private ArrayList destinations = new ArrayList(); private String network; private Gate gate; @@ -80,7 +79,6 @@ public class Portal { this.button = button; this.verified = verified; this.fixed = dest.length() > 0; - this.gracePeriod = false; this.network = network; this.name = name; this.gate = gate; @@ -101,14 +99,6 @@ public class Portal { } } - public synchronized boolean manipGrace(boolean set, boolean var) { - if (!set) { - return gracePeriod; - } - gracePeriod = var; - return false; - } - public boolean isOpen() { return isOpen || isAlwaysOn(); } @@ -149,10 +139,9 @@ public class Portal { // Open remote gate if (!isAlwaysOn()) { player = openFor; - manipGrace(true, true); Portal end = getDestination(); - if (end != null && !end.isOpen()) { + if (end != null && !end.isFixed() && !end.isOpen()) { end.open(openFor, false); end.setDestination(this); if (end.isVerified()) end.drawSign(); @@ -164,15 +153,8 @@ public class Portal { public void close(boolean force) { if (isAlwaysOn() && !force) return; // Never close an always open gate - if (!isAlwaysOn()) { - Portal end = getDestination(); - - if (end != null && end.isOpen()) { - end.deactivate(); // Clear it's destination first. - end.close(false); - } - } - + + // Close this gate, then the dest gate. for (Blox inside : getEntrances()) { inside.setType(gate.getPortalBlockClosed()); } @@ -181,7 +163,16 @@ public class Portal { isOpen = false; Stargate.openList.remove(this); Stargate.activeList.remove(this); + + if (!isAlwaysOn()) { + Portal end = getDestination(); + if (end != null && end.isOpen()) { + end.deactivate(); // Clear it's destination first. + end.close(false); + } + } + deactivate(); } @@ -435,7 +426,6 @@ public class Portal { id.setText(++done, "To: " + destination); id.setText(++done, " (" + network + ") "); } else { - manipGrace(true, true); int index = destinations.indexOf(destination); if ((index == max) && (max > 1) && (++done <= 3)) { diff --git a/src/plugin.yml b/src/plugin.yml index b2e8e1f..94732a8 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: Stargate main: net.TheDgtl.Stargate.Stargate -version: 0.13 +version: 0.14 description: Stargate mod for Bukkit author: Drakia website: http://www.thedgtl.net \ No newline at end of file