Put new permissions to good use

This commit is contained in:
NuclearW 2012-05-17 09:29:27 -04:00
parent c25ddd0dbc
commit 45fe8c182b
2 changed files with 58 additions and 2 deletions

View File

@ -1,7 +1,30 @@
package com.gmail.nossr50.skills.repair; package com.gmail.nossr50.skills.repair;
import org.bukkit.entity.Player;
import com.gmail.nossr50.util.Permissions;
public enum RepairItemType { public enum RepairItemType {
ARMOR, ARMOR,
TOOL, 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;
}
}
} }

View File

@ -1,5 +1,9 @@
package com.gmail.nossr50.skills.repair; package com.gmail.nossr50.skills.repair;
import org.bukkit.entity.Player;
import com.gmail.nossr50.util.Permissions;
public enum RepairMaterialType { public enum RepairMaterialType {
STRING, STRING,
LEATHER, LEATHER,
@ -8,5 +12,34 @@ public enum RepairMaterialType {
IRON, IRON,
GOLD, GOLD,
DIAMOND, 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;
}
}
} }