Skip to content

Commit 4bbfaab

Browse files
committed
feat: add an example of setting event handling priority
1 parent 62ba844 commit 4bbfaab

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/endstone_example/example_plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from endstone._internal.endstone_python import EventPriority
12
from endstone.command import Command, CommandSender
23
from endstone.event import ServerLoadEvent, event_handler
34
from endstone.plugin import Plugin
@@ -79,4 +80,8 @@ def on_command(self, sender: CommandSender, command: Command, args: list[str]) -
7980

8081
@event_handler
8182
def on_server_load(self, event: ServerLoadEvent):
82-
self.logger.info(f"{event.event_name} is passed to python plugin")
83+
self.logger.info(f"{event.event_name} is passed to on_server_load")
84+
85+
@event_handler(priority=EventPriority.HIGH)
86+
def on_server_load_2(self, event: ServerLoadEvent):
87+
self.logger.info(f"{event.event_name} is passed to on_server_load_2. This will be called after on_server_load.")

0 commit comments

Comments
 (0)