InvokableItem
Interface to give an object the ability to be ‘obtained’ and ‘invoked’ (activated). All implementing classes must make two functions:
onInvoke
: called when a player activates or Uses an item found within either the player’s inventory or the current Room.
onObtain
: called when a player tries to obtain or Get an item found within the current Room.
package: core;
Contents
Implemented Methods
void onInvoke(Player p, Map m)
Called when a player tries to use or activate an item.
i.e. Using a magic lamp might start a conversation with an NPC or change the player’s location.
void onObtain(Player p, Map m)
Called when a player tries to obtain or get an item from within the current room. The most useful implementation of this method is to also check if a player is ABLE to get the item.
i.e. Can’t pull a doorknob off of a door without a screwdriver