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:
11
11
- MazaiCrafty
12
12
- yuko fuyutsuki
13
13
- 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 10
10
11
11
12
12
use pocketmine \plugin \PluginBase ;
13
+ use VectorNetworkProject \TheMix \command \PingCommand ;
13
14
14
15
class TheMix extends PluginBase
15
16
{
@@ -24,6 +25,7 @@ public function onLoad()
24
25
25
26
public function onEnable ()
26
27
{
28
+ $ this ->registerCommands ();
27
29
$ this ->getLogger ()->notice ("Loaded System!! " );
28
30
}
29
31
@@ -32,8 +34,27 @@ public function onDisable()
32
34
$ this ->getLogger ()->notice ("Unload System... " );
33
35
}
34
36
37
+ /**
38
+ * @return TheMix
39
+ */
35
40
public static function getInstance (): TheMix
36
41
{
37
42
return self ::$ instance ;
38
43
}
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
+ }
39
60
}
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
75
75
76
76
/**
77
77
* @param string $key
78
- * @return mixed
78
+ * @return bool| mixed
79
79
*/
80
80
public function get (string $ key )
81
81
{
You can’t perform that action at this time.
0 commit comments