mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-22 03:14:11 +00:00
Fix #1615
Players in creative cannot die from non-magic (plugin/console) causes.
This commit is contained in:
parent
3e882ef40d
commit
61043d2e0d
@ -58,6 +58,9 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
public abstract function getName();
|
public abstract function getName();
|
||||||
|
|
||||||
public function attack($damage, $source = EntityDamageEvent::CAUSE_MAGIC){
|
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
|
//TODO: attack tick limit
|
||||||
$pk = new EntityEventPacket();
|
$pk = new EntityEventPacket();
|
||||||
$pk->eid = $this->getID();
|
$pk->eid = $this->getID();
|
||||||
@ -103,4 +106,4 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
public function getDrops(){
|
public function getDrops(){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user