Completed
Push — master ( 578302...0a4ad4 )
by Inko
01:23
created
src/AntiCheat/Main.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -22,67 +22,67 @@
 block discarded – undo
22 22
 
23 23
 class Main extends PluginBase implements Listener
24 24
 {
25
-    private $banapi;
26
-    protected $spamplayers = [];
25
+	private $banapi;
26
+	protected $spamplayers = [];
27 27
 
28
-    public function onEnable(): void
29
-    {
30
-        $this->getServer()->getPluginManager()->registerEvents($this, $this);
31
-        $this->banapi = $this->getServer()->getPluginManager()->getPlugin("BanAPI");
32
-        $this->getScheduler()->scheduleRepeatingTask(new CheckPlayerTask($this), 20);
33
-    }
28
+	public function onEnable(): void
29
+	{
30
+		$this->getServer()->getPluginManager()->registerEvents($this, $this);
31
+		$this->banapi = $this->getServer()->getPluginManager()->getPlugin("BanAPI");
32
+		$this->getScheduler()->scheduleRepeatingTask(new CheckPlayerTask($this), 20);
33
+	}
34 34
 
35
-    public function onToggleFlight(PlayerToggleFlightEvent $event): void
36
-    {
37
-        $player = $event->getPlayer();
38
-        if (!$player->isOp()) {
39
-            if ($event->isFlying()) {
40
-                $this->banapi->addBan($player->getName(), $player->getAddress(), "Flying(飛行)", "AntiCheat", true);
41
-            } else {
42
-                $this->banapi->addBan($player->getName(), $player->getAddress(), "Flying(飛行)", "AntiCheat", true);
43
-            }
44
-        }
45
-    }
35
+	public function onToggleFlight(PlayerToggleFlightEvent $event): void
36
+	{
37
+		$player = $event->getPlayer();
38
+		if (!$player->isOp()) {
39
+			if ($event->isFlying()) {
40
+				$this->banapi->addBan($player->getName(), $player->getAddress(), "Flying(飛行)", "AntiCheat", true);
41
+			} else {
42
+				$this->banapi->addBan($player->getName(), $player->getAddress(), "Flying(飛行)", "AntiCheat", true);
43
+			}
44
+		}
45
+	}
46 46
 
47
-    public function onReceive(DataPacketReceiveEvent $event)
48
-    {
49
-        $packet = $event->getPacket();
50
-        if ($packet instanceof LoginPacket) {
51
-            if ($packet->serverAddress === "mcpeproxy.tk" or $packet->serverAddress === "165.227.79.111") {
52
-                $this->banapi->addBan($packet->username, $packet->serverAddress, "PROXY(プロキシ)", "AntiCheat", true);
53
-            }
54
-            if ($packet->clientId === 0) {
55
-                $this->banapi->addBan($packet->username, $packet->serverAddress, "Toolbox(ツール)", "AntiCheat", true);
56
-            }
57
-        }
58
-    }
47
+	public function onReceive(DataPacketReceiveEvent $event)
48
+	{
49
+		$packet = $event->getPacket();
50
+		if ($packet instanceof LoginPacket) {
51
+			if ($packet->serverAddress === "mcpeproxy.tk" or $packet->serverAddress === "165.227.79.111") {
52
+				$this->banapi->addBan($packet->username, $packet->serverAddress, "PROXY(プロキシ)", "AntiCheat", true);
53
+			}
54
+			if ($packet->clientId === 0) {
55
+				$this->banapi->addBan($packet->username, $packet->serverAddress, "Toolbox(ツール)", "AntiCheat", true);
56
+			}
57
+		}
58
+	}
59 59
 
60
-    public function onCommandPreprocess(PlayerCommandPreprocessEvent $event)
61
-    {
62
-        $player = $event->getPlayer();
63
-        $cooldown = microtime(true);
64
-        if (isset($this->spamplayers[$player->getName()])) {
65
-            if (($cooldown - $this->spamplayers[$player->getName()]['cooldown']) < 2) {
66
-                $player->sendMessage("§7クールダウン中です。");
67
-                $event->setCancelled(true);
68
-            }
69
-        }
70
-        $this->spamplayers[$player->getName()]["cooldown"] = $cooldown;
71
-    }
60
+	public function onCommandPreprocess(PlayerCommandPreprocessEvent $event)
61
+	{
62
+		$player = $event->getPlayer();
63
+		$cooldown = microtime(true);
64
+		if (isset($this->spamplayers[$player->getName()])) {
65
+			if (($cooldown - $this->spamplayers[$player->getName()]['cooldown']) < 2) {
66
+				$player->sendMessage("§7クールダウン中です。");
67
+				$event->setCancelled(true);
68
+			}
69
+		}
70
+		$this->spamplayers[$player->getName()]["cooldown"] = $cooldown;
71
+	}
72 72
 
73
-    public function onDamage(EntityDamageEvent $event)
74
-    {
75
-        $entity = $event->getEntity();
76
-        if ($event instanceof EntityDamageByEntityEvent and $entity instanceof Player) {
77
-            $damager = $event->getDamager();
78
-            if ($damager instanceof Player) {
79
-                if ($damager->getGamemode() === Player::CREATIVE or $damager->getInventory()->getItemInHand()->getId() === Item::BOW) {
80
-                    return;
81
-                }
82
-                if ($damager->distance($entity) > 3.9) {
83
-                    $event->setCancelled(true);
84
-                }
85
-            }
86
-        }
87
-    }
73
+	public function onDamage(EntityDamageEvent $event)
74
+	{
75
+		$entity = $event->getEntity();
76
+		if ($event instanceof EntityDamageByEntityEvent and $entity instanceof Player) {
77
+			$damager = $event->getDamager();
78
+			if ($damager instanceof Player) {
79
+				if ($damager->getGamemode() === Player::CREATIVE or $damager->getInventory()->getItemInHand()->getId() === Item::BOW) {
80
+					return;
81
+				}
82
+				if ($damager->distance($entity) > 3.9) {
83
+					$event->setCancelled(true);
84
+				}
85
+			}
86
+		}
87
+	}
88 88
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
         }
45 45
     }
46 46
 
47
-    public function onReceive(DataPacketReceiveEvent $event)
48
-    {
47
+    public function onReceive(DataPacketReceiveEvent $event) {
49 48
         $packet = $event->getPacket();
50 49
         if ($packet instanceof LoginPacket) {
51 50
             if ($packet->serverAddress === "mcpeproxy.tk" or $packet->serverAddress === "165.227.79.111") {
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
         }
58 57
     }
59 58
 
60
-    public function onCommandPreprocess(PlayerCommandPreprocessEvent $event)
61
-    {
59
+    public function onCommandPreprocess(PlayerCommandPreprocessEvent $event) {
62 60
         $player = $event->getPlayer();
63 61
         $cooldown = microtime(true);
64 62
         if (isset($this->spamplayers[$player->getName()])) {
@@ -70,8 +68,7 @@  discard block
 block discarded – undo
70 68
         $this->spamplayers[$player->getName()]["cooldown"] = $cooldown;
71 69
     }
72 70
 
73
-    public function onDamage(EntityDamageEvent $event)
74
-    {
71
+    public function onDamage(EntityDamageEvent $event) {
75 72
         $entity = $event->getEntity();
76 73
         if ($event instanceof EntityDamageByEntityEvent and $entity instanceof Player) {
77 74
             $damager = $event->getDamager();
Please login to merge, or discard this patch.
src/AntiCheat/Task/PluginTask.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@
 block discarded – undo
13 13
 
14 14
 abstract class PluginTask extends Task
15 15
 {
16
-    /** @var Plugin */
17
-    protected $owner;
16
+	/** @var Plugin */
17
+	protected $owner;
18 18
 
19
-    /**
20
-     * PluginTask constructor.
21
-     * @param Plugin $plugin
22
-     */
23
-    public function __construct(Plugin $plugin)
24
-    {
25
-        $this->owner = $plugin;
26
-    }
19
+	/**
20
+	 * PluginTask constructor.
21
+	 * @param Plugin $plugin
22
+	 */
23
+	public function __construct(Plugin $plugin)
24
+	{
25
+		$this->owner = $plugin;
26
+	}
27 27
 
28
-    /**
29
-     * @return Plugin
30
-     */
31
-    final public function getOwner(): Plugin
32
-    {
33
-        return $this->owner;
34
-    }
28
+	/**
29
+	 * @return Plugin
30
+	 */
31
+	final public function getOwner(): Plugin
32
+	{
33
+		return $this->owner;
34
+	}
35 35
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@
 block discarded – undo
20 20
      * PluginTask constructor.
21 21
      * @param Plugin $plugin
22 22
      */
23
-    public function __construct(Plugin $plugin)
24
-    {
23
+    public function __construct(Plugin $plugin) {
25 24
         $this->owner = $plugin;
26 25
     }
27 26
 
Please login to merge, or discard this patch.
src/AntiCheat/Task/CheckPlayerTask.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@
 block discarded – undo
13 13
 
14 14
 class CheckPlayerTask extends PluginTask
15 15
 {
16
-    protected $banapi;
16
+	protected $banapi;
17 17
 
18
-    public function __construct(Main $plugin)
19
-    {
20
-        parent::__construct($plugin);
21
-        $this->banapi = $this->owner->getServer()->getPluginManager()->getPlugin("BanAPI");
22
-    }
18
+	public function __construct(Main $plugin)
19
+	{
20
+		parent::__construct($plugin);
21
+		$this->banapi = $this->owner->getServer()->getPluginManager()->getPlugin("BanAPI");
22
+	}
23 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
-    }
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 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,17 +15,19 @@
 block discarded – undo
15 15
 {
16 16
     protected $banapi;
17 17
 
18
-    public function __construct(Main $plugin)
19
-    {
18
+    public function __construct(Main $plugin) {
20 19
         parent::__construct($plugin);
21 20
         $this->banapi = $this->owner->getServer()->getPluginManager()->getPlugin("BanAPI");
22 21
     }
23 22
 
24
-    public function onRun(int $currentTick)
25
-    {
23
+    public function onRun(int $currentTick) {
26 24
         foreach ($this->owner->getServer()->getOnlinePlayers() as $player) {
27
-            if ($player->isOp()) return;
28
-            if (!$player->isFlying()) return;
25
+            if ($player->isOp()) {
26
+            	return;
27
+            }
28
+            if (!$player->isFlying()) {
29
+            	return;
30
+            }
29 31
             $this->banapi->addBan($player->getName(), "Flying(飛行)", "AntiCheat", true);
30 32
         }
31 33
     }
Please login to merge, or discard this patch.