本文整理汇总了PHP中pocketmine\command\CommandSender::getLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandSender::getLocation方法的具体用法?PHP CommandSender::getLocation怎么用?PHP CommandSender::getLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\command\CommandSender
的用法示例。
在下文中一共展示了CommandSender::getLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(CommandSender $sender, $label, array $params)
{
if (!$this->plugin->isEnabled()) {
return false;
}
if (!$sender instanceof Player) {
$sender->sendMessage("Please use the command in-game");
return true;
}
// Get current op location
$playerLocation = $sender->getLocation();
$this->plugin->getLogger()->info("location" . $sender->getLocation());
// Add the arena
$this->arenaManager->referenceNewArena($playerLocation);
// Notify the op
$sender->sendMessage("[1vs1] A new arena has been created at your position ! There are " . $this->arenaManager->getNumberOfArenas() . " arenas.");
return true;
}
示例2: onCommand
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
switch ($command->getName()) {
case "prison":
if ($sender instanceof Player) {
if (count($args) == "help") {
// prison random
// prison exit
// prison arena
// prison kit
// prison info
$sender->sendMessage(TextFormat::GREEN . "Prison command" . TextFormat::YELLOW . "\n" . "use /prison random -> teleport to random cell" . "\n" . "/prison exit -> teleport to lobby" . "/n" . "/prison arena -> teleport to arena pvp" . "/n" . "/prison kit <name> -> give kit for survival" . "/n" . "/prison info <kit> -> give info in chat a player");
} else {
if (count($args) == "random") {
$event->getPlayer()->teleport($this->getRandomLocation());
} else {
if (count($args) == "exit") {
$this->getServer()->getPlayer()->teleport(new Vector3($this->yml["lobby_x"], $this->yml["lobby_y"], $this->yml["lobby_z"]));
} else {
if (count($args) == "arena") {
$this->getServer()->getPlayer()->teleport(new Vector3($this->yml["arena_x"], $this->yml["arena_y"], $this->yml["arena_z"]));
} else {
if (count($args) == "kit") {
if ($this->getServer()->getPlayer() == "robozeri" || "owner" || "altro") {
$sword = Item::get(276, 1, 1);
$armor1 = Item::get(310, 1, 1);
$armor2 = Item::get(311, 1, 1);
$armor3 = Item::get(312, 1, 1);
$armor4 = Item::get(313, 1, 1);
$player->getInventory()->addItem($sword);
$player->getInventory()->addItem($armor1);
$player->getInventory()->addItem($armor2);
$player->getInventory()->addItem($armor3);
$player->getInventory()->addItem($armor4);
} else {
$sword = Item::get(276, 1, 1);
$armor1n = Item::get(310, 1, 1);
$armor2n = Item::get(311, 1, 1);
$armor3n = Item::get(312, 1, 1);
$armor4n = Item::get(313, 1, 1);
$player->getInventory()->addItem($sword);
$player->getInventory()->addItem($armor1n);
$player->getInventory()->addItem($armor2n);
$player->getInventory()->addItem($armor3n);
$player->getInventory()->addItem($armor4n);
}
}
}
}
}
}
return true;
}
break;
case "setcell":
$this->addNewLocation($sender->getLocation());
$sender->sendMessage("added the xyz!");
$sender->sendMessage("" . $this->getNumberOfPositions() . "POS.");
return true;
break;
}
}
示例3: onCommand
/**
=+=+=+=+=+=+=+=
>>>>> COMMANDS
=+=+=+=+=+=+=+=
**/
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
switch ($command->getName()) {
//rtpset command to set a random spawn position
case "mtpset":
$this->addNewLocation($sender->getLocation());
$sender->sendMessage("[MultiTP] A new teleportation target was added at your position !");
$sender->sendMessage("[MultiTP] There are : " . $this->getNumberOfPositions() . " teleportation targets.");
return true;
//rtpreset command to reset all random spawn positions
//rtpreset command to reset all random spawn positions
case "mtpreset":
$this->resetPositions();
$sender->sendMessage("[MultiTP] All random spawn positions have been removed!");
return true;
//rtpinfo to have all informations about the plugin :)
//rtpinfo to have all informations about the plugin :)
case "mtpinfo":
$sender->sendMessage("[MultiTP] This plugin was created by Minifixio. I've got a Youtube channel, you can subscribe :)");
$sender->sendMessage("[MultiTP] Commands : /mtpset ( to set a random spawn position ) and /mtpreset ( to reset all random spawn positions.");
$sender->sendMessage("[MultiTP] The default teleporting block is the sponge block, but you can change this in the code of the plugin.");
$sender->sendMessage("[MultiTP] Perhaps there will be an update to modify the block of teleportation.");
return true;
$sender->sendMessage("[MultiTP] If you have suggestions or bugs, please report this to me !");
default:
return false;
}
}