Skip to content

Commit

Permalink
feat: add event handler for PlayerKickEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Sep 3, 2024
1 parent 802f7e7 commit bfabc7a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/endstone_test/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ def on_player_interact(self, event: PlayerInteractEvent):
def on_player_interact_actor(self, event: PlayerInteractActorEvent):
self._plugin.logger.info(f"{event.player.name} interacts with actor {event.actor.name}")

@event_handler
def on_player_kick(self, event: PlayerKickEvent) -> None:
self._plugin.logger.info(f"{event.player.name} has been kicked due to {event.reason}")
event.reason = ColorFormat.BOLD + event.reason

@event_handler
def on_player_quit(self, event: PlayerQuitEvent) -> None:
self.server.broadcast_message(ColorFormat.YELLOW + f"{event.player.name} left the game.")
Expand Down

0 comments on commit bfabc7a

Please sign in to comment.