Installation command
!!MCDR plugin install async_rcon
Author
Repository
Synced at
...
Last update
...
Latest version
Total downloads
19
Back to catalogue
AsyncRconClient
A simple async rcon client.
Usage
Run async_rcon/__init__.py
directly.
With MCDR
Install plugin from release.
After plugin submitted to MCDR PluginCatalogue, you can install by
!!MCDR plg install async_rcon [--confirm]
Rcon client will start automatically when plugin is loading.
Use @rcon <command>
to execute commands and get responses from target rcon server.
Use @rcon connect
to start rcon client, use @rcon disconnect
to close it.
Use @rcon reload
to reload plugin, equal to !!MCDR plg reload async_rcon
API
Can be imported in MCDR plugins. If you want to use this module without MCDR, you should just import from async_rcon/__init__.py
.
import async_rcon.entry as rcon
from mcdreforged.api.all import *
def on_load(server: PluginServerInterface, _prev_module):
pass
async def main(server: PluginServerInterface):
if rcon.rcon_task:
response = rcon.loop.create_task(rcon.client.send_command("list"))
await response
server.logger.info(f"[Response] \n{response.result()}")
# Following is some safe way to control rcon client
server.execute_command("@rcon disconnect", ConsoleCommandSource) # Disconnect rcon client if you want.
server.execute_command("@rcon connect", ConsoleCommandSource) # Reconnect rcon client if you want.
If you want to connect or disconnect rcon client by directly call the functions in async_rcon.entry, you should read source code carefully because it may dangerous.
And if any bugs found plz issue them, I'll be glad to fix.
License & Credits
This project is licensed under the GPL-3.0 License.
Used projects:
- RconConnection: LGPL-3.0
A built-in module in MCDReforged.
Thanks the following projects for documentation support
Introduction source: README.md