From 2834a41f3a80cb00370d547576e8223417dd984e Mon Sep 17 00:00:00 2001 From: Limb Date: Mon, 24 Jan 2011 07:32:53 +0800 Subject: [PATCH 1/4] Implemented Inventory.contains with a minimum amount of item required. As per feature request #187 --- .../java/org/bukkit/inventory/Inventory.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java index e0b52562..01c9160c 100644 --- a/src/main/java/org/bukkit/inventory/Inventory.java +++ b/src/main/java/org/bukkit/inventory/Inventory.java @@ -97,6 +97,32 @@ public interface Inventory { * @return If any matching ItemStacks were found */ public boolean contains(ItemStack item); + + /** + * Check if the inventory contains any ItemStacks with the given materialId and at least the minimum amount specified + * + * @param materialId The materialId to check for + * @param amount The minimum amount to look for + * @return If any ItemStacks were found + */ + public boolean contains(int materialId, int amount); + + /** + * Check if the inventory contains any ItemStacks with the given material and at least the minimum amount specified + * + * @param material The material to check for + * @return If any ItemStacks were found + */ + public boolean contains(Material material, int amount); + + /** + * Check if the inventory contains any ItemStacks matching the given ItemStack and at least the minimum amount specified + * This will only match if both the type and the amount of the stack match + * + * @param item The ItemStack to match against + * @return If any matching ItemStacks were found + */ + public boolean contains(ItemStack item, int amount); /** * Find all slots in the inventory containing any ItemStacks with the given materialId From e7151a2316fe0df49c5157c3196be9d71f1cff22 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 3 Feb 2011 13:13:44 -0800 Subject: [PATCH 2/4] Added brief coding conventions - these may not be complete. --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ceac2540..11c142df 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,20 @@ Bukkit A Minecraft Server API. +Coding Conventions +----------- + +We generally follow the Sun/Oracle coding standards. +No tabs; use 4 spaces instead. +No trailing whitespaces. +No 80 column limit or midstatement newlines. + +Follow the above conventions if you want your pull requests accepted. + Compilation ----------- We use maven to handle our dependencies. * Install [Maven 3](http://maven.apache.org/download.html) -* Check out this repo and: `mvn clean install` +* Check out this repo and: `mvn clean install` \ No newline at end of file From 1b6844ad651f48365104cba0013ec29c061db395 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 3 Feb 2011 13:14:12 -0800 Subject: [PATCH 3/4] I suck at markdown. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 11c142df..9a3d5042 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,11 @@ Coding Conventions ----------- We generally follow the Sun/Oracle coding standards. + No tabs; use 4 spaces instead. + No trailing whitespaces. + No 80 column limit or midstatement newlines. Follow the above conventions if you want your pull requests accepted. From c0050a95570fb4885c533710083ed8cba7571723 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 3 Feb 2011 13:15:00 -0800 Subject: [PATCH 4/4] I *really* suck at markdown. --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9a3d5042..a1551a4f 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,10 @@ A Minecraft Server API. Coding Conventions ----------- -We generally follow the Sun/Oracle coding standards. - -No tabs; use 4 spaces instead. - -No trailing whitespaces. - -No 80 column limit or midstatement newlines. +* We generally follow the Sun/Oracle coding standards. +* No tabs; use 4 spaces instead. +* No trailing whitespaces. +* No 80 column limit or midstatement newlines. Follow the above conventions if you want your pull requests accepted.