Added 'S'how option for Always-On gates

This commit is contained in:
Steven Scott 2011-08-28 17:51:37 -07:00
parent af37bac990
commit 8e222ea87e
2 changed files with 29 additions and 10 deletions

3
README
View File

@ -21,6 +21,7 @@ stargate.option -- Allow use of all options
stargate.option.private -- Allow use of 'P'rivate stargate.option.private -- Allow use of 'P'rivate
stargate.option.free -- Allow use of 'F'ree stargate.option.free -- Allow use of 'F'ree
stargate.option.backwards -- Allow use of 'B'ackwards stargate.option.backwards -- Allow use of 'B'ackwards
stargate.option.show -- Allow use of 'S'how
stargate.create -- Allow creating gates on any network (Override all create permissions) stargate.create -- Allow creating gates on any network (Override all create permissions)
stargate.create.personal -- Allow creating gates on network {playername} stargate.create.personal -- Allow creating gates on network {playername}
@ -71,6 +72,7 @@ Sign Layout:
'P' for a private gate 'P' for a private gate
'F' for a free gate 'F' for a free gate
'B' is for a backwards facing gate (You will exit the back) 'B' is for a backwards facing gate (You will exit the back)
'S' is for showing an always-on gate in the network list
Options: Options:
The options are the single letter, not the word. So to make a private hidden gate, your 4th line would be 'PH'. The options are the single letter, not the word. So to make a private hidden gate, your 4th line would be 'PH'.
@ -191,6 +193,7 @@ createConflict=Gate conflicts with existing gate
- Added permdebug option - Added permdebug option
- Hopefully fix path issues some people were having - Hopefully fix path issues some people were having
- Fixed iConomy creation cost - Fixed iConomy creation cost
- Added 'S'how option for Always-On gates
[Version 0.6.4] [Version 0.6.4]
- Fixed iConomy handling - Fixed iConomy handling
[Version 0.6.3] [Version 0.6.3]

View File

@ -73,6 +73,7 @@ public class Portal {
private boolean priv = false; private boolean priv = false;
private boolean free = false; private boolean free = false;
private boolean backwards = false; private boolean backwards = false;
private boolean show = false;
// In-use information // In-use information
private Player player; private Player player;
@ -85,7 +86,7 @@ public class Portal {
float rotX, SignPost id, Blox button, float rotX, SignPost id, Blox button,
String dest, String name, String dest, String name,
boolean verified, String network, Gate gate, String owner, boolean verified, String network, Gate gate, String owner,
boolean hidden, boolean alwaysOn, boolean priv, boolean free, boolean backwards) { boolean hidden, boolean alwaysOn, boolean priv, boolean free, boolean backwards, boolean show) {
this.topLeft = topLeft; this.topLeft = topLeft;
this.modX = modX; this.modX = modX;
this.modZ = modZ; this.modZ = modZ;
@ -103,6 +104,7 @@ public class Portal {
this.priv = priv; this.priv = priv;
this.free = free; this.free = free;
this.backwards = backwards; this.backwards = backwards;
this.show = show;
this.world = topLeft.getWorld(); this.world = topLeft.getWorld();
this.fixed = dest.length() > 0; this.fixed = dest.length() > 0;
@ -144,6 +146,10 @@ public class Portal {
return backwards; return backwards;
} }
public boolean isShown() {
return show;
}
/** /**
* Getters and Setters * Getters and Setters
*/ */
@ -432,7 +438,7 @@ public class Portal {
for (String dest : allPortalsNet.get(network.toLowerCase())) { for (String dest : allPortalsNet.get(network.toLowerCase())) {
Portal portal = getByName(dest, network); Portal portal = getByName(dest, network);
// Check if dest is always open (Don't show if so) // Check if dest is always open (Don't show if so)
if (portal.isAlwaysOn()) continue; if (portal.isAlwaysOn() && !portal.isShown()) continue;
// Check if this player can access the dest world // Check if this player can access the dest world
if (!Stargate.canAccessWorld(player, portal.getWorld().getName())) continue; if (!Stargate.canAccessWorld(player, portal.getWorld().getName())) continue;
// Check if dest is this portal // Check if dest is this portal
@ -684,19 +690,26 @@ public class Portal {
boolean priv = (options.indexOf('p') != -1 || options.indexOf('P') != -1); boolean priv = (options.indexOf('p') != -1 || options.indexOf('P') != -1);
boolean free = (options.indexOf('f') != - 1|| options.indexOf('F') != -1); boolean free = (options.indexOf('f') != - 1|| options.indexOf('F') != -1);
boolean backwards = (options.indexOf('b') != -1 || options.indexOf('B') != -1); boolean backwards = (options.indexOf('b') != -1 || options.indexOf('B') != -1);
boolean show = (options.indexOf('s') != -1 || options.indexOf('S') != -1);
// Check permissions for options. // Check permissions for options.
if (!Stargate.canOption(player, "hidden")) hidden = false; if (hidden && !Stargate.canOption(player, "hidden")) hidden = false;
if (!Stargate.canOption(player, "alwayson")) alwaysOn = false; if (alwaysOn && !Stargate.canOption(player, "alwayson")) alwaysOn = false;
if (!Stargate.canOption(player, "private")) priv = false; if (priv && !Stargate.canOption(player, "private")) priv = false;
if (!Stargate.canOption(player, "free")) free = false; if (free && !Stargate.canOption(player, "free")) free = false;
if (!Stargate.canOption(player, "backwards")) backwards = false; if (backwards && !Stargate.canOption(player, "backwards")) backwards = false;
if (show && !Stargate.canOption(player, "show")) show = false;
// Can not create a non-fixed always-on gate. // Can not create a non-fixed always-on gate.
if (alwaysOn && destName.length() == 0) { if (alwaysOn && destName.length() == 0) {
alwaysOn = false; alwaysOn = false;
} }
// Show isn't useful if A is false
if (show && !alwaysOn) {
show = false;
}
// Moved the layout check so as to avoid invalid messages when not making a gate // Moved the layout check so as to avoid invalid messages when not making a gate
int modX = 0; int modX = 0;
int modZ = 0; int modZ = 0;
@ -757,7 +770,7 @@ public class Portal {
} }
// Debug // Debug
Stargate.debug("createPortal", "h = " + hidden + " a = " + alwaysOn + " p = " + priv + " f = " + free + " b = " + backwards); Stargate.debug("createPortal", "h = " + hidden + " a = " + alwaysOn + " p = " + priv + " f = " + free + " b = " + backwards + " s = " + show);
if ((network.length() < 1) || (network.length() > 11)) { if ((network.length() < 1) || (network.length() > 11)) {
network = Stargate.getDefaultNetwork(); network = Stargate.getDefaultNetwork();
@ -845,7 +858,7 @@ public class Portal {
button.setType(Material.STONE_BUTTON.getId()); button.setType(Material.STONE_BUTTON.getId());
button.setData(facing); button.setData(facing);
} }
portal = new Portal(topleft, modX, modZ, rotX, id, button, destName, name, true, network, gate, player.getName(), hidden, alwaysOn, priv, free, backwards); portal = new Portal(topleft, modX, modZ, rotX, id, button, destName, name, true, network, gate, player.getName(), hidden, alwaysOn, priv, free, backwards, show);
// Open always on gate // Open always on gate
if (portal.isAlwaysOn()) { if (portal.isAlwaysOn()) {
@ -935,6 +948,8 @@ public class Portal {
builder.append(portal.isFree()); builder.append(portal.isFree());
builder.append(':'); builder.append(':');
builder.append(portal.isBackwards()); builder.append(portal.isBackwards());
builder.append(':');
builder.append(portal.isShown());
bw.append(builder.toString()); bw.append(builder.toString());
bw.newLine(); bw.newLine();
@ -1002,8 +1017,9 @@ public class Portal {
boolean priv = (split.length > 13) ? split[13].equalsIgnoreCase("true") : false; boolean priv = (split.length > 13) ? split[13].equalsIgnoreCase("true") : false;
boolean free = (split.length > 15) ? split[15].equalsIgnoreCase("true") : false; boolean free = (split.length > 15) ? split[15].equalsIgnoreCase("true") : false;
boolean backwards = (split.length > 16) ? split[16].equalsIgnoreCase("true") : false; boolean backwards = (split.length > 16) ? split[16].equalsIgnoreCase("true") : false;
boolean show = (split.length > 17) ? split[17].equalsIgnoreCase("true") : false;
Portal portal = new Portal(topLeft, modX, modZ, rotX, sign, button, dest, name, false, network, gate, owner, hidden, alwaysOn, priv, free, backwards); Portal portal = new Portal(topLeft, modX, modZ, rotX, sign, button, dest, name, false, network, gate, owner, hidden, alwaysOn, priv, free, backwards, show);
portal.close(true); portal.close(true);
} }
scanner.close(); scanner.close();