TpsCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A execute() 0 6 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