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
11 changes: 5 additions & 6 deletions src/VectorNetworkProject/TheMix/TheMix.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace VectorNetworkProject\TheMix;


use pocketmine\plugin\PluginBase;
use pocketmine\utils\TextFormat;
use VectorNetworkProject\TheMix\command\PingCommand;
Expand All @@ -25,14 +24,14 @@ class TheMix extends PluginBase
public function onLoad()
{
self::$instance = $this;
$this->getLogger()->notice("Loading System...");
$this->getLogger()->notice('Loading System...');
}

public function onEnable()
{
$this->registerCommands();
$this->registerEvents();
$this->getLogger()->notice(TextFormat::AQUA . '
$this->getLogger()->notice(TextFormat::AQUA.'


███ ▄█ █▄ ▄████████ ▄▄▄▄███▄▄▄▄ ▄█ ▀████ ▐████▀
Expand All @@ -50,13 +49,13 @@ public function onEnable()

public function onDisable()
{
$this->getLogger()->notice("Unload System...");
$this->getLogger()->notice('Unload System...');
}

/**
* @return TheMix
*/
public static function getInstance(): TheMix
public static function getInstance(): self
{
return self::$instance;
}
Expand All @@ -65,7 +64,7 @@ private function registerCommands(): void
{
$commands = [
new PingCommand($this),
new TpsCommand($this)
new TpsCommand($this),
];
$this->getServer()->getCommandMap()->registerAll($this->getName(), $commands);
}
Expand Down
7 changes: 4 additions & 3 deletions src/VectorNetworkProject/TheMix/command/PingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace VectorNetworkProject\TheMix\command;


use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\Player;
Expand All @@ -27,10 +26,12 @@ public function __construct(Plugin $owner)
public function execute(CommandSender $sender, string $commandLabel, array $args): bool
{
if (!$sender instanceof Player) {
$sender->sendMessage(TextFormat::RED . "このコマンドはプレイヤーのみ実行可能です。");
$sender->sendMessage(TextFormat::RED.'このコマンドはプレイヤーのみ実行可能です。');

return true;
}
$sender->sendMessage(TextFormat::RED . $sender->getPing() . TextFormat::YELLOW . "ms");
$sender->sendMessage(TextFormat::RED.$sender->getPing().TextFormat::YELLOW.'ms');

return true;
}
}
4 changes: 2 additions & 2 deletions src/VectorNetworkProject/TheMix/command/TpsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace VectorNetworkProject\TheMix\command;


use pocketmine\command\CommandSender;
use pocketmine\command\PluginCommand;
use pocketmine\plugin\Plugin;
Expand All @@ -26,7 +25,8 @@ public function __construct(Plugin $owner)

public function execute(CommandSender $sender, string $commandLabel, array $args): bool
{
$sender->sendMessage(TextFormat::GREEN . 'TPS: ' . Server::getInstance()->getTicksPerSecond() . '/20');
$sender->sendMessage(TextFormat::GREEN.'TPS: '.Server::getInstance()->getTicksPerSecond().'/20');

return true;
}
}
10 changes: 5 additions & 5 deletions src/VectorNetworkProject/TheMix/event/ThePlayerJoinEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace VectorNetworkProject\TheMix\event;


use Miste\scoreboardspe\API\Scoreboard;
use Miste\scoreboardspe\API\ScoreboardAction;
use Miste\scoreboardspe\API\ScoreboardDisplaySlot;
use Miste\scoreboardspe\API\ScoreboardSort;
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerJoinEvent;
use Miste\scoreboardspe\API\{
Scoreboard, ScoreboardDisplaySlot, ScoreboardSort, ScoreboardAction
};
use VectorNetworkProject\TheMix\task\UpdateScoreboardTask;
use VectorNetworkProject\TheMix\TheMix;

Expand All @@ -22,7 +22,7 @@ class ThePlayerJoinEvent implements Listener
public function event(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
$scoreboard = new Scoreboard(TheMix::getInstance()->getServer()->getPluginManager()->getPlugin("ScoreboardsPE")->getPlugin(), "§l§7=== §6THE §aM§cI§eX §7===", ScoreboardAction::CREATE);
$scoreboard = new Scoreboard(TheMix::getInstance()->getServer()->getPluginManager()->getPlugin('ScoreboardsPE')->getPlugin(), '§l§7=== §6THE §aM§cI§eX §7===', ScoreboardAction::CREATE);
$scoreboard->create(ScoreboardDisplaySlot::SIDEBAR, ScoreboardSort::DESCENDING);
$scoreboard->addDisplay($player);
TheMix::getInstance()->getScheduler()->scheduleRepeatingTask(new UpdateScoreboardTask($scoreboard, $player), 20);
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\Listener;
use pocketmine\event\player\PlayerLoginEvent;
use VectorNetworkProject\TheMix\provider\DataFile;
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\Listener;
use pocketmine\event\player\PlayerQuitEvent;

Expand Down
3 changes: 1 addition & 2 deletions src/VectorNetworkProject/TheMix/lib/database/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@

namespace VectorNetworkProject\TheMix\lib\database;


use VectorNetworkProject\TheMix\TheMix;

abstract class Provider
{
protected static function getPath(string $folder, string $type): string
{
return TheMix::getInstance()->getDataFolder() . '/' . $folder . '/' . $type . '/';
return TheMix::getInstance()->getDataFolder().'/'.$folder.'/'.$type.'/';
}
}
12 changes: 11 additions & 1 deletion src/VectorNetworkProject/TheMix/lib/sound/LevelSounds.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

namespace VectorNetworkProject\TheMix\lib\sound;


use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\Player;

class LevelSounds
{
/**
* @param Player $player
*
* @return void
*/
public static function LevelUp(Player $player): void
Expand All @@ -29,6 +29,7 @@ public static function LevelUp(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Anvil(Player $player): void
Expand All @@ -41,6 +42,7 @@ public static function Anvil(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Travle(Player $player): void
Expand All @@ -53,6 +55,7 @@ public static function Travle(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function EndPortalSpawn(Player $player): void
Expand All @@ -65,6 +68,7 @@ public static function EndPortalSpawn(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Portal(Player $player): void
Expand All @@ -77,6 +81,7 @@ public static function Portal(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Thunder(Player $player): void
Expand All @@ -89,6 +94,7 @@ public static function Thunder(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Remedy(Player $player): void
Expand All @@ -101,6 +107,7 @@ public static function Remedy(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Launch(Player $player): void
Expand All @@ -113,6 +120,7 @@ public static function Launch(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Blast(Player $player): void
Expand All @@ -125,6 +133,7 @@ public static function Blast(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function LargeBlast(Player $player): void
Expand All @@ -137,6 +146,7 @@ public static function LargeBlast(Player $player): void

/**
* @param Player $player
*
* @return void
*/
public static function Twinklt(Player $player): void
Expand Down
1 change: 0 additions & 1 deletion src/VectorNetworkProject/TheMix/provider/DataFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace VectorNetworkProject\TheMix\provider;


interface DataFile
{
public const PLAYER_LEVEL = 'Level';
Expand Down
40 changes: 25 additions & 15 deletions src/VectorNetworkProject/TheMix/provider/JSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace VectorNetworkProject\TheMix\provider;


use pocketmine\utils\Config;
use pocketmine\utils\MainLogger;
use VectorNetworkProject\TheMix\lib\database\Provider;
Expand All @@ -23,38 +22,42 @@ class JSON extends Provider

/**
* JSON constructor.
*
* @param string $xuid
* @param string $file
*/
public function __construct(string $xuid, string $file)
{
$this->path = self::getPath('datas', 'json') . $xuid . '/';
$this->file = $file . '.json';
$this->path = self::getPath('datas', 'json').$xuid.'/';
$this->file = $file.'.json';
}

public function init(array $data = []): void
{
if (!$this->hasTable()) $this->createTable($data);
if (!$this->hasTable()) {
$this->createTable($data);
}
}

/**
* @param array $table
*
* @return void
*/
public function createTable(array $table = []): void
{
@mkdir($this->path, 0755, true);
$config = new Config($this->path . $this->file, Config::JSON, $table);
$config = new Config($this->path.$this->file, Config::JSON, $table);
$config->save();
MainLogger::getLogger()->debug("[PROVIDER] Create ".$this->file);
MainLogger::getLogger()->debug('[PROVIDER] Create '.$this->file);
}

/**
* @return bool
*/
public function hasTable(): bool
{
return file_exists($this->path . $this->file)
return file_exists($this->path.$this->file)
? true
: false;
}
Expand All @@ -64,27 +67,29 @@ public function hasTable(): bool
*/
public function deleteTable(): void
{
unlink($this->path . $this->file);
unlink($this->path.$this->file);
}

/**
* @param string $key
* @param string $key
* @param bool|mixed $data
*/
public function set(string $key, $data): void
{
$config = new Config($this->path . $this->file, Config::JSON);
$config = new Config($this->path.$this->file, Config::JSON);
$config->set($key, $data);
$config->save();
}

/**
* @param string $key
*
* @return bool|mixed
*/
public function get(string $key)
{
$config = new Config($this->path . $this->file, Config::JSON);
$config = new Config($this->path.$this->file, Config::JSON);

return $config->get($key);
}

Expand All @@ -93,7 +98,8 @@ public function get(string $key)
*/
public function getAll(): array
{
$config = new Config($this->path . $this->file, Config::JSON);
$config = new Config($this->path.$this->file, Config::JSON);

return $config->getAll();
}

Expand All @@ -102,29 +108,33 @@ public function getAll(): array
*/
public function getKeys(): array
{
$config = new Config($this->path . $this->file, Config::JSON);
$config = new Config($this->path.$this->file, Config::JSON);

return $config->getAll(true);
}

/**
* @param string $key
*
* @return bool
*/
public function exists(string $key): bool
{
$config = new Config($this->path . $this->file, Config::JSON);
$config = new Config($this->path.$this->file, Config::JSON);

return $config->exists($key)
? true
: false;
}

/**
* @param string $key
*
* @return void
*/
public function remove(string $key): void
{
$config = new Config($this->path . $this->file, Config::JSON);
$config = new Config($this->path.$this->file, Config::JSON);
$config->remove($key);
}
}
Loading