diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairItemType.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairItemType.java index dd0f2227b..caf292c9e 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairItemType.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairItemType.java @@ -1,7 +1,30 @@ package com.gmail.nossr50.skills.repair; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.util.Permissions; + public enum RepairItemType { ARMOR, TOOL, - OTHER + OTHER; + + /** + * Get the base permissions associated with this RepairItemType. + * + * @param player The player to check the permissions for + * @return true if the player has permissions, false otherwise + */ + public boolean getPermissions(Player player) { + switch (this) { + case ARMOR: + return Permissions.getInstance().armorRepair(player); + case TOOL: + return Permissions.getInstance().toolRepair(player); + case OTHER: + return Permissions.getInstance().otherRepair(player); + default: + return false; + } + } } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairMaterialType.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairMaterialType.java index 60b99f60f..010ad6ca3 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairMaterialType.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairMaterialType.java @@ -1,5 +1,9 @@ package com.gmail.nossr50.skills.repair; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.util.Permissions; + public enum RepairMaterialType { STRING, LEATHER, @@ -8,5 +12,34 @@ public enum RepairMaterialType { IRON, GOLD, DIAMOND, - OTHER + OTHER; + + /** + * Get the base permissions associated with this RepairMaterialType. + * + * @param player The player to check the permissions for + * @return true if the player has permissions, false otherwise + */ + public boolean getPermissions(Player player) { + switch (this) { + case STRING: + return Permissions.getInstance().stringRepair(player); + case LEATHER: + return Permissions.getInstance().leatherRepair(player); + case WOOD: + return Permissions.getInstance().woodRepair(player); + case STONE: + return Permissions.getInstance().stoneRepair(player); + case IRON: + return Permissions.getInstance().ironRepair(player); + case GOLD: + return Permissions.getInstance().goldRepair(player); + case DIAMOND: + return Permissions.getInstance().diamondRepair(player); + case OTHER: + return Permissions.getInstance().otherMaterialRepair(player); + default: + return false; + } + } }