RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.event.EventDispatcher Class Reference
Collaboration diagram for com.runehive.content.event.EventDispatcher:

Public Member Functions

void dispatch (InteractionType type, EventHandler eventHandler)
 EventDispatcher (InteractionEvent interactionEvent)

Static Public Member Functions

static boolean execute (Player player, InteractionEvent event)

Private Attributes

final InteractionEvent interactionEvent

Detailed Description

Definition at line 7 of file EventDispatcher.java.

Constructor & Destructor Documentation

◆ EventDispatcher()

com.runehive.content.event.EventDispatcher.EventDispatcher ( InteractionEvent interactionEvent)

Definition at line 11 of file EventDispatcher.java.

11 {
12 this.interactionEvent = interactionEvent;
13 }

References interactionEvent.

Member Function Documentation

◆ dispatch()

void com.runehive.content.event.EventDispatcher.dispatch ( InteractionType type,
EventHandler eventHandler )

Definition at line 19 of file EventDispatcher.java.

19 {
20 if (interactionEvent.isHandled()) {
21 return;
22 }
23
24 if (interactionEvent.getType() == type) {
25 interactionEvent.setHandled(eventHandler.handle(interactionEvent));
26 }
27 }

References com.runehive.content.event.EventHandler.handle(), and interactionEvent.

Referenced by com.runehive.content.activity.Activity.onEvent(), and com.runehive.game.world.entity.skill.Skill.onEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute()

boolean com.runehive.content.event.EventDispatcher.execute ( Player player,
InteractionEvent event )
static

Definition at line 15 of file EventDispatcher.java.

15 {
16 return player.inActivity() && Activity.evaluate(player, it -> it.onEvent(player, event)) || player.skills.onEvent(event);
17 }

References com.runehive.content.activity.Activity.evaluate(), com.runehive.game.world.entity.mob.Mob.inActivity(), com.runehive.game.world.entity.skill.SkillManager.onEvent(), and com.runehive.game.world.entity.mob.Mob.skills.

Referenced by com.runehive.game.world.entity.mob.player.PlayerDeath.death(), com.runehive.net.packet.in.ItemContainerActionPacketListener.fifthAction(), com.runehive.net.packet.in.ItemContainerActionPacketListener.firstAction(), com.runehive.net.packet.in.ItemContainerActionPacketListener.fourthAction(), com.runehive.net.packet.in.ItemOptionPacketListener.handleFirstOption(), com.runehive.net.packet.in.UseItemPacketListener.handleItemOnItem(), com.runehive.net.packet.in.ButtonClickPacketListener.handlePacket(), com.runehive.net.packet.in.ItemOptionPacketListener.handleSecondOption(), com.runehive.net.packet.in.ItemOptionPacketListener.handleThirdOption(), com.runehive.game.world.entity.mob.npc.NpcDeath.postDeath(), com.runehive.game.world.entity.mob.player.Player.register(), com.runehive.net.packet.in.ItemContainerActionPacketListener.secondAction(), com.runehive.net.packet.in.ItemContainerActionPacketListener.sixthAction(), and com.runehive.net.packet.in.ItemContainerActionPacketListener.thirdAction().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ interactionEvent

final InteractionEvent com.runehive.content.event.EventDispatcher.interactionEvent
private

Definition at line 9 of file EventDispatcher.java.

Referenced by dispatch(), and EventDispatcher().


The documentation for this class was generated from the following file: