summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
index 28c0a6e7f..a8dcf8ad4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java
@@ -1,10 +1,12 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Essentials;
+import com.earth2me.essentials.InventoryWorkaround;
import com.earth2me.essentials.ItemDb;
import com.earth2me.essentials.User;
import org.bukkit.ChatColor;
import org.bukkit.Server;
+import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.inventory.ItemStack;
public class Commandunlimited extends EssentialsCommand
@@ -22,7 +24,7 @@ public class Commandunlimited extends EssentialsCommand
user.sendMessage("§cUsage: /" + commandLabel + " [item] <player>");
return;
}
- ItemStack stack = ItemDb.get(args[0]);
+ ItemStack stack = ItemDb.get(args[0], 1);
if(!user.isAuthorized("essentials.infinite.whitelist.override") &&
Essentials.getSettings().getUnlimitedWhitelist().contains(stack.getTypeId()))
@@ -51,7 +53,9 @@ public class Commandunlimited extends EssentialsCommand
user.sendMessage("§7Giving unlimited amount of " + itemName + " to " + user.getDisplayName() + ".");
}
target.sendMessage("§7Giving unlimited amount of " + itemName + " to " + user.getDisplayName() + ".");
- target.getInventory().addItem(stack);
+ if (!InventoryWorkaround.containsItem((CraftInventory)target.getInventory(), true, stack)) {
+ target.getInventory().addItem(stack);
+ }
target.setUnlimited(stack, true);
}
}