Skip to content

Commit

Permalink
feat: add test command with block command
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Sep 1, 2024
1 parent c71be05 commit 4e931a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/endstone_test/command_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions src/endstone_test/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions src/endstone_test/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class EndstoneTest(Plugin):
"/test (form)<test: FormTestAction> (message|action|modal)<type: FormTestTypes>",
"/test (sender)<test: SenderTestAction>",
"/test (player)<test: PlayerTestAction> (toast|kick)<type: PlayerTestTypes>",
"/test (block)<test: BlockTestAction> <block: block> [blockStates: block_states]",
],
"permissions": ["endstone_test.command.test"],
}
Expand Down

0 comments on commit 4e931a0

Please sign in to comment.