mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Added "player.flying" event, ops can always fly
This commit is contained in:
parent
7b8a27f7b0
commit
eac72bb8ae
@ -56,6 +56,7 @@ class BanAPI{
|
|||||||
$this->server->addHandler("console.command", array($this, "permissionsCheck"), 1);
|
$this->server->addHandler("console.command", array($this, "permissionsCheck"), 1);
|
||||||
$this->server->addHandler("player.block.break", 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.block.place", array($this, "permissionsCheck"), 1);
|
||||||
|
$this->server->addHandler("player.flying", array($this, "permissionsCheck"), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cmdWhitelist($cmd){
|
public function cmdWhitelist($cmd){
|
||||||
@ -74,6 +75,11 @@ class BanAPI{
|
|||||||
|
|
||||||
public function permissionsCheck($data, $event){
|
public function permissionsCheck($data, $event){
|
||||||
switch($event){
|
switch($event){
|
||||||
|
case "player.flying":
|
||||||
|
if($this->isOp($data->iusername)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "player.block.break":
|
case "player.block.break":
|
||||||
case "player.block.place":
|
case "player.block.place":
|
||||||
if(!$this->isOp($data["player"]->iusername)){
|
if(!$this->isOp($data["player"]->iusername)){
|
||||||
|
@ -351,7 +351,7 @@ class Entity extends stdClass{
|
|||||||
$this->fallY = $y;
|
$this->fallY = $y;
|
||||||
$this->fallStart = microtime(true);
|
$this->fallStart = microtime(true);
|
||||||
}elseif($this->class === ENTITY_PLAYER and ($this->fallStart + 5) < 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");
|
$this->player->close("flying");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user