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!')); }
public function dropIn($player) { $this->represent = $player; StormCore::callEvent(new FuturePlayerLoadEvent($player, $this)); }
public function handleAuthCallback($result) { if ($result->code != 200) { $this->authenticated = false; StormCore::callEvent(new PlayerAuthenticationErrorEvent($this, StormClient::teaseError($result->response))); return; } $this->loadJson($result->response); }
/** * @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()); }
/** * @param $player Player */ private function initPlayer($player) { StormCore::log($player->getName() . " init"); $this->players[$player->getName()] = StormPlayer::withPlayer($player); }