mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
docs: Add docs about event system in FancyCore
This commit is contained in:
29
docs/src/fancycore/api/events.md
Normal file
29
docs/src/fancycore/api/events.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
icon: dot
|
||||||
|
order: 9
|
||||||
|
---
|
||||||
|
|
||||||
|
# Events
|
||||||
|
|
||||||
|
FancyCore has its own event system that allows you to listen to various events that happen in the FancyCore system.
|
||||||
|
|
||||||
|
## Registering an event listener
|
||||||
|
|
||||||
|
Example for registering a listener for the `PlayerReportedEvent`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
EventService eventService = FancyCore.get().getEventService();
|
||||||
|
eventService.registerListener(PlayerReportedEvent.class, (event) -> {
|
||||||
|
System.out.println("PlayerReportedEvent fired with report id: " + event.getReport().id());
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available events
|
||||||
|
|
||||||
|
### Player events
|
||||||
|
|
||||||
|
| Event | Description |
|
||||||
|
|-----------------------|-------------------------------------------------------------------------------|
|
||||||
|
| `PlayerModifiedEvent` | Event fired when a player's data is modified (through FancyPlayer's setters). |
|
||||||
|
| `PlayerReportedEvent` | Fired when a player is reported. |
|
||||||
|
| `PlayerPunishedEvent` | Fired when a player receives a punishment (warning, kick, mute or ban). |
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
icon: dot
|
icon: dot
|
||||||
|
order: 10
|
||||||
---
|
---
|
||||||
|
|
||||||
# Getting started
|
# Getting started
|
||||||
|
|||||||
Reference in New Issue
Block a user