本文整理汇总了PHP中pocketmine\Player::sendMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::sendMessage方法的具体用法?PHP Player::sendMessage怎么用?PHP Player::sendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::sendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: teleport
public function teleport(Player $player)
{
if ($this->message !== null) {
$player->sendMessage($this->message);
}
if ($this->position instanceof Position) {
if ($this->position->isValid()) {
if ($this->position instanceof WeakPosition) {
$this->position->updateProperties();
}
//Server::getInstance()->getLogger()->info($this->position->x . " : " . $this->position->y . " : " . $this->position->z);
$player->teleport($this->position);
} else {
$player->sendMessage($this->getApi()->executeTranslationItem("level-not-loaded-warp"));
}
} else {
$plugin = $player->getServer()->getPluginManager()->getPlugin("FastTransfer");
if ($plugin instanceof PluginBase && $plugin->isEnabled() && $plugin instanceof FastTransfer) {
$plugin->transferPlayer($player, $this->address, $this->port);
} else {
$player->getServer()->getPluginManager()->getPlugin("SimpleWarp")->getLogger()->warning("In order to use warps tp other servers, you must install " . TextFormat::AQUA . "FastTransfer" . TextFormat::RESET . ".");
$player->sendPopup(TextFormat::RED . "Warp failed!" . TextFormat::RESET);
}
}
}
示例2: helpColor
public function helpColor(Player $player)
{
$player->sendMessage(TextFormat::DARK_AQUA . "*사용가능한 색상표를 출력합니다");
$player->sendMessage("§f&0:검정 §f&1:§1짙은파랑 §f&2:§2짙은초록 §f&3:§3짙은청록");
$player->sendMessage("§f&4:§4짙은빨강 §f&5:§5짙은보라§f&6:§6금색 §f&7:§7회색");
$player->sendMessage("§f&8:§8검은회색 §f&9:§9파랑 §f&a:§a초록 §f&b:§b청록");
$player->sendMessage("§f&c:§c빨강 §f&d:§d보라 §f&e:§e노랑 §f&f:§f흰색\n\n");
}
示例3: onHelp
public function onHelp(Player $sender)
{
if ($sender->isOp()) {
$sender->sendMessage(TextFormat::DARK_AQUA . "/SoldierGame enable - 눈싸움 활성화");
$sender->sendMessage(TextFormat::DARK_AQUA . "/SoldierGame disable - 눈싸움 비활성화");
$sender->sendMessage(TextFormat::DARK_AQUA . "/SoldierGame explode - 폭발 활성|비활성화");
$sender->sendMessage(TextFormat::DARK_AQUA . "/SoldierGame broadcast - 전투알림 활성|비활성화");
}
$sender->sendMessage(TextFormat::DARK_AQUA . "/SoldierGame score <유저명> - 전적표시.");
}
示例4: joinToArena
public function joinToArena(Player $p)
{
if ($this->game >= 1) {
$p->sendMessage($this->msg->getMsg("already_running"));
}
$ev = new PlayerJoinArenaEvent($p, $this, "");
if ($this->isArenaFull() && !$p->hasPermission("sg.arena.join.full")) {
$ev->setMessage($this->msg->getMsg("game_full"));
$ev->setCancelled();
} else {
if (!$p->hasPermission("sg.arena.join")) {
$ev->setMessage(Messages::getMsg("no_permission_join", ["%NAME", $this->name]));
$ev->setCancelled();
} else {
$ev->setMessage(Messages::getMsg("join_to_arena", ["%NAME" => $this->name]));
}
}
$this->plugin->getServer()->getPluginManager()->callEvent($ev);
if ($ev->isCancelled()) {
return;
}
$this->messageArenaPlayers(str_replace(["%PLAYER", "%COUNT", "%MAXCOUNT"], [$p->getName(), count($this->getPlayers()), $this->getMaxPlayers()], $this->msg->getMsg("game_connect")));
$this->players[strtolower($p->getName())]["ins"] = $p;
$this->saveInventory($p);
$p->teleport($this->getNextJoinPos($p));
}
示例5: addRequest
public function addRequest(Player $player, Player $request)
{
$this->requests[$player->getName()] = $request->getName();
$request->sendMessage("§8§l[§bDark§4Realms§8§l]" . TextFormat::GREEN . "Player: " . $player->getName() . " has requested to teleport to you do /tpaccept to accept! \n or ignore to ignore");
$task = new removeRequest($this, $player);
$this->getServer()->getScheduler()->scheduleDelayedTask($task, 10 * 20);
}
示例6: __construct
public function __construct(HereAuth $main, Player $player, AccountInfo $info)
{
$this->main = $main;
$this->player = $player;
$this->accountInfo = $info;
if ($info->passwordHash === null) {
if (!$main->getConfig()->getNested("ForceRegister.Enabled", true)) {
// no registration involved
$this->onAuth();
$reminder = $main->getConfig()->getNested("ForceRegister.Reminder", "");
if (strlen($reminder) > 0) {
$player->sendMessage($reminder);
}
return;
}
$this->startRegistration();
return;
}
if ($info->opts->autoSecret and $player->getClientSecret() === $info->lastSecret) {
$this->onAuth();
return;
}
if ($info->opts->autoIp and $player->getAddress() === $info->lastIp) {
$this->onAuth();
return;
}
if ($info->opts->autoUuid and $player->getUniqueId()->toBinary() === $info->lastUuid) {
$this->onAuth();
return;
}
$this->state = self::STATE_PENDING_LOGIN;
$this->player->sendMessage($main->getConfig()->getNested("Messages.Login.Query", "Please login"));
}
示例7: startUser
public function startUser(Player $player)
{
$this->database->loadFor($player->getName(), $player->getId());
if ($player->spawned) {
$player->sendMessage("[HereAuth] Your account data are being loaded. Please wait patiently; it shouldn't take long.");
}
}
示例8: deactivate
private function deactivate(Player $pl)
{
$pl->sendMessage(mc::_("CloakClock de-actived"));
$this->owner->setState("CloakClock", $pl, false);
foreach ($this->owner->getServer()->getOnlinePlayers() as $online) {
$online->showPlayer($pl);
}
}
示例9: setTime
private function setTime(Player $player)
{
$msg = "[CombatLogger] Logging out now will cause you to die.\nPlease wait " . $this->interval . " seconds.";
if (isset($this->players[$player->getName()])) {
if (time() - $this->players[$player->getName()] > $this->interval) {
$player->sendMessage($msg);
}
if (isset($this->tasks[$player->getName()])) {
$this->getServer()->getScheduler()->cancelTask($this->tasks[$player->getName()]);
}
$this->tasks[$player->getName()] = $this->getServer()->getScheduler()->scheduleRepeatingTask(new TimeMsg($this, $player), 20)->getTaskId();
} else {
$player->sendMessage($msg);
$this->tasks[$player->getName()] = $this->getServer()->getScheduler()->scheduleRepeatingTask(new TimeMsg($this, $player), 20)->getTaskId();
}
$this->players[$player->getName()] = time();
}
示例10: deactivate
public function deactivate(Player $pl)
{
$pl->sendMessage(mc::_("You are no longer invisible"));
$this->setState($pl, false);
foreach ($this->owner->getServer()->getOnlinePlayers() as $online) {
$online->showPlayer($pl);
}
}
示例11: __construct
public function __construct(DynamicHub $hub, Player $player)
{
$this->hub = $hub;
$this->player = $player;
$player->blocked = true;
// TODO load data
$player->sendMessage("Loading account data for you. Please wait...");
// TODO translate
}
示例12: joinToArena
public function joinToArena(Player $p)
{
if ($this->game >= 1) {
$p->sendMessage($this->msg->getMsg("already_running"));
}
if ($this->isArenaFull() && !$p->isOp() && !$p->hasPermission("sg.full")) {
$p->sendMessage($this->msg->getMsg("game_full"));
return;
}
$this->plugin->getServer()->getPluginManager()->callEvent($e = new PlayerJoinArenaEvent($p, $this));
if ($e->isCancelled()) {
return;
}
$this->players[strtolower($p->getName())]["ins"] = $p;
$this->saveInv($p);
$p->teleport($this->getNextJoinPos());
$this->messageArenaPlayers(str_replace(["%PLAYER", "%COUNT", "%MAXCOUNT"], [$p->getName(), count($this->getPlayers()), $this->getMaxPlayers()], $this->msg->getMsg("game_connect")));
}
示例13: onActivate
public function onActivate(Item $item, Player $player = null)
{
if ($this->getLevel()->getDimension() == Level::DIMENSION_NETHER) {
$explosion = new Explosion($this, 6, $this);
$explosion->explode();
return true;
}
$time = $this->getLevel()->getTime() % Level::TIME_FULL;
$isNight = ($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE);
if ($player instanceof Player and !$isNight) {
$player->sendMessage(TextFormat::GRAY . "You can only sleep at night");
return true;
}
$blockNorth = $this->getSide(2);
//Gets the blocks around them
$blockSouth = $this->getSide(3);
$blockEast = $this->getSide(5);
$blockWest = $this->getSide(4);
if (($this->meta & 0x8) === 0x8) {
//This is the Top part of bed
$b = $this;
} else {
//Bottom Part of Bed
if ($blockNorth->getId() === $this->id and ($blockNorth->meta & 0x8) === 0x8) {
$b = $blockNorth;
} elseif ($blockSouth->getId() === $this->id and ($blockSouth->meta & 0x8) === 0x8) {
$b = $blockSouth;
} elseif ($blockEast->getId() === $this->id and ($blockEast->meta & 0x8) === 0x8) {
$b = $blockEast;
} elseif ($blockWest->getId() === $this->id and ($blockWest->meta & 0x8) === 0x8) {
$b = $blockWest;
} else {
if ($player instanceof Player) {
$player->sendMessage(TextFormat::GRAY . "This bed is incomplete");
}
return true;
}
}
if ($player instanceof Player and $player->sleepOn($b) === false) {
$player->sendMessage(TextFormat::GRAY . "This bed is occupied");
}
return true;
}
示例14: exec
/**
* Execute a command as a given player
*
* @param Player|CommandSender $sender - Entity to impersonate
* @param str[]|str $cmd - commands to execute
* @param bool $show - show commands being executed
*/
public static function exec($sender, $cmd, $show = true)
{
if (!is_array($cmd)) {
$cmd = [$cmd];
}
foreach ($cmd as $c) {
if ($show) {
$sender->sendMessage("CMD> {$c}");
}
$sender->getServer()->dispatchCommand($sender, $c);
}
}
示例15: broadcast
public static function broadcast(Player $player, $achievementId)
{
if (isset(Achievement::$list[$achievementId])) {
if (Server::getInstance()->getConfigString("announce-player-achievements", \true) === \true) {
Server::getInstance()->broadcastMessage($player->getDisplayName() . " has just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
} else {
$player->sendMessage("You have just earned the achievement " . TextFormat::GREEN . Achievement::$list[$achievementId]["name"]);
}
return \true;
}
return \false;
}