Fixed portal count on load
Added stargate.create.personal for personal stargate networks Fixed a bug with destroying stargates by removing sign/button
This commit is contained in:
parent
432ab3bbc8
commit
ec8c308651
6
README
6
README
@ -21,6 +21,7 @@ Known Issues
|
||||
=============
|
||||
- stargate.use - Allow this player/group to use stargates.
|
||||
- stargate.create - Allow this player/group to create new stargates.
|
||||
- stargate.create.personal - Allow this player/group to create new stargates on a network defined as their name.
|
||||
- stargate.destroy - Allow this player/group to destroy existing stargates. (Deprecated)
|
||||
- stargate.destroy.all - Allow this player/group to destroy any existing stargate (Replaces stargate.destroy)
|
||||
- stargate.destroy.owner - Allow this player/group to destroy any stargate that they are the owner of.
|
||||
@ -85,6 +86,11 @@ destroyexplosion - Whether to destroy a stargate with explosions, or stop an exp
|
||||
=============
|
||||
Changes
|
||||
=============
|
||||
[Version 0.27]
|
||||
- Fixed portal count on load
|
||||
[Version 0.26]
|
||||
- Added stargate.create.personal for personal stargate networks
|
||||
- Fixed a bug with destroying stargates by removing sign/button
|
||||
[Version 0.25]
|
||||
- Fixed a bug with worlds in subfolders
|
||||
- Fixed gates being destroyed with explosions
|
||||
|
@ -320,7 +320,7 @@ public class Portal {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void activate(Player player, Stargate stargate) {
|
||||
public void activate(Player player) {
|
||||
destinations.clear();
|
||||
destination = "";
|
||||
drawSign();
|
||||
@ -331,7 +331,7 @@ public class Portal {
|
||||
// Not fixed, not this portal, and visible to this player.
|
||||
if ( (!portal.isFixed()) &&
|
||||
(!dest.equalsIgnoreCase(getName())) && // Not this portal
|
||||
(!portal.isHidden() || stargate.hasPerm(player, "stargate.hidden", player.isOp()) || portal.getOwner().equals(player.getName()))
|
||||
(!portal.isHidden() || Stargate.hasPerm(player, "stargate.hidden", player.isOp()) || portal.getOwner().equals(player.getName()))
|
||||
) {
|
||||
destinations.add(portal.getName());
|
||||
}
|
||||
@ -365,9 +365,9 @@ public class Portal {
|
||||
return openTime;
|
||||
}
|
||||
|
||||
public void cycleDestination(Player player, Stargate stargate) {
|
||||
public void cycleDestination(Player player) {
|
||||
if (!isActive() || getActivePlayer() != player) {
|
||||
activate(player, stargate);
|
||||
activate(player);
|
||||
}
|
||||
|
||||
if (destinations.size() > 0) {
|
||||
@ -537,6 +537,13 @@ public class Portal {
|
||||
boolean alwaysOn = (options.indexOf('a') != -1 || options.indexOf('A') != -1);
|
||||
boolean priv = (options.indexOf('p') != -1 || options.indexOf('P') != -1);
|
||||
|
||||
// Check if the user can only create personal gates, set network if so
|
||||
if (Stargate.hasPerm(player, "stargate.create.personal", false) &&
|
||||
!Stargate.hasPerm(player, "stargate.create", player.isOp()) ) {
|
||||
network = player.getName();
|
||||
if (network.length() > 11) network = network.substring(0, 11);
|
||||
}
|
||||
|
||||
// Can not create a non-fixed always-on gate.
|
||||
if (alwaysOn && destName.length() == 0) {
|
||||
alwaysOn = false;
|
||||
@ -773,14 +780,16 @@ public class Portal {
|
||||
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.wasVerified()) {
|
||||
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;
|
||||
|
||||
|
@ -47,10 +47,10 @@ import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
*/
|
||||
public class Stargate extends JavaPlugin {
|
||||
// Permissions
|
||||
private Permissions permissions = null;
|
||||
private static Permissions permissions = null;
|
||||
private double permVersion = 0;
|
||||
|
||||
private final bListener blockListener = new bListener(this);
|
||||
private final bListener blockListener = new bListener();
|
||||
private final pListener playerListener = new pListener();
|
||||
private final vListener vehicleListener = new vListener();
|
||||
private final wListener worldListener = new wListener();
|
||||
@ -259,7 +259,7 @@ public class Stargate extends JavaPlugin {
|
||||
/*
|
||||
* Check whether the player has the given permissions.
|
||||
*/
|
||||
public boolean hasPerm(Player player, String perm, boolean def) {
|
||||
public static boolean hasPerm(Player player, String perm, boolean def) {
|
||||
if (permissions != null) {
|
||||
return permissions.getHandler().has(player, perm);
|
||||
} else {
|
||||
@ -323,12 +323,6 @@ public class Stargate extends JavaPlugin {
|
||||
}
|
||||
|
||||
private class bListener extends BlockListener {
|
||||
Stargate stargate;
|
||||
|
||||
bListener(Stargate stargate) {
|
||||
this.stargate = stargate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
// Stop player from placing a block touching a portals controls
|
||||
@ -346,7 +340,8 @@ public class Stargate extends JavaPlugin {
|
||||
if (block.getType() != Material.WALL_SIGN) return;
|
||||
|
||||
// Initialize a stargate
|
||||
if (hasPerm(player, "stargate.create", player.isOp())) {
|
||||
if (hasPerm(player, "stargate.create", player.isOp()) ||
|
||||
hasPerm(player, "stargate.create.personal", false)) {
|
||||
SignPost sign = new SignPost(new Blox(block));
|
||||
// Set sign text so we can create a gate with it.
|
||||
sign.setText(0, event.getLine(0));
|
||||
@ -379,7 +374,7 @@ public class Stargate extends JavaPlugin {
|
||||
if (portal != null) {
|
||||
if (hasPerm(player, "stargate.use", true)) {
|
||||
if ((!portal.isOpen()) && (!portal.isFixed())) {
|
||||
portal.cycleDestination(player, stargate);
|
||||
portal.cycleDestination(player);
|
||||
}
|
||||
} else {
|
||||
if (!denyMsg.isEmpty()) {
|
||||
@ -432,6 +427,7 @@ public class Stargate extends JavaPlugin {
|
||||
if (!dmgMsg.isEmpty()) {
|
||||
player.sendMessage(ChatColor.RED + dmgMsg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: Stargate
|
||||
main: net.TheDgtl.Stargate.Stargate
|
||||
version: 0.25
|
||||
version: 0.27
|
||||
description: Stargate mod for Bukkit
|
||||
author: Drakia
|
||||
website: http://www.thedgtl.net
|
Loading…
Reference in New Issue
Block a user