Пример #1
0
 /**
  * This method requires the key of the warp in order
  * to construct a warp object
  * @param $name
  * @param array $array
  * @return Warp
  * @throws \Exception
  */
 protected function warpFromData($name, array $array)
 {
     if (isset($array["level"]) && isset($array["x"]) && isset($array["y"]) && isset($array["z"]) && isset($array["public"])) {
         // This is an internal warp
         return new Warp($name, new Destination(new WeakPosition($array["x"], $array["y"], $array["z"], $array["level"])), $array["public"]);
     } elseif (isset($array["address"]) && isset($array["port"]) && isset($array["public"])) {
         return new Warp($name, new Destination($array["address"], $array["port"]), $array["public"]);
     }
     $this->api->getSimpleWarp()->getLogger()->critical("A warp with the name " . TextFormat::AQUA . $name . TextFormat::RESET . " is incomplete. It will be removed automatically when your server stops.");
     return null;
 }
Пример #2
0
 public function __construct(SimpleWarpAPI $api)
 {
     parent::__construct($api->executeTranslationItem("addwarp-cmd"), $api->executeTranslationItem("addwarp-desc"), $api->executeTranslationItem("addwarp-usage"));
     $this->api = $api;
 }