本文整理汇总了PHP中pocketmine\command\Command::tellWrongUsage方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::tellWrongUsage方法的具体用法?PHP Command::tellWrongUsage怎么用?PHP Command::tellWrongUsage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\command\Command
的用法示例。
在下文中一共展示了Command::tellWrongUsage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCommand
public function onCommand(Command $cmd, array $args, Session $session)
{
switch ($cmd->getName()) {
case "friend":
if (!isset($args[0])) {
$session->tell("Usage of /friend:\n" . "/friend add <name>: Add <name> to your friend list if he/she requested you to be friend, or send him/her a request if he/she didn't.\n" . "/friend remove <name>: If you are friends with <name>, you are no longer friends. If one of you sent a friend request to another, the request will be cancelled/denied. If you are not related at all, no warnings will be shown.\n" . "/friend list: View your friend list.\n" . "/friend inbox: View all requests sent to you." . "/friend outbox: View all requests you sent to other players.");
return;
}
$session->tell($this->onFriendCommand($args, $session));
return;
case "tpa":
if (Settings::kitpvp_isSafeArea($session->getPlayer())) {
$session->tell("You can't accept teleport requests from spawn!");
return;
}
if (!isset($args[0])) {
if ($cmd instanceof oldSessionCommand) {
$cmd->tellWrongUsage($session);
}
return;
}
$other = $this->getMain()->getSessions()->getSession($on = array_shift($args));
if (!$other instanceof Session) {
$session->tell("Player {$on} not found!");
return;
}
if (!isset($this->playerData[$other->getUID()])) {
$session->tell("{$other} is no longer in KitPvP, so he can't teleport!");
return;
}
if ($this->playerData[$other->getUID()]->tpRequestTo !== $session->getUID()) {
$session->tell("{$other} cancelled/didn't send his teleport request to you.");
return;
}
$this->playerData[$other->getUID()]->tpRequestTo = -1;
$other->tell("You are going to be teleported to {$session} in a few seconds. Hold the handrail!");
$session->tell("{$other} is going to be teleported to you in a few seconds. Don't stand near a cliff!");
$this->getMain()->getServer()->getScheduler()->scheduleDelayedTask(new CallbackPluginTask($this->getMain(), function () use($session, $other) {
if ($session->getPlayer() instanceof Player and $session->getPlayer()->isOnline() and $other->getPlayer() instanceof Player and $other->getPlayer()->isOnline()) {
// don't quit! don't crash me!
$other->teleport($session->getPlayer());
}
}), 100);
return;
case "tpd":
if (!isset($args[0])) {
if ($cmd instanceof oldSessionCommand) {
$cmd->tellWrongUsage($session);
}
return;
}
$other = $this->getMain()->getSessions()->getSession($on = array_shift($args));
if (!$other instanceof Session) {
$session->tell("Player {$on} not found!");
return;
}
if (!isset($this->playerData[$other->getUID()])) {
$session->tell("{$other} is no longer in KitPvP, so you don't have to do the dirty job to deny it! :D");
return;
}
if ($this->playerData[$other->getUID()]->tpRequestTo !== $session->getUID()) {
$session->tell("{$other} cancelled/didn't send his teleport request to you.");
return;
}
$this->playerData[$other->getUID()]->tpRequestTo = -1;
$other->tell("{$session} doesn't want you to teleport to him: \"%s\"", implode(" ", $args));
$session->tell("Dirty job done; {$session}'s teleport request to you has been denied.");
return;
case "tpr":
if (!isset($args[0])) {
if ($cmd instanceof oldSessionCommand) {
$cmd->tellWrongUsage($session);
}
return;
}
$other = $this->getMain()->getSessions()->getSession($on = array_shift($args));
if (!$other instanceof Session) {
$session->tell("Player {$on} not found!");
return;
}
if (!$other->inSession($this)) {
$session->tell("{$other} is not in KitPvP!");
return;
}
$data = $this->cancelTpRequest($session);
$data->tpRequestTo = $other->getUID();
$other->tell("{$session} has sent you a teleport request: " . implode(" ", $args));
$session->tell("A teleport request has been sent to {$other}.");
return;
case "tpc":
$this->cancelTpRequest($session, true);
return;
}
}