mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-27 05:13:46 +00:00
Added spawn-animals and spawn-mobs
This commit is contained in:
parent
5f40ab84f0
commit
7404279f15
@ -72,6 +72,8 @@ class ServerAPI{
|
|||||||
"view-distance" => 10,
|
"view-distance" => 10,
|
||||||
"max-players" => 20,
|
"max-players" => 20,
|
||||||
"allow-flight" => false,
|
"allow-flight" => false,
|
||||||
|
"spawn-animals" => true,
|
||||||
|
"spawn-mobs" => true,
|
||||||
"gamemode" => SURVIVAL,
|
"gamemode" => SURVIVAL,
|
||||||
"hardcore" => false,
|
"hardcore" => false,
|
||||||
"pvp" => true,
|
"pvp" => true,
|
||||||
|
@ -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)){
|
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();
|
$this->close();
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user