Added stargate.create.gate permissions

This is really 0.6.5... Hopefully
This commit is contained in:
Steven Scott 2011-08-28 18:08:03 -07:00
parent 8e222ea87e
commit 394421dff8
4 changed files with 35 additions and 5 deletions

11
README
View File

@ -10,9 +10,9 @@ iConomy support added back in, only costs are create, destroy and use.
Permissions Permissions
============= =============
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.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 -- Allow use of gates linking to any world (For Permissions 2.x/3.x please use stargate.world.*)
stargate.world.{world} -- Allow use of gates with a destination in {world}. Set to false to disallow use. 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 -- Allow use of gates on all networks (For Permissions 2.x/3.x please use stargate.network.*)
stargate.network.{network} -- Allow use of all gates in {network}. Set to false to disallow use. 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 -- Allow use of all options
@ -25,12 +25,14 @@ stargate.option -- Allow use of all options
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}
stargate.create.network -- Allow creating gates on any network stargate.create.network -- Allow creating gates on any network (For Permissions 2.x/3.x please use stargate.create.network.*)
stargate.create.network.{networkname} -- Allow creating gates on network {networkname}. Set to false to disallow creation on {networkname} stargate.create.network.{networkname} -- Allow creating gates on network {networkname}. Set to false to disallow creation on {networkname}
stargate.create.gate -- Allow creation of any gate layout (For Permissions 2.x/3.x please use stargate.create.gate.*)
stargate.create.gate.{gatefile} -- Allow creation of only {gatefile} gates
stargate.destroy -- Allow destruction gates on any network (Orderride all destroy permissions) 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.personal -- Allow destruction of gates owned by user only
stargate.destroy.network -- Allow destruction of gates on any network stargate.destroy.network -- Allow destruction of gates on any network (For Permissions 2.x/3.x please use stargate.destroy.network.*)
stargate.destroy.network.{networkname} -- Allow destruction of gates on network {networkname}. Set to false to disallow destruction of {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 -- Allow free use/creation/destruction of gates
@ -194,6 +196,7 @@ createConflict=Gate conflicts with existing gate
- 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 - Added 'S'how option for Always-On gates
- Added 'stargate.create.gate' permissions
[Version 0.6.4] [Version 0.6.4]
- Fixed iConomy handling - Fixed iConomy handling
[Version 0.6.3] [Version 0.6.3]

View File

@ -795,6 +795,15 @@ public class Portal {
} }
} }
// Check if the player can create this gate layout
String gateName = gate.getFilename();
gateName = gateName.substring(0, gateName.indexOf('.'));
if (!Stargate.canCreateGate(player, gateName)) {
Stargate.debug("createPortal", "Player does not have access to gate layout");
Stargate.sendMessage(player, Stargate.getString("createGateDeny"));
return null;
}
if (name.length() < 1 || name.length() > 11) { if (name.length() < 1 || name.length() > 11) {
Stargate.debug("createPortal", "Name length error"); Stargate.debug("createPortal", "Name length error");
Stargate.sendMessage(player, Stargate.getString("createNameLength")); Stargate.sendMessage(player, Stargate.getString("createNameLength"));

View File

@ -163,7 +163,6 @@ public class Stargate extends JavaPlugin {
iConomyHandler.createCost = config.getInt("createcost", iConomyHandler.createCost); iConomyHandler.createCost = config.getInt("createcost", iConomyHandler.createCost);
iConomyHandler.destroyCost = config.getInt("destroycost", iConomyHandler.destroyCost); iConomyHandler.destroyCost = config.getInt("destroycost", iConomyHandler.destroyCost);
iConomyHandler.useCost = config.getInt("usecost", iConomyHandler.useCost); iConomyHandler.useCost = config.getInt("usecost", iConomyHandler.useCost);
iConomyHandler.inFundMsg = config.getString("not-enough-money-message", iConomyHandler.inFundMsg);
iConomyHandler.toOwner = config.getBoolean("toowner", iConomyHandler.toOwner); iConomyHandler.toOwner = config.getBoolean("toowner", iConomyHandler.toOwner);
iConomyHandler.chargeFreeDestination = config.getBoolean("chargefreedestination", iConomyHandler.chargeFreeDestination); iConomyHandler.chargeFreeDestination = config.getBoolean("chargefreedestination", iConomyHandler.chargeFreeDestination);
iConomyHandler.freeGatesGreen = config.getBoolean("freegatesgreen", iConomyHandler.freeGatesGreen); iConomyHandler.freeGatesGreen = config.getBoolean("freegatesgreen", iConomyHandler.freeGatesGreen);
@ -455,6 +454,24 @@ public class Stargate extends JavaPlugin {
return false; return false;
} }
/*
* Check if the player can create this gate layout
*/
public static boolean canCreateGate(Player player, String gate) {
// Check for general create
if (hasPerm(player, "stargate.create")) return true;
// Check for all gate create permissions
if (hasPerm(player, "stargate.create.gate")) {
// Do a deep check to see if the player lacks this specific gate node
if (!hasPermDeep(player, "stargate.create.gate." + gate)) return false;
return true;
}
// Check for this specific gate
if (hasPerm(player, "stargate.create.gate." + gate)) return true;
return false;
}
/* /*
* Check if the player can destroy this gate * Check if the player can destroy this gate
*/ */

View File

@ -13,6 +13,7 @@ ecoInFunds=Insufficient Funds
createMsg=Gate Created createMsg=Gate Created
createNetDeny=You do not have access to that network createNetDeny=You do not have access to that network
createGateDeny=You do not have access to that gate layout
createPersonal=Creating gate on personal network createPersonal=Creating gate on personal network
createNameLength=Name too short or too long. createNameLength=Name too short or too long.
createExists=A gate by that name already exists createExists=A gate by that name already exists