Ignore spawn protection when no ops are set

This commit is contained in:
Shoghi Cervantes 2015-02-22 19:07:45 +01:00
parent f49db47b2e
commit eb0525e892
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89

View File

@ -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();
}
}