124eeab893
Implemented authentic script/interaction queues This does now mean we have a total of 3 interaction systems, but this additional system is necessary to fix certain categories of bug and implement some authentic features Converted mining to new system Converted fishing to new system Converted woodcutting to new system Provided an example of soft-queued scripts with GrandTreePodListener Implemented tick-eating (it is now possible to eat a shark, drink a potion, and eat a karambwan all on the same tick) Can now eat and drop items while stunned
40 lines
1.0 KiB
Java
40 lines
1.0 KiB
Java
package content.global.handlers.scenery;
|
|
|
|
import core.cache.def.impl.SceneryDefinition;
|
|
import core.game.interaction.OptionHandler;
|
|
import core.game.node.Node;
|
|
import core.game.node.entity.player.Player;
|
|
import core.game.node.item.Item;
|
|
import core.plugin.Initializable;
|
|
import core.plugin.Plugin;
|
|
|
|
/**
|
|
* Represents the doogle leaf plugin for this object.
|
|
* @author 'Vexia
|
|
* @version 1.0
|
|
*/
|
|
public class DoogleLeafPlugin extends OptionHandler {
|
|
|
|
/**
|
|
* Represents the leaf item.
|
|
*/
|
|
private static final Item LEAF = new Item(1573, 1);
|
|
|
|
@Override
|
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
SceneryDefinition.forId(31155).getHandlers().put("option:pick-leaf", this);
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public boolean handle(Player player, Node node, String option) {
|
|
if (!player.getInventory().add(LEAF)) {
|
|
player.getPacketDispatch().sendMessage("You don't have have enough space in your inventory.");
|
|
} else {
|
|
player.getPacketDispatch().sendMessage("You pick some doogle leaves.");
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|