public class ItemNameParser extends TextParser<java.util.Set<java.lang.Integer>>
Modifier and Type | Field and Description |
---|---|
protected com.google.common.collect.SetMultimap<java.lang.String,java.lang.Integer> |
lookupMaterial |
Constructor and Description |
---|
ItemNameParser() |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
getFirstRegistered(java.lang.String name)
Retrieves the first registered item, or NULL if not found.
|
java.util.Collection<java.lang.Integer> |
getRegistered(java.lang.String name)
Retrieves the set of registered IDs directly.
|
protected void |
loadDefaultList() |
java.util.Set<java.lang.Integer> |
parse(java.lang.String text)
Determines the item, either by ID or name, of the given string of characters.
|
void |
register(java.lang.String name,
java.lang.Integer id)
Registers a new material for the item parser.
|
void |
register(java.lang.String name,
org.bukkit.Material material)
Registers a new material for the item parser.
|
void |
unregister(java.lang.String name,
java.lang.Integer id)
Dissociates the given name by the given ID.
|
getParameterQueue, parse, tryParse, tryParse
protected com.google.common.collect.SetMultimap<java.lang.String,java.lang.Integer> lookupMaterial
protected void loadDefaultList()
public void register(java.lang.String name, org.bukkit.Material material)
name
- - name of the material. Only capital letters and no underscores/spaces.material
- - the associated material.public void register(java.lang.String name, java.lang.Integer id)
name
- - name of the material. Only capital letters and no underscores/spaces.id
- - the associated material id.public java.util.Collection<java.lang.Integer> getRegistered(java.lang.String name)
name
- - material to find.public java.lang.Integer getFirstRegistered(java.lang.String name)
name
- - the name of the item to search for.public void unregister(java.lang.String name, java.lang.Integer id)
name
- - name to find.id
- - ID to remove.public java.util.Set<java.lang.Integer> parse(java.lang.String text) throws ParsingException
parse
in class TextParser<java.util.Set<java.lang.Integer>>
text
- String of characters.ParsingException
- Invoked when an unrecognized item name is given.