Skip to content

Commit

Permalink
test: add tests for player.perform_command
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Sep 17, 2024
1 parent dfc9be7 commit 6a24262
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/endstone_test/command_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def on_command(self, sender: CommandSender, command: Command, args: list[str]) -
sender.send_message("You are the console!")
else:
sender.send_error_message(f"Unknown sender: {sender.__class__}")
return False

case ["player", ("toast" | "title" | "kick") as test_type]:
if not isinstance(sender, Player):
Expand Down
2 changes: 1 addition & 1 deletion src/endstone_test/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def on_player_join(self, event: PlayerJoinEvent) -> None:
@event_handler
def on_player_interact(self, event: PlayerInteractEvent):
self._plugin.logger.info(
f"{event.player.name} interacts with {event.block} (face={event.block_face}) using {event.item.type} item")
f"{event.player.name} interacts with {event.block} (face={event.block_face}) using {event.item} item")

@event_handler
def on_player_interact_actor(self, event: PlayerInteractActorEvent):
Expand Down
4 changes: 4 additions & 0 deletions src/endstone_test/tests/on_player_join/test_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ def test_player_scoreboard(player: Player, server: Server):

player.scoreboard = server.scoreboard
assert player.scoreboard is server.scoreboard


def test_run_command(player: Player):
assert player.perform_command("test sender")

0 comments on commit 6a24262

Please sign in to comment.