Query.Types
Constructor and Description |
---|
ItemQuery(java.util.List<java.lang.Integer> itemID,
java.util.List<java.lang.Integer> durability)
Constructs a query with the given IDs and durabilities.
|
ItemQuery(java.util.List<java.lang.Integer> itemID,
java.util.List<java.lang.Integer> durability,
java.util.List<java.lang.Boolean> playerCreated)
Constructs a query with the given IDs and durabilities.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static ItemQuery |
fromAny()
Universal query.
|
static ItemQuery |
fromAny(org.bukkit.block.Block block)
Creates a query from a given world block.
|
static ItemQuery |
fromAny(java.lang.Integer itemID,
java.lang.Integer durability)
Creates a query from the given material and data, where NULL represents any value.
|
static ItemQuery |
fromAny(java.lang.Integer itemID,
java.lang.Integer durability,
java.lang.Boolean playerCreated)
Creates a query from the given material and data, where NULL represents any value.
|
static ItemQuery |
fromAny(org.bukkit.inventory.ItemStack stack)
Extracts the item type and durability.
|
static ItemQuery |
fromAny(org.bukkit.Material material)
Creates a query from the given material and data.
|
static ItemQuery |
fromAny(org.bukkit.Material material,
java.lang.Integer durability)
Creates a query from the given material and data.
|
static ItemQuery |
fromExact(org.bukkit.block.Block block)
Creates a query from a given world block.
|
static ItemQuery |
fromExact(java.lang.Integer itemID,
java.lang.Integer durability)
Creates a query from the given ID and durability.
|
static ItemQuery |
fromExact(java.lang.Integer itemID,
java.lang.Integer durability,
java.lang.Boolean playerCreated)
Creates a query from the given ID and durability.
|
static ItemQuery |
fromExact(org.bukkit.inventory.ItemStack stack)
Extracts the item type and durability.
|
java.util.List<java.lang.Integer> |
getDurability() |
java.util.List<java.lang.Integer> |
getItemID() |
java.util.List<java.lang.Boolean> |
getPlayerCreated() |
Query.Types |
getQueryType() |
boolean |
hasDurability() |
int |
hashCode() |
boolean |
hasItemID() |
static boolean |
hasItems(org.bukkit.inventory.ItemStack stack)
Determines if the given item stack is non-empty.
|
boolean |
hasPlayerCreated() |
boolean |
match(java.lang.Integer id,
java.lang.Integer durability)
Determines if the current query matches the given item.
|
boolean |
match(java.lang.Integer id,
java.lang.Integer durability,
java.lang.Boolean playerCreated)
Determines if the current query matches the given item.
|
boolean |
match(org.bukkit.Material item)
Determines if the current query matches the given item.
|
boolean |
match(Query other)
Determines if the given query matches the current query.
|
org.bukkit.inventory.ItemStack |
toItemStack(int amount)
Converts the given query to an item stack if possible.
|
java.lang.String |
toString() |
public ItemQuery(java.util.List<java.lang.Integer> itemID, java.util.List<java.lang.Integer> durability)
itemID
- - list of IDs.durability
- - list of durabilities.public ItemQuery(java.util.List<java.lang.Integer> itemID, java.util.List<java.lang.Integer> durability, java.util.List<java.lang.Boolean> playerCreated)
itemID
- - list of IDs.durability
- - list of durabilities.playerCreated
- - option specifying whether or not the block was placed by a player.public static ItemQuery fromAny()
public static ItemQuery fromAny(org.bukkit.Material material)
material
- - material to create from.public static ItemQuery fromAny(org.bukkit.Material material, java.lang.Integer durability)
material
- - material to create from.durability
- - durability to create from.public static ItemQuery fromAny(java.lang.Integer itemID, java.lang.Integer durability)
itemID
- - ID to create from, or NULL to indicate every ID.durability
- - durability to create from, or NULL to indicate every durability.public static ItemQuery fromAny(java.lang.Integer itemID, java.lang.Integer durability, java.lang.Boolean playerCreated)
itemID
- - ID to create from, or NULL to indicate every ID.durability
- - durability to create from, or NULL to indicate every durability.playerCreated
- - whether or not the block was created/placed by a player.public static ItemQuery fromAny(org.bukkit.inventory.ItemStack stack)
stack
- - item type.org.apache.commons.lang.NullArgumentException
- if the stack is null.public static ItemQuery fromAny(org.bukkit.block.Block block)
block
- - block to create from.public static ItemQuery fromExact(org.bukkit.block.Block block)
block
- - block to create from.public static ItemQuery fromExact(org.bukkit.inventory.ItemStack stack)
stack
- - item type.org.apache.commons.lang.NullArgumentException
- if the stack is null.public static ItemQuery fromExact(java.lang.Integer itemID, java.lang.Integer durability)
itemID
- - ID to match, or NULL to match queries without IDs.durability
- - durability to match, or NULL to match queries without durabilities.public static ItemQuery fromExact(java.lang.Integer itemID, java.lang.Integer durability, java.lang.Boolean playerCreated)
itemID
- - ID to match, or NULL to match queries without IDs.durability
- - durability to match, or NULL to match queries without durabilities.public java.util.List<java.lang.Integer> getItemID()
public java.util.List<java.lang.Integer> getDurability()
public java.util.List<java.lang.Boolean> getPlayerCreated()
public boolean hasItemID()
public boolean hasDurability()
public boolean hasPlayerCreated()
public boolean match(Query other)
Query
If a query can be considered to be a subset of the universe of items, then this operation determines if the current set (A) has a non-empty intersection with the other set (B).
public boolean match(java.lang.Integer id, java.lang.Integer durability, java.lang.Boolean playerCreated)
id
- - id of item, or NULL for every ID.durability
- - durability of item, or NULL for every durability.public boolean match(java.lang.Integer id, java.lang.Integer durability)
id
- - id of item, or NULL for every ID.durability
- - durability of item, or NULL for every durability.public boolean match(org.bukkit.Material item)
item
- - item to test, or NULL for every possible item.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public org.bukkit.inventory.ItemStack toItemStack(int amount)
public java.lang.String toString()
toString
in class java.lang.Object
public Query.Types getQueryType()
getQueryType
in interface Query
public static boolean hasItems(org.bukkit.inventory.ItemStack stack)
stack
- - item stack to test.