Class GroundObjectEntity
- java.lang.Object
-
- com.kraken.api.core.AbstractEntity<GroundItem>
-
- com.kraken.api.query.groundobject.GroundObjectEntity
-
- All Implemented Interfaces:
Interactable<GroundItem>
public class GroundObjectEntity extends AbstractEntity<GroundItem>
-
-
Field Summary
-
Fields inherited from class com.kraken.api.core.AbstractEntity
ctx, raw
-
-
Constructor Summary
Constructors Constructor Description GroundObjectEntity(Context ctx, GroundItem raw)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetId()The item ID for the wrapped game entityjava.lang.StringgetName()The game entities name.booleaninteract(java.lang.String action)Interact interacts with the ground object.booleanisInArea(GameArea area)Checks if the ground object is within the game area.booleantake()Takes an item from the ground to be placed in the players inventory.-
Methods inherited from class com.kraken.api.core.AbstractEntity
equals, hashCode, isNull, raw
-
-
-
-
Constructor Detail
-
GroundObjectEntity
public GroundObjectEntity(Context ctx, GroundItem raw)
-
-
Method Detail
-
getId
public int getId()
Description copied from interface:InteractableThe item ID for the wrapped game entity- Returns:
- int Item id
-
getName
public java.lang.String getName()
Description copied from interface:InteractableThe game entities name.- Returns:
- The name of the game entity i.e. NPC name for NPC's, item name for ContainerItem's, and GameObject name for various game objects.
-
interact
public boolean interact(java.lang.String action)
Interact interacts with the ground object. This interact is slightly different from other interactions because the underlying packet object does not accept an action to take on the ground object. It is always "Take" because that is the only action you can perform to an item on the ground.To conform to the interface for an
AbstractEntitywe still accept an action parameter although it will do nothing in this particular instance.- Parameters:
action- The menu action to trigger (e.g. "Take")- Returns:
- True if the interaction is successful and false otherwise
-
isInArea
public boolean isInArea(GameArea area)
Checks if the ground object is within the game area.- Parameters:
area- TheGameAreato check.- Returns:
- True if the ground object is within the game area and false otherwise.
-
take
public boolean take()
Takes an item from the ground to be placed in the players inventory.- Returns:
- True if the action was successful and false otherwise.
-
-