ChestShop-3/com/Acrobot/ChestShop/Permission.java
Acrobot d6bdb0486a - Fixed chests in 1.2.3
- Formatting
- Warning about old Bukkit version
- Renamed "TOWNY_CANNOT_CREATE_SHOP_HERE" to "CANNOT_CREATE_SHOP_HERE" to avoid confusion
- Renamed "NOT_ENOUGH_LWC_PROTECTIONS" to "NOT_ENOUGH_PROTECTIONS" and changed its message

- Fixed armour enchantments
- Logging shop location
- Fixed Heroes for the newest version
- Removed redutant plugin object
- Added dev-url for CraftBukkitUpToDate
- Removed redutant plugins from softdepend
- Fixed a bug when the player interacts with a shop with a sign in hand
2012-03-17 15:00:25 +01:00

54 lines
1.4 KiB
Java

package com.Acrobot.ChestShop;
import org.bukkit.entity.Player;
/**
* @author Acrobot
*/
public enum Permission {
SHOP_CREATION_BUY("ChestShop.shop.create.buy"),
SHOP_CREATION_SELL("ChestShop.shop.create.sell"),
SHOP_CREATION_ID("ChestShop.shop.create."),
BUY("ChestShop.shop.buy"),
BUY_ID("ChestShop.shop.buy."),
SELL_ID("ChestShop.shop.sell."),
SELL("ChestShop.shop.sell"),
ADMIN("ChestShop.admin"),
MOD("ChestShop.mod"),
OTHER_NAME("ChestShop.name."),
GROUP("ChestShop.group."),
NOFEE("ChestShop.nofee");
private final String permission;
Permission(String permission) {
this.permission = permission;
}
public static boolean has(Player player, Permission permission) {
return has(player, permission.permission);
}
public static boolean has(Player player, String node) {
return player.hasPermission(node) || player.hasPermission(node.toLowerCase());
}
public static boolean otherName(Player p, String name) {
if (has(p, Permission.ADMIN)) return false;
String node = OTHER_NAME + name;
return hasPermissionSet(p, node) || hasPermissionSet(p, node.toLowerCase());
}
private static boolean hasPermissionSet(Player p, String perm) {
return p.isPermissionSet(perm) && p.hasPermission(perm);
}
public String toString() {
return permission;
}
}