本文整理汇总了PHP中pocketmine\event\player\PlayerJoinEvent::getJoinMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerJoinEvent::getJoinMessage方法的具体用法?PHP PlayerJoinEvent::getJoinMessage怎么用?PHP PlayerJoinEvent::getJoinMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\player\PlayerJoinEvent
的用法示例。
在下文中一共展示了PlayerJoinEvent::getJoinMessage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: 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
}
示例4: doFirstSpawn
protected function doFirstSpawn()
{
$this->spawned = true;
$this->sendSettings();
$this->sendPotionEffects($this);
$this->sendData($this);
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$pk = new SetTimePacket();
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk);
$pos = $this->level->getSafeSpawn($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
$pos = $ev->getRespawnPosition();
$pk = new RespawnPacket();
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
$pk = new PlayStatusPacket();
$pk->status = PlayStatusPacket::PLAYER_SPAWN;
$this->dataPacket($pk);
$this->server->sendFullPlayerListData($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, new TranslationContainer(TextFormat::YELLOW . "%multiplayer.player.joined", [$this->getDisplayName()])));
if (strlen(trim($ev->getJoinMessage())) > 0) {
$this->server->broadcastMessage($ev->getJoinMessage());
}
$this->noDamageTicks = 60;
foreach ($this->usedChunks as $index => $c) {
Level::getXZ($index, $chunkX, $chunkZ);
foreach ($this->level->getChunkEntities($chunkX, $chunkZ) as $entity) {
if ($entity !== $this and !$entity->closed and $entity->isAlive()) {
$entity->spawnTo($this);
}
}
}
$this->teleport($pos);
$this->spawnToAll();
if ($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
$this->server->getUpdater()->showPlayerUpdate($this);
}
if ($this->getHealth() <= 0) {
$pk = new RespawnPacket();
$pos = $this->getSpawn();
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
}
}
示例5: doFirstSpawn
protected function doFirstSpawn()
{
$this->spawned = true;
$this->sendSettings();
$this->setMovementSpeed(0.1);
$this->sendPotionEffects($this);
$this->sendData($this);
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$pk = new SetTimePacket();
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk);
$pos = $this->level->getSafeSpawn($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
$pos = $ev->getRespawnPosition()->add(0, 0.2, 0);
$pk = new RespawnPacket();
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
$pk = new PlayStatusPacket();
$pk->status = PlayStatusPacket::PLAYER_SPAWN;
$this->dataPacket($pk);
$this->noDamageTicks = 60;
foreach ($this->usedChunks as $index => $c) {
Level::getXZ($index, $chunkX, $chunkZ);
foreach ($this->level->getChunkEntities($chunkX, $chunkZ) as $entity) {
if ($entity !== $this and !$entity->closed and $entity->isAlive()) {
$entity->spawnTo($this);
}
}
}
$this->teleport($pos);
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, new TranslationContainer(TextFormat::YELLOW . "%multiplayer.player.joined", [$this->getDisplayName()])));
if (strlen(trim($msg = $ev->getJoinMessage())) > 0) {
if ($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_MESSAGE) {
$this->server->broadcastMessage($msg);
} elseif ($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_TIP) {
$this->server->broadcastTip(str_replace("@player", $this->getName(), $this->server->playerLoginMsg));
} elseif ($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_POPUP) {
$this->server->broadcastPopup(str_replace("@player", $this->getName(), $this->server->playerLoginMsg));
}
}
$this->setAllowFlight($this->gamemode == 3 || $this->gamemode == 1);
$this->server->onPlayerLogin($this);
$this->spawnToAll();
if (WeatherManager::isRegistered($this->level)) {
$this->level->getWeather()->sendWeather($this);
}
if ($this->server->expEnabled) {
//$this->checkExpLevel();
$this->updateExperience();
}
$this->setHealth($this->getHealth());
if ($this->server->foodEnabled) {
$this->setFood($this->getFood());
} else {
$this->setFood(20);
}
if ($this->server->dserverConfig["enable"] and $this->server->dserverConfig["queryAutoUpdate"]) {
$this->server->updateQuery();
}
/*if($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){
$this->server->getUpdater()->showPlayerUpdate($this);
}*/
if ($this->getHealth() <= 0) {
$pk = new RespawnPacket();
$pos = $this->getSpawn();
$pk->x = $pos->x;
$pk->y = $pos->y;
$pk->z = $pos->z;
$this->dataPacket($pk);
}
}
示例6: sendNextChunk
protected function sendNextChunk()
{
if ($this->connected === false) {
return;
}
$count = 0;
foreach ($this->loadQueue as $index => $distance) {
if ($count >= $this->chunksPerTick) {
break;
}
Level::getXZ($index, $X, $Z);
if (!$this->level->isChunkPopulated($X, $Z)) {
$this->level->generateChunk($X, $Z);
if ($this->spawned) {
continue;
} else {
break;
}
}
++$count;
unset($this->loadQueue[$index]);
$this->usedChunks[$index] = true;
$this->level->useChunk($X, $Z, $this);
$chunk = $this->level->getChunk($X, $Z);
if ($chunk instanceof AnvilChunk) {
$this->kick("Playing on Anvil worlds is not yet implemented");
//TODO!
/*$pk = new ChunkDataPacket();
$pk->chunkX = $X;
$pk->chunkZ = $Z;
$pk->groundUp = true;
$ids = "";
$meta = "";
$blockLight = "";
$skyLight = "";
$biomeIds = $chunk->getBiomeIdArray();
$bitmap = 0;
for($s = 0; $s < 8; ++$s){
$section = $chunk->getSection($s);
if(!($section instanceof EmptyChunkSection)){
$bitmap |= 1 << $s;
}else{
continue;
}
$ids .= $section->getIdArray();
$meta .= $section->getDataArray();
$blockLight .= $section->getLightArray();
$skyLight .= $section->getSkyLightArray();
}
$pk->payload = zlib_encode($ids . $meta . $blockLight . $skyLight . $biomeIds, ZLIB_ENCODING_DEFLATE, Level::$COMPRESSION_LEVEL);
$pk->primaryBitmap = $bitmap;
$this->putRawPacket($pk);*/
} elseif ($chunk instanceof McRegionChunk) {
$task = new McRegionToAnvil($this, $chunk);
$this->server->getScheduler()->scheduleAsyncTask($task);
} elseif ($chunk instanceof LevelDBChunk) {
$task = new LevelDBToAnvil($this, $chunk);
$this->server->getScheduler()->scheduleAsyncTask($task);
}
foreach ($chunk->getEntities() as $entity) {
if ($entity !== $this) {
$entity->spawnTo($this);
}
}
foreach ($chunk->getTiles() as $tile) {
if ($tile instanceof Spawnable) {
$tile->spawnTo($this);
}
}
}
if (count($this->usedChunks) >= 4 and $this->spawned === false) {
$this->bigBrother_setTitleBar(TextFormat::YELLOW . TextFormat::BOLD . "This is a beta version of BigBrother.", 0);
$this->spawned = true;
$pk = new SetTimePacket();
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk);
$pos = $this->level->getSafeSpawn($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
$this->teleport($ev->getRespawnPosition());
$this->sendSettings();
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, TextFormat::YELLOW . $this->getName() . " joined the game"));
if (strlen(trim($ev->getJoinMessage())) > 0) {
$this->server->broadcastMessage($ev->getJoinMessage());
}
$this->spawnToAll();
if ($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
$this->server->getUpdater()->showPlayerUpdate($this);
}
}
}
示例7: sendNextChunk
protected function sendNextChunk()
{
if ($this->connected === false) {
return;
}
$count = 0;
foreach ($this->loadQueue as $index => $distance) {
if ($count >= $this->chunksPerTick) {
break;
}
$X = null;
$Z = null;
Level::getXZ($index, $X, $Z);
if (!$this->level->isChunkPopulated($X, $Z)) {
$this->level->generateChunk($X, $Z);
if ($this->spawned) {
continue;
} else {
break;
}
}
++$count;
unset($this->loadQueue[$index]);
$this->usedChunks[$index] = false;
$this->level->useChunk($X, $Z, $this);
$this->level->requestChunk($X, $Z, $this, LevelProvider::ORDER_ZXY);
}
if (count($this->usedChunks) >= 56 and $this->spawned === false) {
$spawned = 0;
foreach ($this->usedChunks as $d) {
if ($d === true) {
$spawned++;
}
}
if ($spawned < 56) {
return;
}
$this->spawned = true;
$pk = new SetTimePacket();
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk);
$pos = $this->level->getSafeSpawn($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
$this->teleport($ev->getRespawnPosition());
$this->sendSettings();
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, TextFormat::YELLOW . $this->getName() . " joined the game"));
if (strlen(trim($ev->getJoinMessage())) > 0) {
$this->server->broadcastMessage($ev->getJoinMessage());
}
$this->spawnToAll();
if ($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
$this->server->getUpdater()->showPlayerUpdate($this);
}
}
}
示例8: sendNextChunk
protected function sendNextChunk()
{
if ($this->connected === false) {
return;
}
$count = 0;
foreach ($this->loadQueue as $index => $distance) {
if ($count >= $this->chunksPerTick) {
break;
}
$X = null;
$Z = null;
Level::getXZ($index, $X, $Z);
if (!$this->level->populateChunk($X, $Z)) {
if ($this->teleportPosition === null) {
continue;
} else {
break;
}
}
++$count;
unset($this->loadQueue[$index]);
$this->usedChunks[$index] = false;
$this->level->useChunk($X, $Z, $this);
$this->level->requestChunk($X, $Z, $this, LevelProvider::ORDER_ZXY);
}
if ($this->chunkLoadCount >= $this->spawnThreshold and $this->spawned === false and $this->teleportPosition === null) {
$this->spawned = true;
$this->sendSettings();
$this->sendPotionEffects($this);
$this->sendData($this);
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$pk = new SetTimePacket();
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk->setChannel(Network::CHANNEL_PRIORITY));
$pos = $this->level->getSafeSpawn($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
$this->teleport($ev->getRespawnPosition());
$pk = new PlayStatusPacket();
$pk->status = PlayStatusPacket::PLAYER_SPAWN;
$this->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_CHUNKS));
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, new TranslationContainer(TextFormat::YELLOW . "%multiplayer.player.joined", [$this->getDisplayName()])));
if (strlen(trim($ev->getJoinMessage())) > 0) {
$this->server->broadcastMessage($ev->getJoinMessage());
}
$this->noDamageTicks = 60;
foreach ($this->usedChunks as $index => $c) {
Level::getXZ($index, $chunkX, $chunkZ);
foreach ($this->level->getChunkEntities($chunkX, $chunkZ) as $entity) {
if ($entity !== $this and !$entity->closed and !$entity->dead) {
$entity->spawnTo($this);
}
}
}
$this->spawnToAll();
if ($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
$this->server->getUpdater()->showPlayerUpdate($this);
}
}
}
示例9: onJoin
public function onJoin(PlayerJoinEvent $event)
{
if ($event->getPlayer()->isOp()) {
return;
}
if (!isset($this->playerTemp[$event->getPlayer()->getName()])) {
$this->playerTemp[$event->getPlayer()->getName()] = $event->getPlayer();
}
if (!isset($this->nameCheck[$event->getPlayer()->getName()])) {
$this->nameCheck[$event->getPlayer()->getName()] = true;
$this->getServer()->getScheduler()->scheduleAsyncTask(new GentlemanAsyncTask($event->getPlayer()->getName(), $event->getJoinMessage(), $event->getPlayer()->getName(), $this->badQueue, $this->dictionary, "name", true));
$event->setJoinMessage("");
} else {
if (!$this->nameCheck[$event->getPlayer()->getName()]) {
$event->setCancelled();
return;
}
}
}
示例10: sendNextChunk
protected function sendNextChunk()
{
if ($this->connected === \false) {
return;
}
$count = 0;
foreach ($this->loadQueue as $index => $distance) {
if ($count >= $this->chunksPerTick) {
break;
}
$X = \null;
$Z = \null;
if (\PHP_INT_SIZE === 8) {
$X = $index >> 32 << 32 >> 32;
$Z = ($index & 0xffffffff) << 32 >> 32;
} else {
list($X, $Z) = \explode(":", $index);
$X = (int) $X;
$Z = (int) $Z;
}
++$count;
unset($this->loadQueue[$index]);
$this->usedChunks[$index] = \false;
$this->level->useChunk($X, $Z, $this);
$this->level->requestChunk($X, $Z, $this, LevelProvider::ORDER_ZXY);
}
if ($this->chunkLoadCount >= $this->spawnThreshold and $this->spawned === \false) {
$this->spawned = \true;
$this->sendSettings();
$this->sendPotionEffects($this);
$this->sendData($this);
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$pk = new SetTimePacket();
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == \false;
$this->dataPacket($pk->setChannel(Network::CHANNEL_PRIORITY));
$pos = $this->level->getSafeSpawn($this);
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
$this->teleport($ev->getRespawnPosition());
$pk = new PlayStatusPacket();
$pk->status = PlayStatusPacket::PLAYER_SPAWN;
$this->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_CHUNKS));
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, ""));
if (\strlen(\trim($ev->getJoinMessage())) > 0) {
$this->server->broadcastMessage($ev->getJoinMessage());
}
$this->noDamageTicks = 60;
foreach ($this->usedChunks as $index => $c) {
if (\PHP_INT_SIZE === 8) {
$chunkX = $index >> 32 << 32 >> 32;
$chunkZ = ($index & 0xffffffff) << 32 >> 32;
} else {
list($chunkX, $chunkZ) = \explode(":", $index);
$chunkX = (int) $chunkX;
$chunkZ = (int) $chunkZ;
}
foreach ($this->level->getChunkEntities($chunkX, $chunkZ) as $entity) {
if ($entity !== $this and !$entity->closed and !$entity->dead) {
$entity->spawnTo($this);
}
}
}
$this->spawnToAll();
if ($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
$this->server->getUpdater()->showPlayerUpdate($this);
}
}
}
示例11: sendNextChunk
/**
* Sends, if available, the next ordered chunk to the client
*
* WARNING: Do not use this, it's only for internal use.
* Changes to this function won't be recorded on the version.
*
*/
public function sendNextChunk()
{
if ($this->connected === false or !isset($this->chunkLoadTask)) {
return;
}
if (count($this->loadQueue) === 0) {
$this->chunkLoadTask->setNextRun($this->chunkLoadTask->getNextRun() + 30);
} else {
$count = 0;
$limit = (int) $this->server->getProperty("chunk-sending.per-tick", 4);
foreach ($this->loadQueue as $index => $distance) {
if ($count >= $limit) {
break;
}
++$count;
$X = null;
$Z = null;
Level::getXZ($index, $X, $Z);
if (!$this->getLevel()->isChunkPopulated($X, $Z)) {
continue;
}
unset($this->loadQueue[$index]);
$this->usedChunks[$index] = [false, 0];
$this->getLevel()->useChunk($X, $Z, $this);
$this->getLevel()->requestChunk($X, $Z, $this, LevelProvider::ORDER_ZXY);
}
}
if (count($this->usedChunks) < 16 and $this->spawned === true) {
$this->blocked = true;
} elseif ($this->spawned === true) {
$this->blocked = false;
//TODO: reason of block to revert
}
if (count($this->usedChunks) >= 56 and $this->spawned === false) {
$spawned = 0;
foreach ($this->usedChunks as $d) {
if ($d[0] === true) {
$spawned++;
}
}
if ($spawned < 56) {
return;
}
$this->spawned = true;
$this->blocked = false;
$pk = new SetTimePacket();
$pk->time = $this->getLevel()->getTime();
$pk->started = $this->getLevel()->stopTime == false;
$this->dataPacket($pk);
$pos = new Position($this->x, $this->y, $this->z, $this->getLevel());
$pos = $this->getLevel()->getSafeSpawn($pos);
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
$this->teleport($ev->getRespawnPosition());
$this->sendSettings();
$this->inventory->sendContents($this);
$this->inventory->sendArmorContents($this);
$this->spawnToAll();
$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, TextFormat::YELLOW . $this->getName() . " joined the game"));
if (strlen(trim($ev->getJoinMessage())) > 0) {
$this->server->broadcastMessage($ev->getJoinMessage());
}
if ($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
$this->server->getUpdater()->showPlayerUpdate($this);
}
}
}
示例12: onPlayerJoin
/**
* @param PlayerJoinEvent $event
*
* @priority HIGHEST
*/
public function onPlayerJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
//Motd Update
//Check if Motd message is custom
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());
//Join Message
$status = 0;
CustomAlerts::getAPI()->setJoinMessage($event->getJoinMessage());
//Get First Join
if (CustomAlerts::getAPI()->hasJoinedFirstTime($player)) {
//Register FirstJoin
CustomAlerts::getAPI()->registerFirstJoin($player);
//Check if FirstJoin message is enabled
if (CustomAlerts::getAPI()->isDefaultFirstJoinMessageEnabled()) {
CustomAlerts::getAPI()->setJoinMessage(CustomAlerts::getAPI()->getDefaultFirstJoinMessage($player));
$status = 1;
}
}
//Default Join Message
if ($status == 0) {
//Check if Join message is hidden
if (CustomAlerts::getAPI()->isDefaultJoinMessageHidden()) {
CustomAlerts::getAPI()->setJoinMessage("");
} else {
//Check if Join message is custom
if (CustomAlerts::getAPI()->isDefaultJoinMessageCustom()) {
CustomAlerts::getAPI()->setJoinMessage(CustomAlerts::getAPI()->getDefaultJoinMessage($player));
}
}
}
//Join Event
$this->plugin->getServer()->getPluginManager()->callEvent(new CustomAlertsJoinEvent($player, $event->getJoinMessage()));
$event->setJoinMessage(CustomAlerts::getAPI()->getJoinMessage());
}