public function onAwardAchievement(PlayerAchievementAwardedEvent $event) { if ($this->plugin->getConfig()->getAll()["block-all-events"]) { if (!ServerAuth::getAPI()->isPlayerRegistered($event->getPlayer()->getName()) || !ServerAuth::getAPI()->isPlayerAuthenticated($event->getPlayer())) { $event->setCancelled(true); } } }
public function PlayerAchievementAwardedEvent(PlayerAchievementAwardedEvent $event) { $player = $event->getPlayer(); $achievement = $event->getAchievement(); if ($this->config->get("PlayerAchievementAwardedEvent", true)) { if ($player instanceof Player) { $event->setCancelled(true); $player->sendTip($this->prefix . "§5§lYou have {$achievement} awarded!"); $player->getLevel()->addSound(new PopSound($player)); } } }