Overview

Namespaces

  • aliuly
    • common
      • selectors
    • loader
  • xPaw

Classes

  • aliuly\common\ArmorItems
  • aliuly\common\BasicCli
  • aliuly\common\BasicHelp
  • aliuly\common\BasicPlugin
  • aliuly\common\ChatSession
  • aliuly\common\Cmd
  • aliuly\common\CmdSelector
  • aliuly\common\ExpandVars
  • aliuly\common\FastTransfer
  • aliuly\common\FileUtils
  • aliuly\common\FreezeSession
  • aliuly\common\GetMotd
  • aliuly\common\GetMotdAsyncTask
  • aliuly\common\InvisibleSession
  • aliuly\common\InvUtils
  • aliuly\common\ItemName
  • aliuly\common\mc
  • aliuly\common\mc2
  • aliuly\common\MoneyAPI
  • aliuly\common\MPMU
  • aliuly\common\Npc
  • aliuly\common\PermUtils
  • aliuly\common\PluginAsyncTask
  • aliuly\common\PluginCallbackTask
  • aliuly\common\PMScript
  • aliuly\common\QueryAsyncTask
  • aliuly\common\Rcon
  • aliuly\common\RconTask
  • aliuly\common\selectors\All
  • aliuly\common\selectors\AllEntity
  • aliuly\common\selectors\BaseSelector
  • aliuly\common\selectors\Random
  • aliuly\common\Session
  • aliuly\common\ShieldSession
  • aliuly\common\ShoppingCart
  • aliuly\common\SignUtils
  • aliuly\common\SkinUtils
  • aliuly\common\SpySession
  • aliuly\common\SubCommandMap
  • aliuly\common\TPUtils
  • aliuly\loader\Main
  • xPaw\MinecraftQuery

Exceptions

  • xPaw\MinecraftQueryException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace aliuly\common;
 3: use aliuly\common\PluginAsyncTask;
 4: use pocketmine\plugin\Plugin;
 5: use pocketmine\Server;
 6: use aliuly\common\Rcon;
 7: //
 8: // We can not localize this as it is running on a different thread...
 9: //
10: 
11: /**
12:  * Rcon implementation as an async task...
13:  */
14: class RconTask extends PluginAsyncTask {
15:     protected $server;
16:     protected $cmd;
17:     protected $sock;
18: 
19:     /**
20:      * @param Plugin $owner
21:      * @param str $callable - method from $owner to call
22:      * @param array $remote - Array containing $host,$port,$auth data
23:      * @param str $cmd - remote command to execute
24:    * @param array $args - extra arguments to pass to callback method
25:      */
26:     public function __construct(Plugin $owner, $callable, array $remote, $cmd, array $args = []){
27:         parent::__construct($owner,$callable,$args);
28:         $this->server = $remote;
29:         $this->cmd = $cmd;
30:         $this->sock = false;
31:     }
32:     private function close($msg = "") {
33:         $this->setResult($msg);
34:         if ($this->sock) {
35:             fclose($this->sock);
36:             $this->sock = false;
37:         }
38:     }
39:     public function onRun() {
40:         list($host,$port,$auth) = $this->server;
41:         $ret = Rcon::connect($host,$port,$auth);
42:         if (!is_array($ret)) {
43:             $this->close($ret);
44:             return ;
45:         }
46:         list($this->sock,$id) = $ret;
47: 
48:         $ret = Rcon::cmd($this->cmd,$this->sock,$id);
49:         $this->close($ret);
50:     }
51: }
52: 
API documentation generated by ApiGen