本文整理汇总了PHP中pocketmine\command\CommandSender::setNameTag方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandSender::setNameTag方法的具体用法?PHP CommandSender::setNameTag怎么用?PHP CommandSender::setNameTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\command\CommandSender
的用法示例。
在下文中一共展示了CommandSender::setNameTag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCommand
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
{
if (strtolower($cmd->getName()) === "megajoin") {
if (isset($args[0])) {
if ($sender instanceof Player) {
$status = $args[0];
$sender->setNameTag(implode("<-*->"));
$sender->sendMessage("You Joined the match!");
$sender->OnStart();
}
}
}
}
示例2: onCommand
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
{
if (strtolower($cmd->getName()) == "disguise") {
if ($sender instanceof Player) {
if ($sender->hasPermission("disguise.command")) {
$list = array("Apple", "Orange", "Banana", "Pear");
$nick = array_rand($list, 1);
$sender->setNameTag($nick);
return true;
} else {
$sender->sendMessage(TextFormat::RED . "You don't have permissions to use this command.");
}
}
}
}
示例3: onCommand
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
switch ($command->getName()) {
case "pvp":
$name = $sender->getName();
echo 1;
if (isset($this->joinedpvp[$name])) {
echo 2;
if ($this->joinedpvp[$name] == 1) {
$sender->sendMessage(TextFormat::RED . "[WallPVP]あなたはすでにpvpに参加しています。");
break;
}
}
if (time() - @$this->teamc[1][$name] <= 30 * 1) {
echo "a2";
$this->team[1][$name] = 1;
$teamname = "S";
$tcolor = TextFormat::LIGHT_PURPLE;
$pos1 = new Position(73, 72, 132);
//座標を指定
$sender->sendMessage(TextFormat::LIGHT_PURPLE . "[WallPVP]あなたは" . $teamname . "チームです。");
} elseif (time() - @$this->teamc[2][$name] <= 30 * 1) {
echo "b1";
$this->team[2][$name] = 1;
$teamname = "M";
$tcolor = TextFormat::AQUA;
$pos1 = new Position(64, 76, 28);
//座標を指定
$sender->sendMessage(TextFormat::AQUA . "[WallPVP]あなたは" . $teamname . "チームです。");
} else {
echo 3;
$this->joinedpvp[$name] = 1;
if (count($this->team[1]) <= count($this->team[2])) {
$this->team[1][$name] = 1;
$teamname = "S";
$tcolor = TextFormat::LIGHT_PURPLE;
$pos1 = new Position(73, 72, 132);
//座標を指定
$sender->sendMessage(TextFormat::LIGHT_PURPLE . "[WallPVP]あなたは" . $teamname . "チームです。");
} else {
$this->team[2][$name] = 1;
$teamname = "M";
$tcolor = TextFormat::AQUA;
$pos1 = new Position(64, 76, 28);
//座標を指定
$sender->sendMessage(TextFormat::AQUA . "[WallPVP]あなたは" . $teamname . "チームです。");
}
}
if (isset($this->team[1][$name])) {
$teamname = "[S]";
$tcolor = TextFormat::LIGHT_PURPLE;
} elseif (isset($this->team[2][$name])) {
$teamname = "[M]";
$tcolor = TextFormat::AQUA;
} else {
$teamname = null;
$tcolor = null;
}
if ($sender->isOp()) {
$op = "[OP]";
} else {
$op = null;
}
$sender->setDisPlayName($tcolor . $op . $teamname . $name . "[" . $this->hapi->getkill($name) . "kill]");
$sender->setNameTag($tcolor . $op . $teamname . $name . "[" . $this->hapi->getkill($name) . "kill]");
$sender->teleport($pos1);
$effect = Effect::getEffect(11);
//Effect ID
$effect->setVisible(true);
//Particles
$effect->setAmplifier(1000);
$effect->setDuration(100);
//Ticks
$sender->addEffect($effect);
break;
case "rekit":
$this->setKit($sender);
break;
case "ok":
$cfg = $this->settings->getAll();
$name = $sender->getName();
if (isset($this->buy[$name])) {
if (time() - $this->buy[$name]["time"] <= 20) {
$amount = $cfg[$this->buy[$name]["id"]];
if ($this->hapi->getkit1($name) == $this->buy[$name]["id"]) {
$sender->sendMessage(TextFormat::RED . "[WallPVP]購入済みです。");
} else {
if ($this->hapi->useexp($name, $amount)) {
$this->hapi->setkit1($name, $this->buy[$name]["id"]);
$this->setKit($sender);
$sender->sendMessage(TextFormat::RED . "[WallPVP]" . $amount . "EXPの" . $this->buy[$name]["id"] . "を購入しました。");
} else {
$sender->sendMessage(TextFormat::RED . "[WallPVP]EXPが足りません。");
}
}
}
}
break;
case "buy":
$name = $sender->getName();
//.........这里部分代码省略.........