Fixed infinite loop in fixed gates.

Fixed gate destination will not open when dialed into.
This commit is contained in:
Drakia 2011-02-18 22:24:46 -08:00
parent 0d6d680fcc
commit 94d5a3b0a3
3 changed files with 16 additions and 23 deletions

3
README
View File

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

View File

@ -50,7 +50,6 @@ public class Portal {
private Blox[] entrances;
private boolean verified;
private boolean fixed;
private boolean gracePeriod;
private ArrayList<String> destinations = new ArrayList<String>();
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)) {

View File

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