public function __construct() { foreach (StormCore::getInstance()->getServer()->getOnlinePlayers() as $player) { $this->initPlayer($player); } StormCore::registerListener($this); }
public final function onCommand0(CommandSender $sender, array $args) { //do sub command handling if (sizeof($args) > 0) { foreach ($this->subCommands as $subCommand) { if ($subCommand->getName() === $args[0]) { $subCommand->getCommandHandler()->onCommand0($sender, array_slice($args, 1)); return; } } } try { $this->handleCommandUnspecific($sender, $args); if ($sender instanceof Player) { $this->handleCommandPlayer(StormCore::getInstance()->getPlayerManager()->getPlayerByPlayer($sender), $args); } if ($sender instanceof ConsoleCommandSender) { $this->handleCommandConsole($sender, $args); } } catch (StormCommandException $e) { $sender->sendMessage($e->messageFor($sender)); } }
public static function withPath($path) { return new StormFormatter(StormCore::getInstance()->getFormats()->get($path, 'Not found!')); }
/** * @return Player */ public function getPocketMinePlayer() { return StormCore::getInstance()->getServer()->getPlayerExact($this->username); }
/** * @param object[] $punishmentsJson * @return StormOfflinePlayer */ protected function setPunishmentsJson($punishmentsJson) { $punishments = array(); $playerManager = StormCore::getInstance()->getPlayerManager(); foreach ($punishmentsJson as $punishment) { $punishments[] = new StormPunishment($punishment->Reason, $playerManager->getPlayerByJSON($punishment->Punisher), $playerManager->getPlayerByJSON($punishment->Target), $punishment->Type, $punishment->ExpirationDate); } $this->punishments = $punishments; return $this; }
public function onPlayerAuthenticate(PlayerAuthenticateEvent $event) { $player = $event->getPlayer()->getPocketMinePlayer(); StormCore::getInstance()->getServer()->broadcastMessage(StormFormatter::withPath("player-join")->with("player", $player->getName())->withPrefix(false)->get()); $player->setOp($event->getPlayer()->isOperator()); $player->sendMessage(StormFormatter::withPath("player-login")->get()); }