CheckPlayerTask::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: InkoHX
5
 * Date: 2018/08/23
6
 * Time: 15:22
7
 */
8
9
namespace AntiCheat\Task;
10
11
12
use AntiCheat\Main;
13
14
class CheckPlayerTask extends PluginTask
15
{
16
    protected $banapi;
17
18
    public function __construct(Main $plugin)
19
    {
20
        parent::__construct($plugin);
21
        $this->banapi = $this->owner->getServer()->getPluginManager()->getPlugin("BanAPI");
22
    }
23
24
    public function onRun(int $currentTick)
25
    {
26
        foreach ($this->owner->getServer()->getOnlinePlayers() as $player) {
27
            if ($player->isOp()) return;
28
            if (!$player->isFlying()) return;
29
            $this->banapi->addBan($player->getName(), "Flying(飛行)", "AntiCheat", true);
30
        }
31
    }
32
}