summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/ItemDb.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/ItemDb.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/ItemDb.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java
index 3bf49d836..8c4ce1603 100644
--- a/Essentials/src/com/earth2me/essentials/ItemDb.java
+++ b/Essentials/src/com/earth2me/essentials/ItemDb.java
@@ -141,6 +141,42 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
retval.setDurability(metaData);
return retval;
}
+
+ public List<ItemStack> getMatching (User user, String[] args) throws Exception {
+ List<ItemStack> is = new ArrayList<ItemStack>();
+
+ if (args[0].equalsIgnoreCase("hand"))
+ {
+ is.add(user.getItemInHand());
+ }
+ else if (args[0].equalsIgnoreCase("inventory") || args[0].equalsIgnoreCase("invent") || args[0].equalsIgnoreCase("all"))
+ {
+ for (ItemStack stack : user.getInventory().getContents())
+ {
+ if (stack == null || stack.getType() == Material.AIR)
+ {
+ continue;
+ }
+ is.add(stack);
+ }
+ }
+ else if (args[0].equalsIgnoreCase("blocks"))
+ {
+ for (ItemStack stack : user.getInventory().getContents())
+ {
+ if (stack == null || stack.getTypeId() > 255 || stack.getType() == Material.AIR)
+ {
+ continue;
+ }
+ is.add(stack);
+ }
+ }
+ else
+ {
+ is.add(get(args[0]));
+ }
+ return is;
+ }
public String names(ItemStack item)
{