mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Merge branch 'master' of github.com:PocketMine/PocketMine-MP
This commit is contained in:
commit
94bc817756
@ -53,7 +53,7 @@ class KickCommand extends VanillaCommand{
|
||||
|
||||
if(($player = $sender->getServer()->getPlayer($name)) instanceof Player){
|
||||
$player->kick($reason);
|
||||
Command::broadcastCommandMessage($sender, "Kicked player " . $player->getName() . ". With reason: " . $reason);
|
||||
Command::broadcastCommandMessage($sender, "Kicked " . $player->getName() . " from the game: '{$reason}'");
|
||||
}else{
|
||||
$sender->sendMessage($name . " not found.");
|
||||
}
|
||||
|
@ -58,6 +58,23 @@ 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){
|
||||
if($source instanceof EntityDamageEvent){
|
||||
$cause = $source->getCause();
|
||||
}else{
|
||||
$cause = $source;
|
||||
}
|
||||
|
||||
if(
|
||||
$cause !== EntityDamageEvent::CAUSE_MAGIC
|
||||
and $cause !== EntityDamageEvent::CAUSE_SUICIDE
|
||||
and $cause !== EntityDamageEvent::CAUSE_VOID
|
||||
){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: attack tick limit
|
||||
$pk = new EntityEventPacket();
|
||||
$pk->eid = $this->getID();
|
||||
@ -103,4 +120,4 @@ abstract class Living extends Entity implements Damageable{
|
||||
public function getDrops(){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user