Skip to content

Commit b940539

Browse files
committed
Event interfaces refactoring
1 parent 06bba56 commit b940539

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

src/main/java/io/luna/game/event/impl/ControllableEvent.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@
44
import io.luna.game.model.mob.controller.PlayerController;
55

66
/**
7-
* Represents an {@link Event} type that can be terminated by a {@link PlayerController} before being posted.
7+
* Represents an {@link Event} type that may be intercepted, modified, or cancelled by a {@link PlayerController}
8+
* before being posted.
9+
* <p>
10+
* When an event implements this interface, it signals that the player's active controller has authority to prevent
11+
* the event from executing.
12+
* <p>
13+
* This is commonly used for:
14+
* <ul>
15+
* <li>Restricting actions during minigames.</li>
16+
* <li>Contextual modifications.</li>
17+
* <li>Enforcing contextual gameplay rules.</li>
18+
* </ul>
19+
* <p>
20+
* This interface does not define behavior directly; it acts as a semantic contract recognized by the event dispatch
21+
* system.
822
*
923
* @author lare96
1024
*/

src/main/java/io/luna/game/event/impl/InteractableEvent.java

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,42 @@
55
import io.luna.game.model.mob.InteractionTask;
66

77
/**
8-
* Represents an {@link Event} type that needs to be posted within an {@link InteractionTask}. Events like this are
9-
* not posted until the interaction can be successfully completed.
8+
* Represents an {@link Event} type that require a target to be interacted with, before they are posted.
9+
* <p>
10+
* Events implementing this interface are not dispatched immediately. Instead, they are wrapped in an
11+
* {@link InteractionTask}, which handles movement and distance checks. The event is only posted once the
12+
* interaction requirements (such as proximity) are successfully satisfied.
13+
* <p>
14+
* Typical use cases include:
15+
* <ul>
16+
* <li>Clicking an NPC that requires walking to it first.</li>
17+
* <li>Interacting with an object that must be reached.</li>
18+
* <li>Casting a spell on an entity.</li>
19+
* </ul>
1020
*
1121
* @author lare96
1222
*/
1323
public interface InteractableEvent {
1424

1525
/**
16-
* @return The target of this interactable event.
26+
* Returns the interaction target for this event.
27+
* <p>
28+
* The returned {@link Entity} is used by the {@link InteractionTask} to determine pathfinding, proximity checks,
29+
* and completion conditions.
30+
*
31+
* @return The target entity of the interaction.
1732
*/
1833
Entity target();
1934

2035
/**
21-
* The interaction distance.
36+
* Returns the required interaction distance.
37+
* <p>
38+
* This represents the maximum allowed tile distance between the actor and the {@link #target()} before the
39+
* interaction is considered valid.
40+
* <p>
41+
* The default value is {@code 1}, meaning the actor must stand adjacent to the target.
42+
*
43+
* @return The required interaction distance.
2244
*/
2345
default int distance() {
2446
return 1;

0 commit comments

Comments
 (0)