Merge branch 'master' of github.com:PocketMine/PocketMine-MP

This commit is contained in:
Shoghi Cervantes 2014-07-12 14:18:12 +02:00
commit 94bc817756
2 changed files with 19 additions and 2 deletions

View File

@ -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.");
}

View File

@ -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 [];
}
}
}