Skip to content
This repository was archived by the owner on Feb 8, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace VectorNetworkProject\TheMix\command\defaults;


use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\level\Position;
Expand All @@ -32,13 +31,14 @@ public function __construct(Plugin $owner)
{
parent::__construct('moderator', $owner);
$this->setDescription('モデレーター専用メニュー(管理権限持ちのユーザー以外使用不可能)');
$this->setPermission(Permissions::ADMIN . 'moderator');
$this->setPermission(Permissions::ADMIN.'moderator');
}

/**
* @param CommandSender $sender
* @param string $commandLabel
* @param array $args
* @param string $commandLabel
* @param array $args
*
* @return bool|mixed
*/
public function execute(CommandSender $sender, string $commandLabel, array $args)
Expand All @@ -48,14 +48,17 @@ public function execute(CommandSender $sender, string $commandLabel, array $args
}
$sender instanceof Player
? self::sendModeratorUI($sender)
: $sender->sendMessage(TextFormat::RED . 'プレイヤーのみ実行可能です。') ;
: $sender->sendMessage(TextFormat::RED.'プレイヤーのみ実行可能です。');

return true;
}

public static function sendModeratorUI(Player $player): void
{
$form = FormApi::makeListForm(function (Player $player, ?int $data) {
if (FormApi::formCancelled($data)) return;
if (FormApi::formCancelled($data)) {
return;
}
switch ($data) {
case 0:
self::sendLevelManagerUI($player);
Expand All @@ -71,7 +74,9 @@ public static function sendModeratorUI(Player $player): void
public static function sendLevelManagerUI(Player $player): void
{
$form = FormApi::makeListForm(function (Player $player, ?int $data) {
if (FormApi::formCancelled($data)) return;
if (FormApi::formCancelled($data)) {
return;
}
switch ($data) {
case 0:
$player->teleport(Server::getInstance()->getDefaultLevel()->getSpawnLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace VectorNetworkProject\TheMix\event;


use pocketmine\event\block\BlockPlaceEvent;
use pocketmine\event\Listener;
use pocketmine\math\Vector2;
Expand Down
28 changes: 17 additions & 11 deletions src/VectorNetworkProject/TheMix/game/DefaultConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public static function init()
{
$db = new YAML();
$db->init([
'version' => TheMix::PLUGIN_CONFIG_VERSION,
'develop-mode' => true,
'version' => TheMix::PLUGIN_CONFIG_VERSION,
'develop-mode' => true,
'stage-world-name' => 'stage',
'event-time' => 30,
'red' => [
'event-time' => 30,
'red' => [
'safe' => [
'x' => 353,
'z' => 203,
'x' => 353,
'z' => 203,
'diameter' => 30,
],
'spawn' => [
Expand All @@ -48,12 +48,12 @@ public static function init()
'x' => 215,
'y' => 445,
'z' => 455,
]
],
],
'blue' => [
'safe' => [
'x' => 157,
'z' => 203,
'x' => 157,
'z' => 203,
'diameter' => 30,
],
'spawn' => [
Expand All @@ -65,14 +65,15 @@ public static function init()
'x' => 215,
'y' => 445,
'z' => 455,
]
]
],
],
]);
}

public static function getStageLevelName(): string
{
$db = new YAML();

return $db->get(self::STAGE_NAME);
}

Expand All @@ -82,32 +83,37 @@ public static function getStageLevelName(): string
public static function getStageWorld(): ?Level
{
$db = new YAML();

return Server::getInstance()->getLevelByName($db->get(self::STAGE_NAME));
}

public static function isDev(): bool
{
$db = new YAML();

return $db->get(self::DEVELOP_MODE);
}

public static function getEventTime(): int
{
$db = new YAML();

return $db->get(self::EVENT_TIME);
}

public static function getRedSafe(): array
{
$db = new YAML();
$safe = $db->get(self::RED);

return $safe['safe'];
}

public static function getBlueSafe(): array
{
$db = new YAML();
$safe = $db->get(self::BLUE);

return $safe['safe'];
}
}