summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-04 14:51:19 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-04 14:51:19 +0000
commitcc9a34295fe8304415a24e34b6d76e8965b3fd1f (patch)
tree20ac563df2be4da3a7aa03fb14e385620c075a3b
parent72b234c84fc23bb57ed738b5496273b1fd23210d (diff)
downloadEssentials-cc9a34295fe8304415a24e34b6d76e8965b3fd1f.tar
Essentials-cc9a34295fe8304415a24e34b6d76e8965b3fd1f.tar.gz
Essentials-cc9a34295fe8304415a24e34b6d76e8965b3fd1f.tar.lz
Essentials-cc9a34295fe8304415a24e34b6d76e8965b3fd1f.tar.xz
Essentials-cc9a34295fe8304415a24e34b6d76e8965b3fd1f.zip
[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
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
index 682806700..ca8e47f11 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
@@ -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);
}