Implemented a new, more flexible event listener system, allowing for the elimination of excessive hardcoding.
This is the mechanics of arbitrary event listeners. In order for third-party developers to add their own implementations of reactions to game and other events, a mechanism for arbitrary listeners is introduced.
Example Implementation:
Let's say an action occurs in your handler, such as issuing an augmentation, granting hero status, or any other action you have implemented.
The fireEvent method is responsible for generating an event and passing it to all registered listeners.
Example: GameServer.getInstance().getListeners().fireEvent("activateHero", player, player.getActiveClassId());
Here, we pass 2 arguments as objects: player and player.getActiveClassId(). The number of arguments is not limited.
Thus, this code provides a flexible and extendable event management system, allowing for the dynamic addition and invocation of listeners for various event types.
Visualization of listener registration usage:
How to use the registered listener:
lucera2.com
This is the mechanics of arbitrary event listeners. In order for third-party developers to add their own implementations of reactions to game and other events, a mechanism for arbitrary listeners is introduced.
Example Implementation:
Let's say an action occurs in your handler, such as issuing an augmentation, granting hero status, or any other action you have implemented.
The fireEvent method is responsible for generating an event and passing it to all registered listeners.
- Parameters:
- eventType - the type of event that occurred.
- args - any number of arguments that will be passed to the event listeners.
Example: GameServer.getInstance().getListeners().fireEvent("activateHero", player, player.getActiveClassId());
Here, we pass 2 arguments as objects: player and player.getActiveClassId(). The number of arguments is not limited.
Thus, this code provides a flexible and extendable event management system, allowing for the dynamic addition and invocation of listeners for various event types.
Visualization of listener registration usage:

How to use the registered listener:
activateHero event trigger/Выполнение своих действий получение геройства
[EN][RU] Added a new event listener that allows the player to operate at will when receiving heroism. For example, I am attaching a code that sends a message for issuing 1 adena if the player’s class is Duelist and 2 adena for everyone else. You can add any mechanics and additions you like. I...