File tree Expand file tree Collapse file tree
content/docs/lynx/latest/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,11 +126,11 @@ Now that we have both the background and title done this is how it looks:
126126
127127![ Custom GUI Progress] ( https://cdn.undefinedcreations.com/lynx/display/custom-gui-progress.png )
128128
129- # Add Button Logic
129+ ` # Add Button Logic
130130
131131Next step is adding the button logic. First step to this is creating the visual of the button.
132132
133- # Visual Logic
133+ ### Visual Logic
134134
135135The button visual contains out of two entities, a ` BlockDisplay ` and ` TextDisplay ` . We will start by creating the ` BlockDisplay `
136136We will create it and then set the scale:
@@ -230,7 +230,7 @@ private fun addButton(location: Location) {
230230}
231231```
232232
233- # Interaction
233+ ### Interaction
234234Now that the visual is done we will work of the interaction of the button.
235235We will start by creating the ` Interaction ` entity and positioning it correctly:
236236
Original file line number Diff line number Diff line change @@ -51,7 +51,37 @@ class GameStateChangeEvent(
5151): LynxEvent() {}
5252```
5353
54- Now we have the custom event.
54+ ## Cancellable Event
55+
56+ If you want to make you event cancellable you need to change the extensions from ` LynxEvent ` to ` CancellableLynxEvent ` :
57+
58+ ``` java tab="Java"
59+ public class GameStateChangeEvent extends CancellableLynxEvent {
60+
61+ private final GameState oldState;
62+ private final GameState newState;
63+
64+ public GameStateChangeEvent (GameState oldState , GameState newState ) {
65+ this . oldState = oldState;
66+ this . newState = newState;
67+ }
68+
69+ public GameState getOldState () {
70+ return oldState;
71+ }
72+
73+ public GameState getNewState () {
74+ return newState;
75+ }
76+
77+ }
78+ ```
79+ ``` kotlin tab="Kotlin"
80+ class GameStateChangeEvent (
81+ val oldState : GameState ,
82+ val newState : GameState
83+ ): CancellableLynxEvent() {}
84+ ```
5585
5686# Calling Events
5787
You can’t perform that action at this time.
0 commit comments