public function getFormattedMessage(Player $player, $message)
 {
     $this->config = ccMain::getInstance()->getCfg();
     $format = $this->config->get("chat-format");
     $this->playerConfig = ccMain::getInstance()->getPlCfg($player->getName());
     // $format = "<{PREFIX} {USER_NAME}> {MESSAGE}";
     if (!$this->pureperms) {
         $format = str_replace("{PurePerms}", "NoGroup", $format);
     }
     if ($this->pureperms) {
         $isMultiWorldEnabled = $this->pureperms->getConfig()->get("enable-multiworld-formats");
         $levelName = $isMultiWorldEnabled ? $player->getLevel()->getName() : null;
         $format = str_replace("{PurePerms}", $this->pureperms->getUser($player)->getGroup($levelName)->getName(), $format);
     } else {
         return false;
     }
     if ($this->killchat) {
         $format = str_replace("{Kills}", KillChat::getInstance()->getKills($player->getName()), $format);
     } else {
         $format = str_replace("{Kills}", "ERROR", $format);
     }
     if ($this->killchat) {
         $format = str_replace("{Deaths}", KillChat::getInstance()->getDeaths($player->getName()), $format);
     } else {
         $format = str_replace("{Deaths}", "ERROR", $format);
     }
     if ($this->massive) {
         $format = str_replace("{Money}", MassiveEconomyAPI::getInstance()->getMoney($player->getName()), $format);
     } else {
         $format = str_replace("{Money}", "ERROR", $format);
     }
     if ($this->factionspro == true && $this->factionspro->isInFaction($player->getName())) {
         $getUserFaction = $this->factionspro->getPlayerFaction($player->getName());
         $format = str_replace("{FACTION}", $getUserFaction, $format);
     } else {
         $nofac = $this->config->get("if-player-has-no-faction");
         $format = str_replace("{FACTION}", $nofac, $format);
     }
     $format = str_replace("{WORLD_NAME}", $player->getLevel()->getName(), $format);
     $nick = $this->config->get($player->getName() > ".nick");
     if ($nick != null) {
         $format = str_replace("{DISPLAY_NAME}", $nick, $format);
     } else {
         $format = str_replace("{DISPLAY_NAME}", $player->getName(), $format);
     }
     $format = str_replace("{MESSAGE}", $message, $format);
     $level = $player->getLevel()->getName();
     // LOST FORMAT TAGS REMOVED
     $tags = null;
     $playerTags = $this->playerConfig->get($player->getName() . ".tags");
     if ($playerTags != null) {
         $tags = $playerTags;
     } else {
         //use default tags
         $tags = $this->config->get("default-player-tags");
     }
     if ($tags == null) {
         $tags = "";
     }
     $format = str_replace("{TAGS}", $tags, $format);
     $prefix = null;
     $this->playerConfig = ccMain::getInstance()->getPlCfg($player->getName());
     $playerPrefix = $this->playerConfig->get($player->getName() . ".prefix");
     if ($playerPrefix != null) {
         $prefix = $playerPrefix;
     } else {
         //use default prefix
         $prefix = $this->config->get("default-player-prefix");
     }
     if ($prefix == null) {
         $prefix = "";
     }
     $format = str_replace("{PREFIX}", $prefix, $format);
     return $format;
 }
 public function onRegisterPrefix()
 {
     EssentialsPEChat::getInstance()->replacePrefix("{MONEY}", MassiveEconomyAPI::getInstance()->getMoney(EssentialsPEChat::getInstance()->getCurrentEvent()->getPlayer()->getName()));
 }