diff --git a/README b/README index 32db20c..97dcf8b 100644 --- a/README +++ b/README @@ -10,9 +10,9 @@ 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 (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.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.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.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.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.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.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 - Fixed iConomy creation cost - Added 'S'how option for Always-On gates + - Added 'stargate.create.gate' permissions [Version 0.6.4] - Fixed iConomy handling [Version 0.6.3] diff --git a/src/net/TheDgtl/Stargate/Portal.java b/src/net/TheDgtl/Stargate/Portal.java index 1acdbf8..829e3aa 100644 --- a/src/net/TheDgtl/Stargate/Portal.java +++ b/src/net/TheDgtl/Stargate/Portal.java @@ -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) { Stargate.debug("createPortal", "Name length error"); Stargate.sendMessage(player, Stargate.getString("createNameLength")); diff --git a/src/net/TheDgtl/Stargate/Stargate.java b/src/net/TheDgtl/Stargate/Stargate.java index 380c10d..6e0f916 100644 --- a/src/net/TheDgtl/Stargate/Stargate.java +++ b/src/net/TheDgtl/Stargate/Stargate.java @@ -163,7 +163,6 @@ public class Stargate extends JavaPlugin { iConomyHandler.createCost = config.getInt("createcost", iConomyHandler.createCost); iConomyHandler.destroyCost = config.getInt("destroycost", iConomyHandler.destroyCost); 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.chargeFreeDestination = config.getBoolean("chargefreedestination", iConomyHandler.chargeFreeDestination); iConomyHandler.freeGatesGreen = config.getBoolean("freegatesgreen", iConomyHandler.freeGatesGreen); @@ -455,6 +454,24 @@ public class Stargate extends JavaPlugin { 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 */ diff --git a/src/net/TheDgtl/Stargate/resources/en.txt b/src/net/TheDgtl/Stargate/resources/en.txt index dc626a1..97a5772 100644 --- a/src/net/TheDgtl/Stargate/resources/en.txt +++ b/src/net/TheDgtl/Stargate/resources/en.txt @@ -13,6 +13,7 @@ ecoInFunds=Insufficient Funds createMsg=Gate Created 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 createNameLength=Name too short or too long. createExists=A gate by that name already exists