Players in creative cannot die from non-magic (plugin/console) causes.
This commit is contained in:
williamtdr 2014-07-11 09:14:49 -05:00
parent 3e882ef40d
commit 61043d2e0d

View File

@ -58,6 +58,9 @@ abstract class Living extends Entity implements Damageable{
public abstract function getName();
public function attack($damage, $source = EntityDamageEvent::CAUSE_MAGIC){
if($this instanceof Player and ($this->getGamemode() & 0x01) === 1 and $source != EntityDamageEvent::CAUSE_MAGIC) {
return;
}
//TODO: attack tick limit
$pk = new EntityEventPacket();
$pk->eid = $this->getID();
@ -103,4 +106,4 @@ abstract class Living extends Entity implements Damageable{
public function getDrops(){
return [];
}
}
}