public function onPlayerAchievementAwardedEvent(PlayerAchievementAwardedEvent $event)
 {
     $message = new TranslationContainer("chat.type.achievement", [$event->getPlayer()->getDisplayName(), TextFormat::GREEN . Achievement::$list[$event->getAchievement()]["name"]]);
     if ($message instanceof TranslationContainer) {
         $message = $this->getServer()->getLanguage()->translateString($message->getText(), $message->getParameters());
     }
     AnnounceSystem::getInstance()->pushBroadCastPopup($message, 2);
 }
Beispiel #2
0
 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     $this->initMessage();
     $this->registerCommand($this->get("commands-announce"), "AnnouncePro", "announcepro");
     $this->config = new Config($this->getDataFolder() . "announce.yml", Config::YAML, ["enable" => true, "repeat-second" => 5, "prefix" => $this->get("default-prefix"), "suffix" => "", "announce" => []]);
     $this->configData = $this->config->getAll();
     $this->callback = $this->getServer()->getScheduler()->scheduleRepeatingTask(new AnnounceProTask($this), $this->configData["repeat-second"] * 20);
     $this->callback = $this->getServer()->getScheduler()->scheduleRepeatingTask(new PopupProcessTask($this), 10);
     new AnnounceSystem();
     $this->announceSystem = AnnounceSystem::getInstance();
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
 }