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: //= api-features
 4: //: - FastTransfer work-around wrapper
 5: use pocketmine\Player;
 6: use pocketmine\network\RakLibInterface;
 7: use aliuly\common\mc;
 8: /**
 9:  * Fast Transfer related functions
10:  */
11: abstract class FastTransfer {
12:   /**
13:    * This will transfer a player and also add the workaround for players
14:    * lingering connections...
15:    * @param Player $player
16:    * @param str $address
17:    * @param int $port
18:    * @param str $message
19:    * @return bool
20:    */
21:   static public function transferPlayer(Player $player, $address, $port, $message = null) {
22:     $ft = $player->getServer()->getPluginManager()->getPlugin("FastTransfer");
23:     if ($ft === null) return false;
24:     if ($message === null) $message = mc::_("You are being transferred");
25:     $res = $ft->transferPlayer($player,$address,$port,$message);
26:     // find out the RakLib interface, which is the network interface that MCPE players connect with
27:     foreach($player->getServer()->getNetwork()->getInterfaces() as $interface){
28:       if ($interface instanceof RakLibInterface) {
29:         $raklib = $interface;
30:         break;
31:       }
32:     }
33:     if(!isset($rakLib)) return $res;
34:     // calculate the identifier for the player used by RakLib
35:     $identifier = $player->getAddress() . ":" . $player->getPort();
36: 
37:     // this method call is the most important one -
38:     // it sends some signal to RakLib that makes it think that the client
39:     // has clicked the "Quit to Title" button (or timed out). Some RakLib
40:     // internal stuff will then tell PocketMine that the player has quitted.
41:     $rakLib->closeSession($identifier, "transfer");
42:   }
43: }
44: 
API documentation generated by ApiGen