mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-19 04:05:31 +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();
|
$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);
|
$t = new Vector2($target->x, $target->z);
|
||||||
$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->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();
|
$ev->setCancelled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1320,10 +1320,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$ev = new PlayerInteractEvent($player, $item, $target, $face);
|
$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);
|
$t = new Vector2($target->x, $target->z);
|
||||||
$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->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();
|
$ev->setCancelled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1385,10 +1385,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$ev = new BlockPlaceEvent($player, $hand, $block, $target, $item);
|
$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);
|
$t = new Vector2($target->x, $target->z);
|
||||||
$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->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();
|
$ev->setCancelled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user