https://github.com/cortexpe/pmrcon
A PocketMine-MP Virion to easily send RCON Commands to remote Minecraft / PocketMine-MP Servers
https://github.com/cortexpe/pmrcon
Last synced: about 2 months ago
JSON representation
A PocketMine-MP Virion to easily send RCON Commands to remote Minecraft / PocketMine-MP Servers
- Host: GitHub
- URL: https://github.com/cortexpe/pmrcon
- Owner: CortexPE
- License: lgpl-3.0
- Created: 2018-12-23T10:48:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T16:05:28.000Z (about 5 years ago)
- Last Synced: 2025-05-08T03:49:58.110Z (about 2 months ago)
- Language: PHP
- Size: 36.1 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PMRCON
![]()
![]()
A PocketMine-MP Virion to easily send RCON Commands to remote Minecraft / PocketMine-MP Servers
# Usage:
Installation is easy, you may get a compiled phar [here](https://poggit.pmmp.io/ci/CortexPE/PMRCON/~) or integrate the virion itself into your plugin.This virion is purely object oriented. So, to use it you'll just have to import the `RCONClient` object.
## Basic Usage:
### Import the classes
You'll need to import this class in order to easily use it within our code.
```php
getLogger());
$rconClient = new RCONClient("tcp://127.0.0.1", 19133, "SuperStronkPassword", 2, Server::getInstance()->getLogger());
```
### Sending the commands
You can easily send commands to the remote server now! This will enqueue the command to the `RCONClientThread`s command queue then send it to the remote server, whenever possible.
```php
$rconClient->sendCommand("say Hello World!");
```
### Stopping the client
This is necessary for a smooth, clean shutdown of the server, This should usually be done on your plugin's `onDisable` method.Executing it will stop the thread's loop, then close the socket used to connect to the remote server.
```php
$rconClient->stop();
```
Easy as 1-2-3! :tada:
# Sample Code used to test this API earlier:
```php
$rconClient = new RCONClient("tcp://127.0.0.1", 19133, "ILYErinUwU", 2, Server::getInstance()->getLogger());
$rconClient->sendCommand("say IT WORKS!");
$this->getScheduler()->scheduleDelayedTask(new ClosureTask(function(int $currentTick) use ($rconClient) : void {
$rconClient->stop();
}), 100); // Stop the RCON Client after 5 seconds
```
-----
**This API was made with :heart: by CortexPE, Enjoy!~ :3**