本文整理汇总了PHP中pocketmine\command\CommandSender::sendTip方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandSender::sendTip方法的具体用法?PHP CommandSender::sendTip怎么用?PHP CommandSender::sendTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\command\CommandSender
的用法示例。
在下文中一共展示了CommandSender::sendTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(CommandSender $sender, array $args)
{
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . "You are not standing inside a plot");
return true;
}
if ($plot->owner == "") {
$msg = TextFormat::DARK_RED . "Unclaimed Plot";
if (isset($args[0])) {
$sender->sendTip($msg);
} else {
$sender->sendMessage($msg);
}
} else {
if (isset($args[0])) {
$msg = TextFormat::DARK_GREEN . "Plot " . TextFormat::WHITE . $plot->id;
$msg .= " ({$plot->X} , {$plot->Z}) \n";
$msg .= TextFormat::DARK_GREEN . "Owner: " . TextFormat::WHITE . $plot->owner . "\n";
if ($plot->name != "") {
$msg .= TextFormat::DARK_GREEN . "Name: " . TextFormat::WHITE . $plot->name . "\n";
}
/*
if( count($plot->helpers) > 0 ) {
if($plot->helpers[0] != "") {
$msg .= " " . TextFormat::DARK_GREEN . " with " . implode(", ", $plot->helpers);
}
}
*/
$sender->sendTip($msg);
} else {
$pos = " ({$plot->X} , {$plot->Z}) ";
$sender->sendMessage(TextFormat::DARK_GREEN . "Position: " . TextFormat::WHITE . $pos);
$sender->sendMessage(TextFormat::DARK_GREEN . "Plot Number: " . TextFormat::WHITE . $plot->id);
$sender->sendMessage(TextFormat::DARK_GREEN . "Name: " . TextFormat::WHITE . $plot->name);
$sender->sendMessage(TextFormat::DARK_GREEN . "Owner: " . TextFormat::WHITE . $plot->owner);
$helpers = implode(", ", $plot->helpers);
$sender->sendMessage(TextFormat::DARK_GREEN . "Helpers: " . TextFormat::WHITE . $helpers);
$sender->sendMessage(TextFormat::DARK_GREEN . "Biome: " . TextFormat::WHITE . $plot->biome);
}
}
return true;
}
示例2: onCommand
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
{
$cfg = $this->getConfig();
$holding = $cfg->get("sneak-on-item");
$noholding = $cfg->get("sneak-off-item");
if ($cmd->getName() === "isneak") {
if ($sender->hasPermission("isneak.command")) {
if (!isset($args[0]) || count($args) > 1) {
$sender->sendMessage("§b> §cUsage: §7/isneak §c<§7on §c| §7off§c>");
return true;
}
switch (strtolower($args[0])) {
case "on":
if ($sender instanceof Player) {
$sender->getInventory()->remove(Item::get($holding));
$sender->getInventory()->remove(Item::get($noholding));
$sender->getInventory()->addItem(Item::get($holding));
$sender->getInventory()->addItem(Item::get($noholding));
$sender->sendTip("§6ItemSneaking Enabled");
}
break;
case "off":
if ($sender instanceof Player) {
$sender->getInventory()->remove(Item::get($holding));
$sender->getInventory()->remove(Item::get($noholding));
$this->disableSneak($sender);
$sender->sendTip("§6ItemSneaking Disabled");
}
break;
}
return true;
} else {
$sender->sendMessage("§cYou don't have permission for this command.");
}
}
}
示例3: execute
public function execute(CommandSender $sender, array $args)
{
if (count($args) > 1) {
return false;
}
$name = "";
if (isset($args[0])) {
$name = $args[0];
}
$player = $sender->getServer()->getPlayer($sender->getName());
$plot = $this->getPlugin()->getPlotByPosition($player->getPosition());
if ($plot === null) {
$sender->sendMessage(TextFormat::RED . "You are not standing on an island");
return true;
}
if ($plot->owner != "") {
if ($plot->owner === $sender->getName()) {
$sender->sendMessage(TextFormat::RED . "You already own this island");
} else {
$sender->sendMessage(TextFormat::RED . "This island is already claimed by " . $plot->owner);
}
return true;
}
$plotLevel = $this->getPlugin()->getLevelSettings($plot->levelName);
$maxPlotsInLevel = $plotLevel->maxPlotsPerPlayer;
$maxPlots = $this->getPlugin()->getConfig()->get("MaxPlotsPerPlayer");
$plotsOfPlayer = $this->getPlugin()->getProvider()->getPlotsByOwner($player->getName());
if ($maxPlotsInLevel >= 0 and count($plotsOfPlayer) >= $maxPlotsInLevel) {
$sender->sendMessage(TextFormat::RED . "You reached the limit of {$maxPlotsInLevel} islands per player in this world");
return true;
} elseif ($maxPlots >= 0 and count($plotsOfPlayer) >= $maxPlots) {
$sender->sendMessage(TextFormat::RED . "You reached the limit of {$maxPlots} islands per player");
return true;
}
$economy = $this->getPlugin()->getEconomyProvider();
if ($economy !== null and !$economy->reduceMoney($player, $plotLevel->claimPrice)) {
$sender->sendMessage(TextFormat::RED . "You don't have enough money to claim this island");
return true;
}
$plot->owner = $sender->getName();
$plot->name = $name;
if ($this->getPlugin()->getProvider()->savePlot($plot)) {
if ($sender instanceof Player) {
$sender->sendMessage(TextFormat::GREEN . "You are now the owner of " . TextFormat::WHITE . $plot);
// chest
$position = $this->getPlugin()->getPlotPosition($plot);
// debug
$position = $player->getPosition();
$position instanceof Position;
$chest = $position->getLevel()->getBlock(new Vector3(floor($position->getX()), 30 + (69 - 64), floor($position->getZ())));
$position->getLevel()->setBlock(new Vector3(floor($position->getX()), 30 + (69 - 64), floor($position->getZ())), new Block(Block::CHEST), true, true);
$nbt = new Compound("", [new Enum("Items", []), new String("id", Tile::CHEST), new Int("x", floor($position->getX())), new Int("y", floor($position->getY())), new Int("z", floor($position->getZ()))]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$tile = Tile::createTile("Chest", $sender->getLevel()->getChunk(floor($position->getX()) >> 4, floor($position->getZ()) >> 4), $nbt);
if (!$tile instanceof \pocketmine\tile\Chest) {
continue;
}
$tile->getInventory()->addItem(new Item(Item::ICE, 0, 2), new Item(Item::BUCKET, 10, 1), new Item(Item::MELON_SLICE, 0, 1), new Item(Item::CACTUS, 0, 1), new Item(Item::RED_MUSHROOM, 0, 1), new Item(Item::BROWN_MUSHROOM, 0, 1), new Item(Item::PUMPKIN_SEEDS, 0, 1), new Item(Item::SUGAR_CANE, 0, 1), new Item(Item::SIGN, 0, 1));
$sender->sendTip(TextFormat::GREEN . TextFormat::BOLD . "A new SkyBlock\n" . TextFormat::GOLD . "by thebigsmileXD");
}
} else {
$sender->sendMessage(TextFormat::RED . "Something went wrong");
}
return true;
}