diff --git a/delayexe/api.py b/delayexe/api.py index 3f42b6d..30c13ef 100644 --- a/delayexe/api.py +++ b/delayexe/api.py @@ -8,7 +8,7 @@ from .utils import * __all__ = [ - 'ServerNotStartError', + 'ServerNotRunningError', 'add_playerlist_handler', 'add_delay_task', 'clear_delay_task', 'get_playerlist_data' ] @@ -22,7 +22,7 @@ 'forge_handler': (re.compile(r'There are (\d+)/(\d+) players online.*'), 1, 2) } -class ServerNotStartError(RuntimeError): +class ServerNotRunningError(RuntimeError): def __init__(self): super().__init__('Server is not start') @@ -54,7 +54,7 @@ def _trigger_delay_list(server: MCDR.ServerInterface): def get_playerlist_data(server: MCDR.ServerInterface): with playerlist_data: if not server.is_server_startup(): - raise ServerNotStartError() + raise ServerNotRunningError() if playerlist_data.d[1]: playerlist_data.d[1] = False server.execute('list') @@ -91,4 +91,4 @@ def on_player_left(server: MCDR.PluginServerInterface, player: str): with player_empty: player_empty.d = True _trigger_delay_list(server) - server.dispatch_event(ON_PLAYER_EMPTY, []) + server.dispatch_event(ON_LAST_PLAYER_LEAVE, []) diff --git a/delayexe/constants.py b/delayexe/constants.py index 834965d..33df57a 100644 --- a/delayexe/constants.py +++ b/delayexe/constants.py @@ -2,8 +2,8 @@ import mcdreforged.api.all as MCDR __all__ = [ - 'ON_PLAYER_EMPTY', 'ON_FIRST_PLAYER_JOIN' + 'ON_LAST_PLAYER_LEAVE', 'ON_FIRST_PLAYER_JOIN' ] -ON_PLAYER_EMPTY = MCDR.LiteralEvent('delayexe.player.empty') +ON_LAST_PLAYER_LEAVE = MCDR.LiteralEvent('delayexe.player.leave.last') ON_FIRST_PLAYER_JOIN = MCDR.LiteralEvent('delayexe.player.join.first') diff --git a/mcdreforged.plugin.json b/mcdreforged.plugin.json index 3f02592..03cf409 100644 --- a/mcdreforged.plugin.json +++ b/mcdreforged.plugin.json @@ -1,6 +1,6 @@ { "id": "delayexe", - "version": "1.2.1", + "version": "1.2.2", "name": "Delay Exe", "description": { "en_us": "Delay execute command until all player have left",