More API changes for StargateCommand
This commit is contained in:
parent
88b30b3579
commit
b63faca109
@ -337,6 +337,7 @@ public class Portal {
|
|||||||
Portal end = getDestination();
|
Portal end = getDestination();
|
||||||
// Only open dest if it's not-fixed or points at this gate
|
// Only open dest if it's not-fixed or points at this gate
|
||||||
if (end != null && (!end.isFixed() || end.getDestinationName().equalsIgnoreCase(getName())) && !end.isOpen()) {
|
if (end != null && (!end.isFixed() || end.getDestinationName().equalsIgnoreCase(getName())) && !end.isOpen()) {
|
||||||
|
Stargate.debug("portal::open", "Ver: " + end.isVerified());
|
||||||
end.open(openFor, false);
|
end.open(openFor, false);
|
||||||
end.setDestination(this);
|
end.setDestination(this);
|
||||||
if (end.isVerified()) end.drawSign();
|
if (end.isVerified()) end.drawSign();
|
||||||
@ -523,7 +524,7 @@ public class Portal {
|
|||||||
return gate.matches(topLeft, modX, modZ);
|
return gate.matches(topLeft, modX, modZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activate(Player player) {
|
public boolean activate(Player player) {
|
||||||
destinations.clear();
|
destinations.clear();
|
||||||
destination = "";
|
destination = "";
|
||||||
Stargate.activeList.add(this);
|
Stargate.activeList.add(this);
|
||||||
@ -555,11 +556,12 @@ public class Portal {
|
|||||||
Stargate.server.getPluginManager().callEvent(event);
|
Stargate.server.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
Stargate.activeList.remove(this);
|
Stargate.activeList.remove(this);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
destination = event.getDestination();
|
destination = event.getDestination();
|
||||||
destinations = event.getDestinations();
|
destinations = event.getDestinations();
|
||||||
drawSign();
|
drawSign();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deactivate() {
|
public void deactivate() {
|
||||||
@ -588,7 +590,10 @@ public class Portal {
|
|||||||
public void cycleDestination(Player player, int dir) {
|
public void cycleDestination(Player player, int dir) {
|
||||||
Boolean activate = false;
|
Boolean activate = false;
|
||||||
if (!isActive() || getActivePlayer() != player) {
|
if (!isActive() || getActivePlayer() != player) {
|
||||||
activate(player);
|
// If the event is cancelled, return
|
||||||
|
if (!activate(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Stargate.debug("cycleDestination", "Network Size: " + allPortalsNet.get(network.toLowerCase()).size());
|
Stargate.debug("cycleDestination", "Network Size: " + allPortalsNet.get(network.toLowerCase()).size());
|
||||||
Stargate.debug("cycleDestination", "Player has access to: " + destinations.size());
|
Stargate.debug("cycleDestination", "Player has access to: " + destinations.size());
|
||||||
activate = true;
|
activate = true;
|
||||||
@ -646,7 +651,6 @@ public class Portal {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int index = destinations.indexOf(destination);
|
int index = destinations.indexOf(destination);
|
||||||
|
|
||||||
if ((index == max) && (max > 1) && (++done <= 3)) {
|
if ((index == max) && (max > 1) && (++done <= 3)) {
|
||||||
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
Portal dest = Portal.getByName(destinations.get(index - 2), network);
|
Portal dest = Portal.getByName(destinations.get(index - 2), network);
|
||||||
|
@ -275,7 +275,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
return lang.getString(name);
|
return lang.getString(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onButtonPressed(Player player, Portal portal) {
|
public static void openPortal(Player player, Portal portal) {
|
||||||
Portal destination = portal.getDestination();
|
Portal destination = portal.getDestination();
|
||||||
|
|
||||||
// Always-open gate -- Do nothing
|
// Always-open gate -- Do nothing
|
||||||
@ -811,7 +811,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
Stargate.sendMessage(player, Stargate.getString("denyMsg"));
|
Stargate.sendMessage(player, Stargate.getString("denyMsg"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onButtonPressed(player, portal);
|
openPortal(player, portal);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -864,7 +864,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
Stargate.sendMessage(player, Stargate.getString("denyMsg"));
|
Stargate.sendMessage(player, Stargate.getString("denyMsg"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onButtonPressed(player, portal);
|
openPortal(player, portal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user