From 5b6ce6ce6afcb73e73ffecac75c629c5fbceffe7 Mon Sep 17 00:00:00 2001 From: Nick Minkler Date: Tue, 21 Jan 2014 00:37:56 -0800 Subject: [PATCH] add some more documentation on the Items search methods. --- src/net/milkbowl/vault/item/Items.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/net/milkbowl/vault/item/Items.java b/src/net/milkbowl/vault/item/Items.java index 91d0bd7..b2bd7e3 100644 --- a/src/net/milkbowl/vault/item/Items.java +++ b/src/net/milkbowl/vault/item/Items.java @@ -655,6 +655,11 @@ public class Items { return itemByType(Material.getMaterial(typeId), subType); } + /** + * Searchs for an ItemInfo from the given ItemStack + * @param itemStack + * @return ItemInfo found, or null + */ public static ItemInfo itemByStack(ItemStack itemStack) { if (itemStack == null) { return null; @@ -680,10 +685,21 @@ public class Items { return null; } + /** + * Gets a relevant ItemInfo by it's Material + * @param type + * @return ItemInfo + */ public static ItemInfo itemByType(Material type) { return itemByType(type, (short) 0); } + /** + * Searches for an ItemInfo record by Material and SubTypeID + * @param type + * @param subType + * @return + */ public static ItemInfo itemByType(Material type, short subType) { for (ItemInfo item : items) { if (item.getType() == type && item.getSubTypeId() == subType) { @@ -693,6 +709,15 @@ public class Items { return null; } + /** + * Search for an item from a given string, useful for user input. Uses 3 different types of reg-exp searching. + * Checks first for an ItemID. + * Checks second for ItemID:SubType + * Last, it will run a by-name item search assuming the string is the name of an item. + * + * @param string to parse + * @return ItemInfo found or null + */ public static ItemInfo itemByString(String string) { // int