Added pvp server property

This commit is contained in:
Shoghi Cervantes Pueyo 2013-04-09 16:58:52 +02:00
parent 3e3521086b
commit 5f55cdf26a
2 changed files with 4 additions and 1 deletions

View File

@ -99,6 +99,7 @@ class ServerAPI{
"server-type" => "normal",
"time-per-second" => 20,
"gamemode" => 1,
"pvp" => true,
"difficulty" => 1,
"generator" => "",
"generator-settings" => "",

View File

@ -852,7 +852,9 @@ class Player{
$target = $this->server->api->entity->get($data["target"]);
$data["targetentity"] = $target;
$data["entity"] = $this->entity;
if(($target instanceof Entity) and $target->class === ENTITY_PLAYER and ($this->server->difficulty <= 0 or $target->gamemode === CREATIVE)){
if(!($target instanceof Entity)){
break;
}elseif($target->class === ENTITY_PLAYER and ($this->server->getProperty("pvp") == false or $this->server->difficulty <= 0 or $target->player->gamemode === CREATIVE)){
break;
}elseif($this->handle("player.interact", $data) !== false){
switch($this->equipment->getID()){