本文整理汇总了PHP中pocketmine\event\player\PlayerQuitEvent::setQuitMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerQuitEvent::setQuitMessage方法的具体用法?PHP PlayerQuitEvent::setQuitMessage怎么用?PHP PlayerQuitEvent::setQuitMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\player\PlayerQuitEvent
的用法示例。
在下文中一共展示了PlayerQuitEvent::setQuitMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onQuit
public function onQuit(PlayerQuitEvent $event)
{
// Epic Fail
$player = $event->getPlayer();
if ($player->isOp()) {
$event->setQuitMessage("|ScMCPE|" . $player->getDisplayName() . "[Ranked] est hors ligne!");
} else {
$event->setQuitMessage("|ScMCPE|" . $player->getDisplayName() . "est hors ligne!.");
}
}
示例2: QuitEvent
public function QuitEvent(PlayerQuitEvent $ev)
{
$player = $ev->getPlayer();
if ($player->isop()) {
$ev->setQuitMessage("GM [" . $player->getName() . "] 님께서 SAO 데이테베이솔부터 로그아웃 하셨습니다 ");
}
}
示例3: onQuit
public function onQuit(PlayerQuitEvent $event)
{
chdir($this->getDataFolder());
$data = file_get_contents("config.yml");
$file_array = json_decode($data, true);
$quit_message = $file_array["quit-message:"];
$event->setQuitMessage(str_replace("{player}", $event->getPlayer()->getDisplayName(), $quit_message));
}
示例4: onQuit
public function onQuit(PlayerQuitEvent $event)
{
$player = $event->getPlayer();
$player_name = $player->getName();
$quit = "quit-message: ";
$quit_message = substr(strstr(file_get_contents("CustomMessages/messages.txt"), $quit), strlen($quit));
$event->setQuitMessage($quit_message);
}
示例5: onPlayerQuitEvent
public function onPlayerQuitEvent(PlayerQuitEvent $event)
{
$message = $event->getQuitMessage();
if ($message instanceof TranslationContainer) {
$message = $this->getServer()->getLanguage()->translateString($message->getText(), $message->getParameters());
}
AnnounceSystem::getInstance()->pushBroadCastPopup($message, 2);
$event->setQuitMessage(null);
}
示例6: onQuit
public function onQuit(PlayerQuitEvent $event)
{
$this->plugin->players = $this->plugin->players - 1;
$event->setQuitMessage("[HG] " . $event->getPlayer()->getName() . " left the match!");
if ($this->plugin->players <= 1) {
$this->plugin->getServer()->broadcastMessage("[HG] Game ended!");
$this->plugin->getServer()->shutdown();
}
}
示例7: onPlayerQuit
public function onPlayerQuit(PlayerQuitEvent $event)
{
$this->config_message = ccMain::getInstance()->getMCfg();
$message = $this->config_message->get("Enable-CustomLeave-Message");
$player = $event->getPlayer();
$event->setQuitMessage(null);
if ($this->factionspro == true && $this->factionspro->isInFaction(strtolower($player->getName()))) {
$getUserFaction = $this->factionspro->getPlayerFaction(strtolower($player->getName()));
$message = str_replace("@Faction", $getUserFaction, $message);
} else {
$this->config = ccMain::getInstance()->getCfg();
$nofac = $this->config->get("if-player-has-no-faction");
$message = str_replace("@Faction", $nofac, $message);
}
if ($this->massive) {
$message = str_replace("{Money}", MassiveEconomyAPI::getInstance()->getMoney($player->getName()), $message);
} else {
$message = str_replace("{Money}", "ERROR", $message);
}
if (!$this->pureperms) {
$message = str_replace("{PurePerms}", "NoGroup", $message);
}
if ($this->pureperms) {
$isMultiWorldEnabled = $this->pureperms->getConfig()->get("enable-multiworld-formats");
$levelName = $isMultiWorldEnabled ? $player->getLevel()->getName() : null;
$message = str_replace("{PurePerms}", $this->pureperms->getUser($player)->getGroup($levelName)->getName(), $message);
} else {
return false;
}
if ($this->killchat) {
$message = str_replace("{Kills}", KillChat::getInstance()->getKills($player->getName()), $message);
} else {
$message = str_replace("{Kills}", "ERROR", $message);
}
if ($this->killchat) {
$message = str_replace("{Deaths}", KillChat::getInstance()->getDeaths($player->getName()), $message);
} else {
$message = str_replace("{Deaths}", "ERROR", $message);
}
$message = str_replace("@Player", $event->getPlayer()->getDisplayName(), $message);
foreach ($this->plugin->getServer()->getOnlinePlayers() as $player) {
$player->sendPopup($message);
}
}
示例8: onPlayerQuit
/**
* @param PlayerQuitEvent $event
*/
public function onPlayerQuit(PlayerQuitEvent $event)
{
// Quit message (nick):
$message = $event->getQuitMessage();
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->setQuitMessage($message);
// Session destroy:
if ($this->getPlugin()->sessionExists($event->getPlayer())) {
$this->getPlugin()->removeSession($event->getPlayer());
}
}
示例9: onPlayerQuit
/**
* @param PlayerQuitEvent $event
*
* @priority HIGHEST
*/
public function onPlayerQuit(PlayerQuitEvent $event)
{
$player = $event->getPlayer();
//Motd Update
if (CustomAlerts::getAPI()->isMotdCustom()) {
CustomAlerts::getAPI()->setMotdMessage(CustomAlerts::getAPI()->getDefaultMotdMessage());
} else {
CustomAlerts::getAPI()->setMotdMessage($this->plugin->translateColors("&", $this->plugin->getServer()->getMotd()));
}
//Motd Update Event
$this->plugin->getServer()->getPluginManager()->callEvent(new CustomAlertsMotdUpdateEvent($this->plugin->getServer()->getMotd()));
$this->plugin->getServer()->getNetwork()->setName(CustomAlerts::getAPI()->getMotdMessage());
CustomAlerts::getAPI()->setQuitMessage($event->getQuitMessage());
//Check if Quit message is hidden
if (CustomAlerts::getAPI()->isQuitHidden()) {
CustomAlerts::getAPI()->setQuitMessage("");
} else {
//Check if Quit message is custom
if (CustomAlerts::getAPI()->isQuitCustom()) {
CustomAlerts::getAPI()->setQuitMessage(CustomAlerts::getAPI()->getDefaultQuitMessage($player));
}
}
//Quit Event
$this->plugin->getServer()->getPluginManager()->callEvent(new CustomAlertsQuitEvent($player, $event->getQuitMessage()));
$event->setQuitMessage(CustomAlerts::getAPI()->getQuitMessage());
}
示例10: onPlayerQuit
public function onPlayerQuit(PlayerQuitEvent $event)
{
$event->getPlayer()->setDisplayName(substr($event->getPlayer()->getDisplayName(), strlen(PocketTelegram::getInstance()->getConfig()->get("minecraftUserPrefix", "~"))));
$event->setQuitMessage($event->getPlayer()->getLeaveMessage());
}
示例11: onQuit
public function onQuit(PlayerQuitEvent $event)
{
$player = $event->getPlayer();
$onlinekey = array_search($player->getName(), $this->onlinelist);
if ($onlinekey !== false) {
array_splice($this->onlinelist, $onlinekey, 1);
}
$offlinekey = array_search($player->getName(), $this->offlinelist);
if ($offlinekey === false) {
if (count($this->offlinelist) >= 5) {
array_shift($this->offlinelist);
}
if (count($this->offline_iplist) >= 5) {
array_shift($this->offlinelist);
}
$this->offlinelist[] = $player->getName();
$this->offline_iplist[] = $player->getAddress();
}
$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->setQuitMessage("");
return;
}
if (isset($this->ipban_data[$player->getAddress()])) {
$event->setQuitMessage("");
return;
}
if (isset($this->ban_data[$player->getName()])) {
$event->setQuitMessage("");
return;
}
if (isset($this->subban_data[$player->getAddress()])) {
$event->setQuitMessage("");
return;
}
}
示例12: onQuit
public function onQuit(PlayerQuitEvent $event)
{
if ($this->plugin->status === "enabled" && $this->plugin->getConfig()->get("player-quit") !== true) {
$event->setQuitMessage("");
}
}
示例13: onQuit
public function onQuit(PlayerQuitEvent $event)
{
$this->main->endSession($event->getPlayer());
$event->setQuitMessage("");
}
示例14: onPlayerQuitEvent
public function onPlayerQuitEvent(PlayerQuitEvent $event)
{
$name = $event->getPlayer()->getName();
unset($this->players[$name]);
$event->setQuitMessage('');
}
示例15: onQuit
public function onQuit(PlayerQuitEvent $event)
{
if (isset($this->preventQueue[$event->getPlayer()->getName()])) {
$event->setQuitMessage("");
unset($this->preventQueue[$event->getPlayer()->getName()]);
}
}