Added spawn-animals and spawn-mobs

This commit is contained in:
Shoghi Cervantes 2013-06-08 18:34:28 +02:00
parent 5f40ab84f0
commit 7404279f15
2 changed files with 26 additions and 0 deletions

View File

@ -72,6 +72,8 @@ class ServerAPI{
"view-distance" => 10,
"max-players" => 20,
"allow-flight" => false,
"spawn-animals" => true,
"spawn-mobs" => true,
"gamemode" => SURVIVAL,
"hardcore" => false,
"pvp" => true,

View File

@ -242,6 +242,30 @@ class Entity extends Position{
}
}
if($this->class === ENTITY_MOB){
switch($this->type){
case MOB_CHICKEN:
case MOB_SHEEP:
case MOB_COW:
case MOB_PIG:
if($this->server->api->getProperty("spawn-animals") !== true){
$this->close();
return false;
}
break;
case MOB_ZOMBIE:
case MOB_CREEPER:
case MOB_PIGMAN:
case MOB_SKELETON:
case MOB_SPIDER:
if($this->server->api->getProperty("spawn-mobs") !== true){
$this->close();
return false;
}
break;
}
}
if($this->class !== ENTITY_PLAYER and ($this->x <= 0 or $this->z <= 0 or $this->x >= 256 or $this->z >= 256 or $this->y >= 128 or $this->y <= 0)){
$this->close();
return false;