本文整理汇总了PHP中pocketmine\command\CommandSender::floor方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandSender::floor方法的具体用法?PHP CommandSender::floor怎么用?PHP CommandSender::floor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\command\CommandSender
的用法示例。
在下文中一共展示了CommandSender::floor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCommand
public function onCommand(CommandSender $i, Command $cmd, $label, array $sub)
{
$output = "[WorldEditor]";
if (!$i instanceof Player) {
return true;
}
switch ($cmd->getName()) {
case "/pos1":
$pos = $i->floor();
self::$pos[$i->getName()][0] = $pos;
$output .= "Pos1 지점을 선택했어요 ({$pos->x}, {$pos->y}, {$pos->z})";
break;
case "/pos2":
$pos = $i->floor();
self::$pos[$i->getName()][1] = $pos;
$output .= "Pos2 지점을 선택했어요 ({$pos->x}, {$pos->y}, {$pos->z})";
break;
case "/set":
if (!isset($sub[0])) {
$output .= "사용법: //set <id[:meta]>";
break;
}
if (!isset(self::$pos[$i->getName()]) or count(self::$pos[$i->getName()]) < 2) {
$output .= "지역을 먼저 설정해주세요";
break;
}
$set = explode(":", $sub[0]);
$block = self::$pos[$i->getName()];
$endX = max($block[0]->x, $block[1]->x);
$endY = max($block[0]->y, $block[1]->y);
$endZ = max($block[0]->z, $block[1]->z);
$startX = min($block[0]->x, $block[1]->x);
$startY = min($block[0]->y, $block[1]->y);
$startZ = min($block[0]->z, $block[1]->z);
$output .= "블럭 설정을 시작했어요";
if ($this->getData("debug", false)) {
self::core()->getLogger()->info("[WorldEditor]{$i->getName()}님이 블럭설정을 시작했어요");
}
$callback = "setBlock";
$params = [$startX, $startY, $startZ, $endX, $endY, $endZ, Block::get($set[0], isset($set[1]) ? $set[1] : 0, $i->getPosition()), $i];
break;
case "/replace":
if (!isset($sub[0]) or !isset($sub[1])) {
$output .= "사용법: //replace <(선택)id[:meta]> <(바꿀)id[:meta>]";
break;
}
if (!isset(self::$pos[$i->getName()]) or count(self::$pos[$i->getName()]) < 2) {
$output .= "지역을 먼저 설정해주세요";
break;
}
$get = explode(":", $sub[0]);
$set = explode(":", $sub[1]);
$block = self::$pos[$i->getName()];
$endX = max($block[0]->x, $block[1]->x);
$endY = max($block[0]->y, $block[1]->y);
$endZ = max($block[0]->z, $block[1]->z);
$startX = min($block[0]->x, $block[1]->x);
$startY = min($block[0]->y, $block[1]->y);
$startZ = min($block[0]->z, $block[1]->z);
$output .= "블럭 변경을 시작했어요";
if ($this->getData("debug", false)) {
self::core()->getLogger()->info("[WorldEditor]{$i->getName()}님이 블럭변경을 시작했어요");
}
$callback = "replaceBlock";
$params = [$startX, $startY, $startZ, $endX, $endY, $endZ, Block::get($get[0], isset($get[1]) ? $get[1] : 0, $i->getPosition()), Block::get($set[0], isset($set[1]) ? $set[1] : 0, $i->getPosition()), $i];
break;
case "/undo":
if (!isset(self::$pos[$i->getName()]) or count(self::$pos[$i->getName()]) < 2) {
$output .= "지역을 먼저 설정해주세요";
break;
}
$block = self::$pos[$i->getName()];
$endX = max($block[0]->x, $block[1]->x);
$endY = max($block[0]->y, $block[1]->y);
$endZ = max($block[0]->z, $block[1]->z);
$startX = min($block[0]->x, $block[1]->x);
$startY = min($block[0]->y, $block[1]->y);
$startZ = min($block[0]->z, $block[1]->z);
$output .= "블럭을 되돌리는 중입니다";
if ($this->getData("debug", false)) {
self::core()->getLogger()->info("[WorldEditor]{$i->getName()}님이 블럭을 복구하기 시작했어요");
}
$callback = "undoBlock";
$params = [$startX, $startY, $startZ, $endX, $endY, $endZ, $i];
break;
case "/redo":
if (!isset(self::$pos[$i->getName()]) or count(self::$pos[$i->getName()]) < 2) {
$output .= "지역을 먼저 설정해주세요";
break;
}
$block = self::$pos[$i->getName()];
$endX = max($block[0]->x, $block[1]->x);
$endY = max($block[0]->y, $block[1]->y);
$endZ = max($block[0]->z, $block[1]->z);
$startX = min($block[0]->x, $block[1]->x);
$startY = min($block[0]->y, $block[1]->y);
$startZ = min($block[0]->z, $block[1]->z);
$output .= "블럭 설정을 시작했어요";
if ($this->getData("debug", false)) {
self::core()->getLogger()->info("[WorldEditor]{$i->getName()}님이 복구한 블럭을 되돌리기 시작했어요");
//.........这里部分代码省略.........