public class ItemSet
extends java.lang.Object
CfItems
known to the player.Constructor and Description |
---|
ItemSet() |
Modifier and Type | Method and Description |
---|---|
void |
addInventoryListener(int tag,
@NotNull ItemListener listener)
Adds an
ItemListener to be notified about changes. |
void |
addItem(@NotNull CfItem item)
Adds an item.
|
void |
addItemSetListener(@NotNull ItemSetListener listener)
Adds an
ItemSetListener to be notified about changes. |
void |
cleanInventory(int tag)
Clears the inventory of an item.
|
@Nullable CfItem |
getInventoryItem(int tag,
int index)
Returns a
CfItem from the inventory of an item. |
@Nullable CfItem |
getItemByTag(int tag)
Returns an item by tag.
|
@NotNull java.util.List<CfItem> |
getItemsByLocation(int location)
Returns a list of items in a given location.
|
int |
getNumberOfItemsByLocation(int location)
Returns the number of items in a given location.
|
int |
getOpenContainer()
Returns the currently opened container.
|
@Nullable CfItem |
getPlayer()
Returns the player object this client controls.
|
@NotNull java.lang.Iterable<CfItem> |
getPlayerInventory()
Returns the player's inventory.
|
void |
removeInventoryListener(int tag,
@NotNull ItemListener listener)
Removes an
ItemListener to be notified about changes. |
void |
removeItems(int[] tags)
Deletes items by tag.
|
void |
removeItemSetListener(@NotNull ItemSetListener listener)
Removes an
ItemSetListener to be notified about changes. |
void |
reset()
Resets the manager's state.
|
void |
setMarkedItemTag(int markedItemTag)
Sets the marked item.
|
void |
setPlayer(@Nullable CfItem player)
Sets the player object this client controls.
|
void |
updateItem(int flags,
int tag,
int valLocation,
int valFlags,
int valWeight,
@NotNull Face valFace,
@NotNull java.lang.String valName,
@NotNull java.lang.String valNamePl,
int valAnim,
int valAnimSpeed,
int valNrof)
Processes an "upditem" command.
|
public void addItemSetListener(@NotNull @NotNull ItemSetListener listener)
ItemSetListener
to be notified about changes.listener
- the listener to addpublic void removeItemSetListener(@NotNull @NotNull ItemSetListener listener)
ItemSetListener
to be notified about changes.listener
- the listener to removepublic void addInventoryListener(int tag, @NotNull @NotNull ItemListener listener)
ItemListener
to be notified about changes.tag
- the item tag to watchlistener
- the listener to addpublic void removeInventoryListener(int tag, @NotNull @NotNull ItemListener listener)
ItemListener
to be notified about changes.tag
- the item tag to watchlistener
- the listener to add@NotNull public @NotNull java.util.List<CfItem> getItemsByLocation(int location)
location
- the locationpublic int getNumberOfItemsByLocation(int location)
0
.location
- the location to checkpublic void removeItems(int[] tags)
tags
- the tags to deletepublic void addItem(@NotNull @NotNull CfItem item)
item
- the item to add@Nullable public @Nullable CfItem getItemByTag(int tag)
tag
- the tagnull
if no such items exists@Nullable public @Nullable CfItem getPlayer()
public void setPlayer(@Nullable @Nullable CfItem player)
player
- the new player object@NotNull public @NotNull java.lang.Iterable<CfItem> getPlayerInventory()
public void cleanInventory(int tag)
tag
- the item tagpublic void updateItem(int flags, int tag, int valLocation, int valFlags, int valWeight, @NotNull @NotNull Face valFace, @NotNull @NotNull java.lang.String valName, @NotNull @NotNull java.lang.String valNamePl, int valAnim, int valAnimSpeed, int valNrof)
flags
- the changed valuestag
- the item's tagvalLocation
- the item's locationvalFlags
- the item's flagsvalWeight
- the item's weightvalFace
- the item's facevalName
- the item's singular namevalNamePl
- the item's plural namevalAnim
- the item's animation IDvalAnimSpeed
- the item's animation speedvalNrof
- the number of itemspublic void reset()
public int getOpenContainer()
@Nullable public @Nullable CfItem getInventoryItem(int tag, int index)
CfItem
from the inventory of an item.tag
- the item's tagindex
- the index of the inventory item to returnnull
if the index does not existpublic void setMarkedItemTag(int markedItemTag)
markedItemTag
- the tag of the marked item or -1
to unset
the marked item