RuneHive-Game
Loading...
Searching...
No Matches
ItemAction.java
Go to the documentation of this file.
1package com.runehive.content.itemaction;
2
3import com.runehive.game.world.entity.mob.player.Player;
4import com.runehive.game.world.items.Item;
5
6/**
7 * Handles executing an item action.
8 *
9 * @author Daniel
10 */
11public abstract class ItemAction {
12
13 /** The name of the action. */
14 public abstract String name();
15
16 /** The message of the action. */
17 public String message(Item item) {
18 return "";
19 }
20
21 /** The item click delay of the action. */
22 public int delay() {
23 return -1;
24 }
25
26 /** The execution method of the action. */
27 public boolean inventory(Player player, Item item, int opcode) {
28 return false;
29 }
30
31 public boolean equipment(Player player, Item item, int opcode) {
32 return false;
33 }
34
35 public boolean itemOnItem(Player player, Item first, Item second) {
36 return false;
37 }
38
39 public boolean drop(Player player, Item item) {
40 return false;
41 }
42
43 @Override
44 public String toString() {
45 return String.format("Action=%s", name());
46 }
47
48}
Handles executing an item action.
boolean equipment(Player player, Item item, int opcode)
abstract String name()
The name of the action.
boolean drop(Player player, Item item)
String message(Item item)
The message of the action.
int delay()
The item click delay of the action.
boolean itemOnItem(Player player, Item first, Item second)
boolean inventory(Player player, Item item, int opcode)
The execution method of the action.
This class represents a character controlled by a player.
Definition Player.java:125
The container class that represents an item that can be interacted with.
Definition Item.java:21