Skip to content

Commit

Permalink
feat: add an example of setting event handling priority
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Mar 23, 2024
1 parent 62ba844 commit 4bbfaab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/endstone_example/example_plugin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from endstone._internal.endstone_python import EventPriority
from endstone.command import Command, CommandSender
from endstone.event import ServerLoadEvent, event_handler
from endstone.plugin import Plugin
Expand Down Expand Up @@ -79,4 +80,8 @@ def on_command(self, sender: CommandSender, command: Command, args: list[str]) -

@event_handler
def on_server_load(self, event: ServerLoadEvent):
self.logger.info(f"{event.event_name} is passed to python plugin")
self.logger.info(f"{event.event_name} is passed to on_server_load")

@event_handler(priority=EventPriority.HIGH)
def on_server_load_2(self, event: ServerLoadEvent):
self.logger.info(f"{event.event_name} is passed to on_server_load_2. This will be called after on_server_load.")

0 comments on commit 4bbfaab

Please sign in to comment.