From eac72bb8ae3aa200590610d54a266e363a8e65a6 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 9 Apr 2013 19:11:45 +0200 Subject: [PATCH] Added "player.flying" event, ops can always fly --- src/API/BanAPI.php | 6 ++++++ src/world/Entity.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/API/BanAPI.php b/src/API/BanAPI.php index 8b6aed65..f733927b 100644 --- a/src/API/BanAPI.php +++ b/src/API/BanAPI.php @@ -56,6 +56,7 @@ class BanAPI{ $this->server->addHandler("console.command", array($this, "permissionsCheck"), 1); $this->server->addHandler("player.block.break", array($this, "permissionsCheck"), 1); $this->server->addHandler("player.block.place", array($this, "permissionsCheck"), 1); + $this->server->addHandler("player.flying", array($this, "permissionsCheck"), 1); } public function cmdWhitelist($cmd){ @@ -74,6 +75,11 @@ class BanAPI{ public function permissionsCheck($data, $event){ switch($event){ + case "player.flying": + if($this->isOp($data->iusername)){ + return true; + } + break; case "player.block.break": case "player.block.place": if(!$this->isOp($data["player"]->iusername)){ diff --git a/src/world/Entity.php b/src/world/Entity.php index 7ec998c5..d75d0ed1 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -351,7 +351,7 @@ class Entity extends stdClass{ $this->fallY = $y; $this->fallStart = microtime(true); }elseif($this->class === ENTITY_PLAYER and ($this->fallStart + 5) < microtime(true)){ - if($this->player->gamemode !== CREATIVE and $this->server->api->getProperty("allow-flight") !== true){ + if($this->player->gamemode !== CREATIVE and $this->server->api->getProperty("allow-flight") !== true and $this->server->handle("player.flying", $this->player) !== true){ $this->player->close("flying"); return; }