RuneHive-Game
Loading...
Searching...
No Matches
SpadeAction.java
Go to the documentation of this file.
1package com.runehive.game.action.impl;
2
3import com.runehive.net.packet.out.SendMessage;
4import com.runehive.game.Animation;
5import com.runehive.game.action.Action;
6import com.runehive.game.action.policy.WalkablePolicy;
7import com.runehive.game.world.entity.mob.player.Player;
8import com.runehive.content.activity.impl.barrows.BarrowsUtility;
9
10/**
11 * Handles digging with a spade.
12 *
13 * @author Daniel.
14 */
15public final class SpadeAction extends Action<Player> {
16
17 public SpadeAction(Player player) {
18 super(player, 2, false);
19 }
20
21 @Override
22 protected void onSchedule() {
23 getMob().movement.reset();
24 getMob().animate(new Animation(830));
25 getMob().send(new SendMessage("You start digging..."));
26 }
27
28 @Override
29 public void execute() {
30 boolean found = false;
31
33 found = true;
34
35 if (!found)
36 getMob().send(new SendMessage("You found nothing of interest."));
37 cancel();
38 }
39
40 @Override
43
44
45 @Override
46 public boolean prioritized() {
47 return false;
48 }
49
50 @Override
51 public String getName() {
52 return "Spade Action";
53 }
54}
Class that models a single animation used by an entity.
T getMob()
Gets the player.
Definition Action.java:44
Action(T mob, int delay, boolean instant)
Creates a new Action randomevent.
Definition Action.java:24
boolean prioritized()
Determines if this action is prioritized.
void onSchedule()
A function executed on registration.
WalkablePolicy getWalkablePolicy()
Gets the WalkablePolicy of this action.
String getName()
Gets the name of this action.
void execute()
A function representing the unit of work that will be carried out.
synchronized final void cancel()
Cancels all subsequent executions.
Definition Task.java:113
This class represents a character controlled by a player.
Definition Player.java:125
The OutgoingPacket that sends a message to a Players chatbox in the client.
A queue policy determines whether the action can occur while walking.
NON_WALKABLE
This indicates actions cannot occur while walking.