Skip to content

Commit

Permalink
feat: add tests for player experience
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jun 18, 2024
1 parent cbcb157 commit 6262362
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/endstone_test/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def send_welcome_message(player_name: str) -> None:
event.player.allow_flight = True
assert event.player.allow_flight is True

current_exp_lvl = event.player.exp_level
event.player.give_exp_levels(2)
assert event.player.exp_level == current_exp_lvl + 2
assert 0.0 <= event.player.exp <= 1.0

@event_handler
def on_player_death(self, event: PlayerDeathEvent):
# TODO: add player.is_dead check
Expand Down
3 changes: 2 additions & 1 deletion src/endstone_test/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ def send_debug_message(self):
f"Velocity: {player.velocity}\n"
f"Dimension: {player.location.dimension.name}\n"
f"InWater: {player.is_in_water}, InLava: {player.is_in_lava}\n"
f"OnGround: {player.is_on_ground}, MayFly: {player.allow_flight}, Flying: {player.is_flying}"
f"OnGround: {player.is_on_ground}, MayFly: {player.allow_flight}, Flying: {player.is_flying}\n"
f"Exp: {player.exp}, Lv: {player.exp_level}"
)

0 comments on commit 6262362

Please sign in to comment.