[V0.6.3]
Fixed (Not Connected) showing on inter-world gate loading Added the ability to negate Network/World permissions Fixed Lockette compatibility More stringent verification checks
This commit is contained in:
parent
2d9283fa7d
commit
fc6dda8b4a
19
README
19
README
@ -9,11 +9,11 @@ iConomy support added back in, only costs are create, destroy and use.
|
||||
=============
|
||||
Permissions
|
||||
=============
|
||||
stargate.use -- Allow use of all gates linking to any world in any network
|
||||
stargate.use -- Allow use of all gates linking to any world in any network (Override ALL network/world permissions. Set to false to use network/world specific permissions)
|
||||
stargate.world -- Allow use of gates linking to any world
|
||||
stargate.world.{world} -- Allow use of gates with a destination in {world}
|
||||
stargate.world.{world} -- Allow use of gates with a destination in {world}. Set to false to disallow use.
|
||||
stargate.network -- Allow use of gates on all networks
|
||||
stargate.network.{network} -- Allow use of all gates in {network}
|
||||
stargate.network.{network} -- Allow use of all gates in {network}. Set to false to disallow use.
|
||||
|
||||
stargate.option -- Allow use of all options
|
||||
stargate.option.hidden -- Allow use of 'H'idden
|
||||
@ -22,15 +22,15 @@ stargate.option -- Allow use of all options
|
||||
stargate.option.free -- Allow use of 'F'ree
|
||||
stargate.option.backwards -- Allow use of 'B'ackwards
|
||||
|
||||
stargate.create -- Allow creating gates on any network
|
||||
stargate.create -- Allow creating gates on any network (Override all create permissions)
|
||||
stargate.create.personal -- Allow creating gates on network {playername}
|
||||
stargate.create.network -- Allow creating gates on any network
|
||||
stargate.create.network.{networkname} -- Allow creating gates on network {networkname}
|
||||
stargate.create.network.{networkname} -- Allow creating gates on network {networkname}. Set to false to disallow creation on {networkname}
|
||||
|
||||
stargate.destroy -- Allow destruction gates on any network
|
||||
stargate.destroy -- Allow destruction gates on any network (Orderride all destroy permissions)
|
||||
stargate.destroy.personal -- Allow destruction of gates owned by user only
|
||||
stargate.destroy.network -- Allow destruction of gates on any network
|
||||
stargate.destroy.network.{networkname} -- Allow destruction of gates on network {networkname}
|
||||
stargate.destroy.network.{networkname} -- Allow destruction of gates on network {networkname}. Set to false to disallow destruction of {networkname}
|
||||
|
||||
stargate.free -- Allow free use/creation/destruction of gates
|
||||
stargate.free.use -- Allow free use of Stargates
|
||||
@ -156,6 +156,11 @@ maxgates - If non-zero, will define the maximum amount of gates allowed on any n
|
||||
=============
|
||||
Changes
|
||||
=============
|
||||
[Version 0.6.3]
|
||||
- Fixed (Not Connected) showing on inter-world gate loading
|
||||
- Added the ability to negate Network/World permissions (Use, Create and Destroy)
|
||||
- Fixed Lockette compatibility
|
||||
- More stringent verification checks
|
||||
[Version 0.6.2]
|
||||
- Fixed an issue with private gates
|
||||
- Added default permissions
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.StorageMinecart;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.material.Button;
|
||||
import org.bukkit.material.MaterialData;
|
||||
@ -403,8 +404,9 @@ public class Portal {
|
||||
}
|
||||
|
||||
public boolean isVerified() {
|
||||
verified = true;
|
||||
for (RelativeBlockVector control : gate.getControls())
|
||||
verified = verified || getBlockAt(control).getBlock().getTypeId() == gate.getControlBlock();
|
||||
verified = verified && getBlockAt(control).getBlock().getTypeId() == gate.getControlBlock();
|
||||
return verified;
|
||||
}
|
||||
|
||||
@ -513,6 +515,8 @@ public class Portal {
|
||||
Portal dest = Portal.getByName(destination, network);
|
||||
if (dest == null) {
|
||||
id.setText(++done, "(Not Connected)");
|
||||
} else {
|
||||
id.setText(++done, "");
|
||||
}
|
||||
} else {
|
||||
int index = destinations.indexOf(destination);
|
||||
@ -648,7 +652,8 @@ public class Portal {
|
||||
allPortalsNet.get(getNetwork().toLowerCase()).add(getName().toLowerCase());
|
||||
}
|
||||
|
||||
public static Portal createPortal(SignPost id, Player player) {
|
||||
public static Portal createPortal(SignChangeEvent event, Player player) {
|
||||
SignPost id = new SignPost(new Blox(event.getBlock()));
|
||||
Block idParent = id.getParent();
|
||||
if (idParent == null) {
|
||||
return null;
|
||||
@ -663,10 +668,10 @@ public class Portal {
|
||||
|
||||
Blox parent = new Blox(player.getWorld(), idParent.getX(), idParent.getY(), idParent.getZ());
|
||||
Blox topleft = null;
|
||||
String name = filterName(id.getText(0));
|
||||
String destName = filterName(id.getText(1));
|
||||
String network = filterName(id.getText(2));
|
||||
String options = filterName(id.getText(3));
|
||||
String name = filterName(event.getLine(0));
|
||||
String destName = filterName(event.getLine(1));
|
||||
String network = filterName(event.getLine(2));
|
||||
String options = filterName(event.getLine(3));
|
||||
boolean hidden = (options.indexOf('h') != -1 || options.indexOf('H') != -1);
|
||||
boolean alwaysOn = (options.indexOf('a') != -1 || options.indexOf('A') != -1);
|
||||
boolean priv = (options.indexOf('p') != -1 || options.indexOf('P') != -1);
|
||||
@ -1007,14 +1012,16 @@ public class Portal {
|
||||
}
|
||||
}
|
||||
|
||||
if (!portal.isAlwaysOn()) continue;
|
||||
|
||||
if (!portal.isFixed()) continue;
|
||||
Portal dest = portal.getDestination();
|
||||
if (dest != null) {
|
||||
if (portal.isAlwaysOn()) {
|
||||
portal.open(true);
|
||||
dest.drawSign();
|
||||
OpenCount++;
|
||||
}
|
||||
portal.drawSign();
|
||||
dest.drawSign();
|
||||
}
|
||||
}
|
||||
Stargate.log.info("[Stargate] {" + world.getName() + "} Loaded " + portalCount + " stargates with " + OpenCount + " set as always-on");
|
||||
} catch (Exception e) {
|
||||
|
@ -345,6 +345,21 @@ public class Stargate extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check a deep permission, this will check to see if the permissions is defined for this use
|
||||
* If using Permissions it will return the same as hasPerm
|
||||
* If using SuperPerms will return true if the node isn't defined
|
||||
* Or the value of the node if it is
|
||||
*/
|
||||
public static boolean hasPermDeep(Player player, String perm) {
|
||||
if (permissions != null) {
|
||||
return permissions.getHandler().has(player, perm);
|
||||
} else {
|
||||
if (!player.isPermissionSet(perm)) return true;
|
||||
return player.hasPermission(perm);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether player can teleport to dest world
|
||||
*/
|
||||
@ -352,7 +367,11 @@ public class Stargate extends JavaPlugin {
|
||||
// Can use all Stargate player features
|
||||
if (hasPerm(player, "stargate.use")) return true;
|
||||
// Can access all worlds
|
||||
if (hasPerm(player, "stargate.world")) return true;
|
||||
if (hasPerm(player, "stargate.world")) {
|
||||
// Do a deep check to see if the player lacks this specific world node
|
||||
if (!hasPermDeep(player, "stargate.world." + world)) return false;
|
||||
return true;
|
||||
}
|
||||
// Can access dest world
|
||||
if (hasPerm(player, "stargate.world." + world)) return true;
|
||||
return false;
|
||||
@ -365,9 +384,12 @@ public class Stargate extends JavaPlugin {
|
||||
// Can use all Stargate player features
|
||||
if (hasPerm(player, "stargate.use")) return true;
|
||||
// Can access all networks
|
||||
if (hasPerm(player, "stargate.network")) return true;
|
||||
if (hasPerm(player, "stargate.network")) {
|
||||
// Do a deep check to see if the player lacks this specific network node
|
||||
if (!hasPermDeep(player, "stargate.network." + network)) return false;
|
||||
return true;
|
||||
}
|
||||
// Can access this network
|
||||
Stargate.debug("canAccessNetwork", "stargate.network." + network);
|
||||
if (hasPerm(player, "stargate.network." + network)) return true;
|
||||
return false;
|
||||
}
|
||||
@ -427,7 +449,11 @@ public class Stargate extends JavaPlugin {
|
||||
// Check for general create
|
||||
if (hasPerm(player, "stargate.create")) return true;
|
||||
// Check for all network create permission
|
||||
if (hasPerm(player, "stargate.create.network")) return true;
|
||||
if (hasPerm(player, "stargate.create.network")) {
|
||||
// Do a deep check to see if the player lacks this specific network node
|
||||
if (!hasPermDeep(player, "stargate.create.network." + network)) return false;
|
||||
return true;
|
||||
}
|
||||
// Check for this specific network
|
||||
if (hasPerm(player, "stargate.create.network." + network)) return true;
|
||||
|
||||
@ -445,7 +471,11 @@ public class Stargate extends JavaPlugin {
|
||||
// Check for general destroy
|
||||
if (hasPerm(player, "stargate.destroy")) return true;
|
||||
// Check for all network destroy permission
|
||||
if (hasPerm(player, "stargate.destroy.network")) return true;
|
||||
if (hasPerm(player, "stargate.destroy.network")) {
|
||||
// Do a deep check to see if the player lacks permission for this network node
|
||||
if (!hasPermDeep(player, "stargate.destroy.network." + portal.getNetwork())) return false;
|
||||
return true;
|
||||
}
|
||||
// Check for this specific network
|
||||
if (hasPerm(player, "stargate.destroy.network." + portal.getNetwork())) return true;
|
||||
// Check for personal gate
|
||||
@ -721,25 +751,17 @@ public class Stargate extends JavaPlugin {
|
||||
Block block = event.getBlock();
|
||||
if (block.getType() != Material.WALL_SIGN) return;
|
||||
|
||||
// Initialize a stargate -- Permission check is done in createPortal
|
||||
SignPost sign = new SignPost(new Blox(block));
|
||||
// Set sign text so we can create a gate with it.
|
||||
sign.setText(0, event.getLine(0));
|
||||
sign.setText(1, event.getLine(1));
|
||||
sign.setText(2, event.getLine(2));
|
||||
sign.setText(3, event.getLine(3));
|
||||
Portal portal = Portal.createPortal(sign, player);
|
||||
final Portal portal = Portal.createPortal(event, player);
|
||||
// Not creating a gate, just placing a sign
|
||||
if (portal == null) return;
|
||||
|
||||
Stargate.sendMessage(player, regMsg, false);
|
||||
Stargate.debug("onSignChange", "Initialized stargate: " + portal.getName());
|
||||
Stargate.server.getScheduler().scheduleSyncDelayedTask(stargate, new Runnable() {
|
||||
public void run() {
|
||||
portal.drawSign();
|
||||
// Set event text so our new sign is instantly initialized
|
||||
event.setLine(0, sign.getText(0));
|
||||
event.setLine(1, sign.getText(1));
|
||||
event.setLine(2, sign.getText(2));
|
||||
event.setLine(3, sign.getText(3));
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: Stargate
|
||||
main: net.TheDgtl.Stargate.Stargate
|
||||
version: 0.6.2
|
||||
version: 0.6.3
|
||||
description: Stargate mod for Bukkit
|
||||
author: Drakia
|
||||
website: http://www.thedgtl.net
|
||||
|
Loading…
Reference in New Issue
Block a user