This repository was archived by the owner on Feb 8, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +131
-2
lines changed
src/VectorNetworkProject/TheMix Expand file tree Collapse file tree 6 files changed +131
-2
lines changed Original file line number Diff line number Diff line change @@ -11,4 +11,10 @@ authors:
1111- MazaiCrafty
1212- yuko fuyutsuki
1313- DusKong
14- - UramnOIL
14+ - UramnOIL
15+
16+ permissions :
17+ the.mix.command.ping :
18+ default : true
19+ the.mix.command.tps :
20+ default : true
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright (c) 2018 VectorNetworkProject. All rights reserved. MIT license.
4+ *
5+ * GitHub: https://github.com/VectorNetworkProject/TheMix
6+ * Website: https://www.vector-network.tk
7+ */
8+
9+ namespace VectorNetworkProject \TheMix ;
10+
11+
12+ use VectorNetworkProject \TheMix \provider \JSON ;
13+ use VectorNetworkProject \TheMix \provider \YAML ;
14+
15+ class DataBase
16+ {
17+ /**
18+ * @param string $xuid
19+ * @param string $file
20+ * @return JSON
21+ */
22+ public static function JsonUserSetting (string $ xuid , $ file = "UserDatas " ): JSON
23+ {
24+ return new JSON ($ xuid , $ file );
25+ }
26+
27+ /**
28+ * @return YAML
29+ */
30+ public static function YamlClientSetting (): YAML
31+ {
32+ return new YAML ();
33+ }
34+ }
Original file line number Diff line number Diff line change 1010
1111
1212use pocketmine \plugin \PluginBase ;
13+ use VectorNetworkProject \TheMix \command \PingCommand ;
1314
1415class TheMix extends PluginBase
1516{
@@ -24,6 +25,7 @@ public function onLoad()
2425
2526 public function onEnable ()
2627 {
28+ $ this ->registerCommands ();
2729 $ this ->getLogger ()->notice ("Loaded System!! " );
2830 }
2931
@@ -32,8 +34,27 @@ public function onDisable()
3234 $ this ->getLogger ()->notice ("Unload System... " );
3335 }
3436
37+ /**
38+ * @return TheMix
39+ */
3540 public static function getInstance (): TheMix
3641 {
3742 return self ::$ instance ;
3843 }
44+
45+ /**
46+ * @return DataBase
47+ */
48+ public static function getDataBase (): DataBase
49+ {
50+ return new DataBase ();
51+ }
52+
53+ private function registerCommands (): void
54+ {
55+ $ commands = [
56+ new PingCommand ($ this )
57+ ];
58+ $ this ->getServer ()->getCommandMap ()->registerAll ($ this ->getName (), $ commands );
59+ }
3960}
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright (c) 2018 VectorNetworkProject. All rights reserved. MIT license.
4+ *
5+ * GitHub: https://github.com/VectorNetworkProject/TheMix
6+ * Website: https://www.vector-network.tk
7+ */
8+
9+ namespace VectorNetworkProject \TheMix \command ;
10+
11+
12+ use pocketmine \command \CommandSender ;
13+ use pocketmine \command \PluginCommand ;
14+ use pocketmine \Player ;
15+ use pocketmine \plugin \Plugin ;
16+ use pocketmine \utils \TextFormat ;
17+
18+ class PingCommand extends PluginCommand
19+ {
20+ public function __construct (Plugin $ owner )
21+ {
22+ parent ::__construct ('ping ' , $ owner );
23+ $ this ->setDescription ('応答速度を計測します。 ' );
24+ $ this ->setPermission ('the.mix.command.ping ' );
25+ }
26+
27+ public function execute (CommandSender $ sender , string $ commandLabel , array $ args ): bool
28+ {
29+ if (!$ sender instanceof Player) {
30+ $ sender ->sendMessage (TextFormat::RED . "このコマンドはプレイヤーのみ実行可能です。 " );
31+ return true ;
32+ }
33+ $ sender ->sendMessage (TextFormat::RED . $ sender ->getPing () . TextFormat::YELLOW . "ms " );
34+ return true ;
35+ }
36+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright (c) 2018 VectorNetworkProject. All rights reserved. MIT license.
4+ *
5+ * GitHub: https://github.com/VectorNetworkProject/TheMix
6+ * Website: https://www.vector-network.tk
7+ */
8+
9+ namespace VectorNetworkProject \TheMix \command ;
10+
11+
12+ use pocketmine \command \CommandSender ;
13+ use pocketmine \command \PluginCommand ;
14+ use pocketmine \plugin \Plugin ;
15+ use pocketmine \Server ;
16+ use pocketmine \utils \TextFormat ;
17+
18+ class TpsCommand extends PluginCommand
19+ {
20+ public function __construct (Plugin $ owner )
21+ {
22+ parent ::__construct ('tps ' , $ owner );
23+ $ this ->setPermission ('the.mix.command.tps ' );
24+ $ this ->setDescription ('TicksPerSecond ' );
25+ }
26+
27+ public function execute (CommandSender $ sender , string $ commandLabel , array $ args ): bool
28+ {
29+ $ sender ->sendMessage (TextFormat::GREEN . 'TPS: ' . Server::getInstance ()->getTicksPerSecond () . '/20 ' );
30+ return true ;
31+ }
32+ }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function set(string $key, $data): void
7575
7676 /**
7777 * @param string $key
78- * @return mixed
78+ * @return bool| mixed
7979 */
8080 public function get (string $ key )
8181 {
You can’t perform that action at this time.
0 commit comments