From 4e931a07bbc8a39df44b00297cc00b15d439a11f Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 2 Sep 2024 00:02:10 +0100 Subject: [PATCH] feat: add test command with block command --- src/endstone_test/command_executor.py | 3 +++ src/endstone_test/event_listener.py | 7 +++---- src/endstone_test/plugin.py | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/endstone_test/command_executor.py b/src/endstone_test/command_executor.py index 52be17c..281142a 100644 --- a/src/endstone_test/command_executor.py +++ b/src/endstone_test/command_executor.py @@ -90,4 +90,7 @@ def on_command(self, sender: CommandSender, command: Command, args: list[str]) - elif test_type == "kick": sender.kick("kick is working!") + case ["block", *rest]: + sender.send_message(str(rest)) + return True diff --git a/src/endstone_test/event_listener.py b/src/endstone_test/event_listener.py index 2b9264f..d4071a4 100644 --- a/src/endstone_test/event_listener.py +++ b/src/endstone_test/event_listener.py @@ -73,8 +73,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.type} block using {event.item.type} item" - f" at location {event.block.location} on the {event.block_face} face") + f"{event.player.name} interacts with {event.block} (face={event.block_face}) using {event.item.type} item") @event_handler def on_player_interact_actor(self, event: PlayerInteractActorEvent): @@ -106,12 +105,12 @@ def on_actor_teleport(self, event: ActorTeleportEvent): @event_handler def on_block_break(self, event: BlockBreakEvent): - self._plugin.logger.info(f"{event.player.name} breaks a block {event.block.type} at {event.block.location}") + self._plugin.logger.info(f"{event.player.name} breaks a block {event.block}") @event_handler def on_block_placed(self, event: BlockPlaceEvent): self._plugin.logger.info( - f"{event.player.name} places a block against {event.block_against.type} at {event.block.location} (was {event.block.type})") + f"{event.player.name} places a block against {event.block_against} (was {event.block})") @event_handler def on_thunder_change(self, event: ThunderChangeEvent): diff --git a/src/endstone_test/plugin.py b/src/endstone_test/plugin.py index 8a5f5f5..55339ea 100644 --- a/src/endstone_test/plugin.py +++ b/src/endstone_test/plugin.py @@ -26,6 +26,7 @@ class EndstoneTest(Plugin): "/test (form) (message|action|modal)", "/test (sender)", "/test (player) (toast|kick)", + "/test (block) [blockStates: block_states]", ], "permissions": ["endstone_test.command.test"], }