TpsCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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\defaults;
10
11
use pocketmine\command\CommandSender;
12
use pocketmine\command\PluginCommand;
13
use pocketmine\plugin\Plugin;
14
use pocketmine\Server;
15
use pocketmine\utils\TextFormat;
16
use VectorNetworkProject\TheMix\command\Permissions;
17
18
class TpsCommand extends PluginCommand
19
{
20
    /**
21
     * TpsCommand constructor.
22
     *
23
     * @param Plugin $owner
24
     */
25
    public function __construct(Plugin $owner)
26
    {
27
        parent::__construct('tps', $owner);
28
        $this->setPermission(Permissions::USER.'tps');
29
        $this->setDescription('TicksPerSecond');
30
    }
31
32
    /**
33
     * @param CommandSender $sender
34
     * @param string        $commandLabel
35
     * @param array         $args
36
     *
37
     * @return mixed
38
     */
39
    public function execute(CommandSender $sender, string $commandLabel, array $args)
40
    {
41
        $sender->sendMessage(TextFormat::GREEN.'TPS: '.Server::getInstance()->getTicksPerSecond().'/20');
42
43
        return true;
44
    }
45
}
46