Skip to content
This repository was archived by the owner on Feb 8, 2019. It is now read-only.

Commit 75af2cf

Browse files
authored
Merge pull request #1 from VectorNetworkProject/analysis-qg9Kl1
Apply fixes from StyleCI
2 parents 247465a + 5ccb909 commit 75af2cf

File tree

12 files changed

+80
-57
lines changed

12 files changed

+80
-57
lines changed

src/VectorNetworkProject/TheMix/TheMix.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace VectorNetworkProject\TheMix;
1010

11-
1211
use pocketmine\plugin\PluginBase;
1312
use pocketmine\utils\TextFormat;
1413
use VectorNetworkProject\TheMix\command\PingCommand;
@@ -25,14 +24,14 @@ class TheMix extends PluginBase
2524
public function onLoad()
2625
{
2726
self::$instance = $this;
28-
$this->getLogger()->notice("Loading System...");
27+
$this->getLogger()->notice('Loading System...');
2928
}
3029

3130
public function onEnable()
3231
{
3332
$this->registerCommands();
3433
$this->registerEvents();
35-
$this->getLogger()->notice(TextFormat::AQUA . '
34+
$this->getLogger()->notice(TextFormat::AQUA.'
3635
3736
3837
███ ▄█ █▄ ▄████████ ▄▄▄▄███▄▄▄▄ ▄█ ▀████ ▐████▀
@@ -50,13 +49,13 @@ public function onEnable()
5049

5150
public function onDisable()
5251
{
53-
$this->getLogger()->notice("Unload System...");
52+
$this->getLogger()->notice('Unload System...');
5453
}
5554

5655
/**
5756
* @return TheMix
5857
*/
59-
public static function getInstance(): TheMix
58+
public static function getInstance(): self
6059
{
6160
return self::$instance;
6261
}
@@ -65,7 +64,7 @@ private function registerCommands(): void
6564
{
6665
$commands = [
6766
new PingCommand($this),
68-
new TpsCommand($this)
67+
new TpsCommand($this),
6968
];
7069
$this->getServer()->getCommandMap()->registerAll($this->getName(), $commands);
7170
}

src/VectorNetworkProject/TheMix/command/PingCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace VectorNetworkProject\TheMix\command;
1010

11-
1211
use pocketmine\command\CommandSender;
1312
use pocketmine\command\PluginCommand;
1413
use pocketmine\Player;
@@ -27,10 +26,12 @@ public function __construct(Plugin $owner)
2726
public function execute(CommandSender $sender, string $commandLabel, array $args): bool
2827
{
2928
if (!$sender instanceof Player) {
30-
$sender->sendMessage(TextFormat::RED . "このコマンドはプレイヤーのみ実行可能です。");
29+
$sender->sendMessage(TextFormat::RED.'このコマンドはプレイヤーのみ実行可能です。');
30+
3131
return true;
3232
}
33-
$sender->sendMessage(TextFormat::RED . $sender->getPing() . TextFormat::YELLOW . "ms");
33+
$sender->sendMessage(TextFormat::RED.$sender->getPing().TextFormat::YELLOW.'ms');
34+
3435
return true;
3536
}
3637
}

src/VectorNetworkProject/TheMix/command/TpsCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace VectorNetworkProject\TheMix\command;
1010

11-
1211
use pocketmine\command\CommandSender;
1312
use pocketmine\command\PluginCommand;
1413
use pocketmine\plugin\Plugin;
@@ -26,7 +25,8 @@ public function __construct(Plugin $owner)
2625

2726
public function execute(CommandSender $sender, string $commandLabel, array $args): bool
2827
{
29-
$sender->sendMessage(TextFormat::GREEN . 'TPS: ' . Server::getInstance()->getTicksPerSecond() . '/20');
28+
$sender->sendMessage(TextFormat::GREEN.'TPS: '.Server::getInstance()->getTicksPerSecond().'/20');
29+
3030
return true;
3131
}
3232
}

src/VectorNetworkProject/TheMix/event/ThePlayerJoinEvent.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
namespace VectorNetworkProject\TheMix\event;
1010

11-
11+
use Miste\scoreboardspe\API\Scoreboard;
12+
use Miste\scoreboardspe\API\ScoreboardAction;
13+
use Miste\scoreboardspe\API\ScoreboardDisplaySlot;
14+
use Miste\scoreboardspe\API\ScoreboardSort;
1215
use pocketmine\event\Listener;
1316
use pocketmine\event\player\PlayerJoinEvent;
14-
use Miste\scoreboardspe\API\{
15-
Scoreboard, ScoreboardDisplaySlot, ScoreboardSort, ScoreboardAction
16-
};
1717
use VectorNetworkProject\TheMix\task\UpdateScoreboardTask;
1818
use VectorNetworkProject\TheMix\TheMix;
1919

@@ -22,7 +22,7 @@ class ThePlayerJoinEvent implements Listener
2222
public function event(PlayerJoinEvent $event)
2323
{
2424
$player = $event->getPlayer();
25-
$scoreboard = new Scoreboard(TheMix::getInstance()->getServer()->getPluginManager()->getPlugin("ScoreboardsPE")->getPlugin(), "§l§7=== §6THE §aM§cI§eX §7===", ScoreboardAction::CREATE);
25+
$scoreboard = new Scoreboard(TheMix::getInstance()->getServer()->getPluginManager()->getPlugin('ScoreboardsPE')->getPlugin(), '§l§7=== §6THE §aM§cI§eX §7===', ScoreboardAction::CREATE);
2626
$scoreboard->create(ScoreboardDisplaySlot::SIDEBAR, ScoreboardSort::DESCENDING);
2727
$scoreboard->addDisplay($player);
2828
TheMix::getInstance()->getScheduler()->scheduleRepeatingTask(new UpdateScoreboardTask($scoreboard, $player), 20);

src/VectorNetworkProject/TheMix/event/ThePlayerLoginEvent.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace VectorNetworkProject\TheMix\event;
1010

11-
1211
use pocketmine\event\Listener;
1312
use pocketmine\event\player\PlayerLoginEvent;
1413
use VectorNetworkProject\TheMix\provider\DataFile;

src/VectorNetworkProject/TheMix/event/ThePlayerQuitEvent.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace VectorNetworkProject\TheMix\event;
1010

11-
1211
use pocketmine\event\Listener;
1312
use pocketmine\event\player\PlayerQuitEvent;
1413

src/VectorNetworkProject/TheMix/lib/database/Provider.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88

99
namespace VectorNetworkProject\TheMix\lib\database;
1010

11-
1211
use VectorNetworkProject\TheMix\TheMix;
1312

1413
abstract class Provider
1514
{
1615
protected static function getPath(string $folder, string $type): string
1716
{
18-
return TheMix::getInstance()->getDataFolder() . '/' . $folder . '/' . $type . '/';
17+
return TheMix::getInstance()->getDataFolder().'/'.$folder.'/'.$type.'/';
1918
}
2019
}

src/VectorNetworkProject/TheMix/lib/sound/LevelSounds.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
namespace VectorNetworkProject\TheMix\lib\sound;
1010

11-
1211
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
1312
use pocketmine\Player;
1413

1514
class LevelSounds
1615
{
1716
/**
1817
* @param Player $player
18+
*
1919
* @return void
2020
*/
2121
public static function LevelUp(Player $player): void
@@ -29,6 +29,7 @@ public static function LevelUp(Player $player): void
2929

3030
/**
3131
* @param Player $player
32+
*
3233
* @return void
3334
*/
3435
public static function Anvil(Player $player): void
@@ -41,6 +42,7 @@ public static function Anvil(Player $player): void
4142

4243
/**
4344
* @param Player $player
45+
*
4446
* @return void
4547
*/
4648
public static function Travle(Player $player): void
@@ -53,6 +55,7 @@ public static function Travle(Player $player): void
5355

5456
/**
5557
* @param Player $player
58+
*
5659
* @return void
5760
*/
5861
public static function EndPortalSpawn(Player $player): void
@@ -65,6 +68,7 @@ public static function EndPortalSpawn(Player $player): void
6568

6669
/**
6770
* @param Player $player
71+
*
6872
* @return void
6973
*/
7074
public static function Portal(Player $player): void
@@ -77,6 +81,7 @@ public static function Portal(Player $player): void
7781

7882
/**
7983
* @param Player $player
84+
*
8085
* @return void
8186
*/
8287
public static function Thunder(Player $player): void
@@ -89,6 +94,7 @@ public static function Thunder(Player $player): void
8994

9095
/**
9196
* @param Player $player
97+
*
9298
* @return void
9399
*/
94100
public static function Remedy(Player $player): void
@@ -101,6 +107,7 @@ public static function Remedy(Player $player): void
101107

102108
/**
103109
* @param Player $player
110+
*
104111
* @return void
105112
*/
106113
public static function Launch(Player $player): void
@@ -113,6 +120,7 @@ public static function Launch(Player $player): void
113120

114121
/**
115122
* @param Player $player
123+
*
116124
* @return void
117125
*/
118126
public static function Blast(Player $player): void
@@ -125,6 +133,7 @@ public static function Blast(Player $player): void
125133

126134
/**
127135
* @param Player $player
136+
*
128137
* @return void
129138
*/
130139
public static function LargeBlast(Player $player): void
@@ -137,6 +146,7 @@ public static function LargeBlast(Player $player): void
137146

138147
/**
139148
* @param Player $player
149+
*
140150
* @return void
141151
*/
142152
public static function Twinklt(Player $player): void

src/VectorNetworkProject/TheMix/provider/DataFile.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace VectorNetworkProject\TheMix\provider;
1010

11-
1211
interface DataFile
1312
{
1413
public const PLAYER_LEVEL = 'Level';

src/VectorNetworkProject/TheMix/provider/JSON.php

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace VectorNetworkProject\TheMix\provider;
1010

11-
1211
use pocketmine\utils\Config;
1312
use pocketmine\utils\MainLogger;
1413
use VectorNetworkProject\TheMix\lib\database\Provider;
@@ -23,38 +22,42 @@ class JSON extends Provider
2322

2423
/**
2524
* JSON constructor.
25+
*
2626
* @param string $xuid
2727
* @param string $file
2828
*/
2929
public function __construct(string $xuid, string $file)
3030
{
31-
$this->path = self::getPath('datas', 'json') . $xuid . '/';
32-
$this->file = $file . '.json';
31+
$this->path = self::getPath('datas', 'json').$xuid.'/';
32+
$this->file = $file.'.json';
3333
}
3434

3535
public function init(array $data = []): void
3636
{
37-
if (!$this->hasTable()) $this->createTable($data);
37+
if (!$this->hasTable()) {
38+
$this->createTable($data);
39+
}
3840
}
3941

4042
/**
4143
* @param array $table
44+
*
4245
* @return void
4346
*/
4447
public function createTable(array $table = []): void
4548
{
4649
@mkdir($this->path, 0755, true);
47-
$config = new Config($this->path . $this->file, Config::JSON, $table);
50+
$config = new Config($this->path.$this->file, Config::JSON, $table);
4851
$config->save();
49-
MainLogger::getLogger()->debug("[PROVIDER] Create ".$this->file);
52+
MainLogger::getLogger()->debug('[PROVIDER] Create '.$this->file);
5053
}
5154

5255
/**
5356
* @return bool
5457
*/
5558
public function hasTable(): bool
5659
{
57-
return file_exists($this->path . $this->file)
60+
return file_exists($this->path.$this->file)
5861
? true
5962
: false;
6063
}
@@ -64,27 +67,29 @@ public function hasTable(): bool
6467
*/
6568
public function deleteTable(): void
6669
{
67-
unlink($this->path . $this->file);
70+
unlink($this->path.$this->file);
6871
}
6972

7073
/**
71-
* @param string $key
74+
* @param string $key
7275
* @param bool|mixed $data
7376
*/
7477
public function set(string $key, $data): void
7578
{
76-
$config = new Config($this->path . $this->file, Config::JSON);
79+
$config = new Config($this->path.$this->file, Config::JSON);
7780
$config->set($key, $data);
7881
$config->save();
7982
}
8083

8184
/**
8285
* @param string $key
86+
*
8387
* @return bool|mixed
8488
*/
8589
public function get(string $key)
8690
{
87-
$config = new Config($this->path . $this->file, Config::JSON);
91+
$config = new Config($this->path.$this->file, Config::JSON);
92+
8893
return $config->get($key);
8994
}
9095

@@ -93,7 +98,8 @@ public function get(string $key)
9398
*/
9499
public function getAll(): array
95100
{
96-
$config = new Config($this->path . $this->file, Config::JSON);
101+
$config = new Config($this->path.$this->file, Config::JSON);
102+
97103
return $config->getAll();
98104
}
99105

@@ -102,29 +108,33 @@ public function getAll(): array
102108
*/
103109
public function getKeys(): array
104110
{
105-
$config = new Config($this->path . $this->file, Config::JSON);
111+
$config = new Config($this->path.$this->file, Config::JSON);
112+
106113
return $config->getAll(true);
107114
}
108115

109116
/**
110117
* @param string $key
118+
*
111119
* @return bool
112120
*/
113121
public function exists(string $key): bool
114122
{
115-
$config = new Config($this->path . $this->file, Config::JSON);
123+
$config = new Config($this->path.$this->file, Config::JSON);
124+
116125
return $config->exists($key)
117126
? true
118127
: false;
119128
}
120129

121130
/**
122131
* @param string $key
132+
*
123133
* @return void
124134
*/
125135
public function remove(string $key): void
126136
{
127-
$config = new Config($this->path . $this->file, Config::JSON);
137+
$config = new Config($this->path.$this->file, Config::JSON);
128138
$config->remove($key);
129139
}
130140
}

0 commit comments

Comments
 (0)