Skip to content

Commit

Permalink
refactor: use the new scheduler api
Browse files Browse the repository at this point in the history
wu-vincent committed Jul 24, 2024
1 parent ce1bb0d commit 9ed0a61
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/endstone_test/event_listener.py
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ def send_welcome_message(player_name: str) -> None:
player.send_message(Translatable("commands.give.success", ["Secret Item", "233", "Secret Man"]))
player.send_title("Welcome!", player_name)

self.server.scheduler.run_task_later(self._plugin, partial(send_welcome_message, event.player.name), delay=20)
self.server.scheduler.run_task(self._plugin, partial(send_welcome_message, event.player.name), delay=20)

assert event.player in self.server.online_players
assert self.server.get_player(event.player.name) is event.player
4 changes: 2 additions & 2 deletions src/endstone_test/plugin.py
Original file line number Diff line number Diff line change
@@ -60,8 +60,8 @@ def on_enable(self) -> None:
assert level.get_dimension(dimension.name) is dimension

self.server.broadcast_message("Hello!")
self.server.scheduler.run_task_timer(self, self.send_debug_message, delay=0, period=10)
self.server.scheduler.run_task_timer(self, self.update_player_pings, delay=0, period=20)
self.server.scheduler.run_task(self, self.send_debug_message, period=10)
self.server.scheduler.run_task(self, self.update_player_pings, period=20)

self.objective = self.server.scoreboard.get_objective("ping")
if not self.objective:

0 comments on commit 9ed0a61

Please sign in to comment.