mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 19:55:33 +00:00
Ignore spawn protection when no ops are set
This commit is contained in:
parent
f49db47b2e
commit
eb0525e892
@ -1225,10 +1225,10 @@ class Level implements ChunkManager, Metadatable{
|
||||
$ev->setCancelled();
|
||||
}
|
||||
|
||||
if(!$player->isOp() and ($distance = $this->server->getConfigInt("spawn-protection", 16)) > -1){
|
||||
if(!$player->isOp() and ($distance = $this->server->getSpawnRadius()) > -1){
|
||||
$t = new Vector2($target->x, $target->z);
|
||||
$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z);
|
||||
if($t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this
|
||||
if(count($this->server->getOps()->getAll()) > 0 and $t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this
|
||||
$ev->setCancelled();
|
||||
}
|
||||
}
|
||||
@ -1320,10 +1320,10 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
if($player instanceof Player){
|
||||
$ev = new PlayerInteractEvent($player, $item, $target, $face);
|
||||
if(!$player->isOp() and ($distance = $this->server->getConfigInt("spawn-protection", 16)) > -1){
|
||||
if(!$player->isOp() and ($distance = $this->server->getSpawnRadius()) > -1){
|
||||
$t = new Vector2($target->x, $target->z);
|
||||
$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z);
|
||||
if($t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this
|
||||
if(count($this->server->getOps()->getAll()) > 0 and $t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this
|
||||
$ev->setCancelled();
|
||||
}
|
||||
}
|
||||
@ -1385,10 +1385,10 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
if($player instanceof Player){
|
||||
$ev = new BlockPlaceEvent($player, $hand, $block, $target, $item);
|
||||
if(!$player->isOp() and ($distance = $this->server->getConfigInt("spawn-protection", 16)) > -1){
|
||||
if(!$player->isOp() and ($distance = $this->server->getSpawnRadius()) > -1){
|
||||
$t = new Vector2($target->x, $target->z);
|
||||
$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z);
|
||||
if($t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this
|
||||
if(count($this->server->getOps()->getAll()) > 0 and $t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this
|
||||
$ev->setCancelled();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user