本文整理汇总了PHP中pocketmine\event\player\PlayerJoinEvent::setJoinMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerJoinEvent::setJoinMessage方法的具体用法?PHP PlayerJoinEvent::setJoinMessage怎么用?PHP PlayerJoinEvent::setJoinMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\player\PlayerJoinEvent
的用法示例。
在下文中一共展示了PlayerJoinEvent::setJoinMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPlayerJoin
/**
* @param PlayerJoinEvent $event
*/
public function onPlayerJoin(PlayerJoinEvent $event)
{
// Nick and NameTag set:
$message = $event->getJoinMessage();
if ($message instanceof TranslationContainer) {
foreach ($message->getParameters() as $i => $m) {
$message->setParameter($i, str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $m));
}
} elseif ($message instanceof TextContainer) {
$message->setText(str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message->getText()));
} else {
$message = str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message);
}
$event->setJoinMessage($message);
// Hide vanished players with "noPacket"
foreach ($event->getPlayer()->getServer()->getOnlinePlayers() as $p) {
if ($this->getPlugin()->isVanished($p) && $this->getPlugin()->hasNoPacket($p)) {
$event->getPlayer()->hidePlayer($p);
}
}
$i = $this->getPlugin()->getMutedUntil($event->getPlayer());
if ($i instanceof \DateTime && $event->getPlayer()->hasPermission("essentials.mute.notify")) {
$event->getPlayer()->sendMessage(TextFormat::YELLOW . "Remember that you're muted until " . TextFormat::AQUA . $i->format("l, F j, Y") . TextFormat::YELLOW . " at " . TextFormat::AQUA . $i->format("h:ia"));
}
//$this->getPlugin()->setPlayerBalance($event->getPlayer(), $this->getPlugin()->getDefaultBalance()); TODO
}
示例2: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
if ($player->isOp()) {
$event->setJoinMessage("|ScMCPE|" . $player->getDisplayName() . "[Ranked] Rejoin la Partie!");
} else {
$event->setJoinMessage("|ScMCPE|" . $player->getDisplayName() . "Rejoin la Partie.");
}
}
示例3: onPlayerJoin
public function onPlayerJoin(PlayerJoinEvent $event)
{
if (strpos($n = strtolower($event->getPlayer()->getName()), "") !== false || preg_match('#^[a-zA-Z0-9_]{3,16}$#', $n) == 0 || $n === "" || $n === "rcon" || $n === "console" || $n === "steve" || strlen($n) > 16 || strlen($n) < 3) {
$event->setCancelled();
$event->setJoinMessage("");
}
}
示例4: JoinEvent
public function JoinEvent(PlayerJoinEvent $ev)
{
$player = $ev->getPlayer();
if ($player->isop()) {
$ev->setJoinMessage("GM [" . $player->getName() . "] 님께서 SAO 데이터베이스에 로그인하셨습니다 ");
}
}
示例5: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
$player_name = $player->getName();
$join = "join-message: ";
$join_message = strstr(file_get_contents("CustomMessages/messages.txt"), "quit-message: ", true);
$event->setJoinMessage($join_message);
}
示例6: onJoin
public function onJoin(PlayerJoinEvent $event)
{
chdir($this->getDataFolder());
$data = file_get_contents("config.yml");
$file_array = json_decode($data, true);
$join_message = $file_array["join-message:"];
$event->setJoinMessage(str_replace("{player}", $event->getPlayer()->getDisplayName(), $join_message));
}
示例7: onPlayerJoinEvent
public function onPlayerJoinEvent(PlayerJoinEvent $event)
{
$message = $event->getJoinMessage();
if ($message instanceof TranslationContainer) {
$message = $this->getServer()->getLanguage()->translateString($message->getText(), $message->getParameters());
}
AnnounceSystem::getInstance()->pushBroadCastPopup($message, 2);
$event->setJoinMessage(null);
}
示例8: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$spawn = $this->plugin->getNextSpawn();
$event->getPlayer()->teleport($spawn);
$this->plugin->players = $this->plugin->players + 1;
$event->setJoinMessage("[HG] " . $event->getPlayer()->getName() . " joined the match!");
if (!$this->plugin->points->exists($event->getPlayer()->getName())) {
$this->plugin->points->set($event->getPlayer()->getName(), array("kills" => 0, "deaths" => 0));
}
}
示例9: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$event->setJoinMessage("");
$player = $event->getPlayer();
$ses = $this->main->getSession($player);
if ($ses === null) {
$player->sendMessage(Phrases::VAR_wait . "Please wait a moment while we are preparing your account.");
$this->main->queueFor($player->getId(), true, Queue::QUEUE_SESSION)->pushToQueue(new JoinTriggerRunnable($this->main, $player));
} else {
$ses->onJoin();
}
}
示例10: PlayerJoin
public function PlayerJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
if (strtolower($player->getName()) == "steve") {
$event->setJoinMessage("");
$pk = new ChatPacket();
$pk->message = "[경고] 닉네임이 Steve입니다, 해당닉네임은 사용불가능합니다\n[경고] 자동으로 킥처리되며 닉네임 변경시 정상이용가능합니다";
$player->dataPacket($pk);
$player->dataPacket($pk);
$player->dataPacket($pk);
$player->dataPacket($pk);
$this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "Kick"], [$player]), 200);
}
}
示例11: onPlayerJoin
public function onPlayerJoin(PlayerJoinEvent $ev)
{
if ($this->cfg["login-timeout"] !== 0) {
$n = $ev->getPlayer()->getName();
$this->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this, [$this, "checkTimeout"], [$n]), $this->cfg["login-timeout"] * 20);
}
if ($this->cfg["hide-unauth"]) {
$p = $ev->getPlayer();
foreach ($this->getServer()->getOnlinePlayers() as $online) {
$online->hidePlayer($p);
$p->hidePlayer($online);
}
$ev->setJoinMessage("");
//
}
}
示例12: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
$player_d_name = explode("d", $player->getName());
if (is_numeric($player->getName()) or isset($player_d_name[1]) and is_numeric($player_d_name[1])) {
$event->setJoinMessage("");
$attachment = $player->addAttachment($this);
$attachment->setPermission("pocketmine", false);
$player->sendMessage($this->getMessage("index_name_caution1"));
$player->sendMessage($this->getMessage("index_name_caution2"));
$player->sendMessage($this->getMessage("index_name_caution3"));
$this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
return;
}
if (isset($this->ipban_data[$player->getAddress()])) {
$event->setJoinMessage("");
$attachment = $player->addAttachment($this);
$attachment->setPermission("pocketmine", false);
$player->sendMessage($this->getMessage("warning_ipbanned") . "(" . $player->getAddress() . ")");
$player->sendMessage($this->getMessage("warning-disconnected"));
$player->sendMessage($this->getMessage("contact-admin"));
$this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
return;
}
if (isset($this->ban_data[$player->getName()])) {
$event->setJoinMessage("");
$attachment = $player->addAttachment($this);
$attachment->setPermission("pocketmine", false);
$player->sendMessage($this->getMessage("warning_banned") . "(" . $player->getName() . ")");
$player->sendMessage($this->getMessage("warning-disconnected"));
$player->sendMessage($this->getMessage("contact-admin"));
$this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
return;
}
$e = explode(".", $player->getAddress());
if (isset($this->subban_data[$e[0] . "." . $e[1]])) {
$event->setJoinMessage("");
$attachment = $player->addAttachment($this);
$attachment->setPermission("pocketmine", false);
$player->sendMessage($this->getMessage("warning_subnetbanned") . "(" . $e[0] . "." . $e[1] . ")");
$player->sendMessage($this->getMessage("warning-disconnected"));
$player->sendMessage($this->getMessage("contact-admin"));
$this->initialize_schedule_delay($this, "KickExecute", 100, [$player]);
return;
}
$this->onlinelist[] = $player->getName();
}
示例13: onPlayerJoin
/**
* @param PlayerJoinEvent $event
*/
public function onPlayerJoin(PlayerJoinEvent $event)
{
// Nick and NameTag set:
$message = $event->getJoinMessage();
if ($message instanceof TranslationContainer) {
foreach ($message->getParameters() as $i => $m) {
$message->setParameter($i, str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $m));
}
} elseif ($message instanceof TextContainer) {
$message->setText(str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message->getText()));
} else {
$message = str_replace($event->getPlayer()->getName(), $event->getPlayer()->getDisplayName(), $message);
}
$event->setJoinMessage($message);
// Hide vanished players with "noPacket"
/*
foreach($event->getPlayer()->getServer()->getOnlinePlayers() as $p){
if($this->getPlugin()->isVanished($p) && $this->getPlugin()->hasNoPacket($p)){
$event->getPlayer()->hidePlayer($p);
}
}
*
*/
/* Hotfix - players where getting tagged as invisible for no reason
* This stops the invisibility setting saved in the players session from taking effect
*/
foreach ($event->getPlayer()->getServer()->getOnlinePlayers() as $p) {
$event->getPlayer()->showPlayer($p);
if ($this->getPlugin()->isVanished($p)) {
$this->getPlugin()->switchVanish($p);
}
}
/*
* End Hotfix
*/
$i = $this->getPlugin()->getMutedUntil($event->getPlayer());
if ($i instanceof \DateTime && $event->getPlayer()->hasPermission("essentials.mute.notify")) {
$event->getPlayer()->sendMessage(TextFormat::YELLOW . "Remember that you're muted until " . TextFormat::AQUA . $i->format("l, F j, Y") . TextFormat::YELLOW . " at " . TextFormat::AQUA . $i->format("h:ia"));
}
//$this->getPlugin()->setPlayerBalance($event->getPlayer(), $this->getPlugin()->getDefaultBalance()); TODO
}
示例14: JoinEvent
public function JoinEvent(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
$event->setJoinMessage(TextFormat::RED . " [" . $player->getName() . "] §dWelcome the Server! ");
}
示例15: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
foreach ($this->list["names"] as $l) {
if (stripos($player->getName(), $l) !== false) {
$event->setJoinMessage("");
$this->chatpk->message = $this->list["message"];
$player->dataPacket($this->chatpk);
$this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "Kick"], [$player]), 120);
break;
}
}
}