[trunk] Unlimited: allow permissions with ids instead of names:

essentials.unlimited.item-1

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1121 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-04 14:51:19 +00:00
parent 28da8fa91c
commit 6f84be54f0

View File

@ -52,29 +52,28 @@ public class Commandunlimited extends EssentialsCommand
String itemname = stack.getType().toString().toLowerCase().replace("_", "-");
if (!user.isAuthorized("essentials.unlimited.item-add") &&
!user.isAuthorized("essentials.unlimited.item-"+itemname)
&& !((stack.getType() == Material.WATER_BUCKET || stack.getType() == Material.LAVA_BUCKET)
&& user.isAuthorized("essentials.unlimited.item-bucket"))) {
!user.isAuthorized("essentials.unlimited.item-"+itemname) &&
!user.isAuthorized("essentials.unlimited.item-"+stack.getTypeId()) &&
!((stack.getType() == Material.WATER_BUCKET || stack.getType() == Material.LAVA_BUCKET) &&
user.isAuthorized("essentials.unlimited.item-bucket"))) {
user.sendMessage(ChatColor.RED + "No permission for unlimited item "+itemname+".");
return;
}
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
if (target.hasUnlimited(stack)) {
if (user != target) {
user.sendMessage("§7Disable unlimited placing of " + itemName + " for " + user.getDisplayName() + ".");
user.sendMessage("§7Disable unlimited placing of " + itemname + " for " + user.getDisplayName() + ".");
}
target.sendMessage("§7Disable unlimited placing of " + itemName + " for " + user.getDisplayName() + ".");
target.sendMessage("§7Disable unlimited placing of " + itemname + " for " + user.getDisplayName() + ".");
target.setUnlimited(stack, false);
return;
}
user.charge(this);
if (user != target) {
user.sendMessage("§7Giving unlimited amount of " + itemName + " to " + user.getDisplayName() + ".");
user.sendMessage("§7Giving unlimited amount of " + itemname + " to " + user.getDisplayName() + ".");
}
target.sendMessage("§7Giving unlimited amount of " + itemName + " to " + user.getDisplayName() + ".");
target.sendMessage("§7Giving unlimited amount of " + itemname + " to " + user.getDisplayName() + ".");
if (!InventoryWorkaround.containsItem((CraftInventory)target.getInventory(), true, stack)) {
target.getInventory().addItem(stack);
}