Correctly fixed #1659 PvP settings not working

This commit is contained in:
Shoghi Cervantes 2014-07-30 16:07:21 +02:00
parent a9cd03da2e
commit 487ce00542

View File

@ -1611,17 +1611,18 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->craftingType = 0; $this->craftingType = 0;
$target = $this->getLevel()->getEntity($packet->target); $target = $this->getLevel()->getEntity($packet->target);
$cancelled = false;
if( if(
$target instanceof Player and $target instanceof Player and
$this->server->getConfigBoolean("pvp", true) === false $this->server->getConfigBoolean("pvp", true) === false
){ ){
$cancelled = true; $cancelled = true;
} }
if($target instanceof Entity and $this->getGamemode() !== Player::VIEW and $this->blocked === false and $this->dead !== true and $target->dead !== true){ if($target instanceof Entity and $this->getGamemode() !== Player::VIEW and $this->blocked === false and $this->dead !== true and $target->dead !== true){
$cancelled = false;
$item = $this->inventory->getItemInHand(); $item = $this->inventory->getItemInHand();
$damageTable = [ $damageTable = [
Item::WOODEN_SWORD => 4, Item::WOODEN_SWORD => 4,