本文整理汇总了PHP中pocketmine\level\Position::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Position::isValid方法的具体用法?PHP Position::isValid怎么用?PHP Position::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\level\Position
的用法示例。
在下文中一共展示了Position::isValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: teleport
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);
}
}
}
示例2: putPosition
public function putPosition(Position $position)
{
$this->putLong($position->x);
$this->putShort($position->y);
$this->putLong($position->z);
$this->putString($position->isValid() ? $position->getLevel()->getName() : "");
}
示例3: hasValidSpawnPosition
/**
* @return bool
*/
public function hasValidSpawnPosition() : bool
{
return $this->spawnPosition instanceof WeakPosition and $this->spawnPosition->isValid();
}