An open API service indexing awesome lists of open source software.

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

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**