Example #1
1
 public function teleport(Player $player)
 {
     if ($this->message !== null) {
         $player->sendMessage($this->message);
     }
     if ($this->position instanceof Position) {
         if ($this->position->isValid()) {
             if ($this->position instanceof WeakPosition) {
                 $this->position->updateProperties();
             }
             //Server::getInstance()->getLogger()->info($this->position->x . " : " . $this->position->y . " : " . $this->position->z);
             $player->teleport($this->position);
         } else {
             $player->sendMessage($this->getApi()->executeTranslationItem("level-not-loaded-warp"));
         }
     } else {
         $plugin = $player->getServer()->getPluginManager()->getPlugin("FastTransfer");
         if ($plugin instanceof PluginBase && $plugin->isEnabled() && $plugin instanceof FastTransfer) {
             $plugin->transferPlayer($player, $this->address, $this->port);
         } else {
             $player->getServer()->getPluginManager()->getPlugin("SimpleWarp")->getLogger()->warning("In order to use warps tp other servers, you must install " . TextFormat::AQUA . "FastTransfer" . TextFormat::RESET . ".");
             $player->sendPopup(TextFormat::RED . "Warp failed!" . TextFormat::RESET);
         }
     }
 }