mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Fixed creative mode damage
This commit is contained in:
parent
4b744d7af3
commit
e1ce88c0ef
@ -247,6 +247,9 @@ class PlayerAPI{
|
||||
}else{
|
||||
$data = unserialize(file_get_contents(FILE_PATH."players/".$name.".dat"));
|
||||
}
|
||||
if($this->server->gamemode === 1){
|
||||
$data["health"] = 20;
|
||||
}
|
||||
$this->server->handle("api.player.offline.get", $data);
|
||||
return $data;
|
||||
}
|
||||
|
@ -329,11 +329,11 @@ class Entity extends stdClass{
|
||||
return $this->setHealth($this->getHealth() - ((int) $dmg), $cause);
|
||||
}
|
||||
|
||||
public function setHealth($health, $cause = ""){
|
||||
public function setHealth($health, $cause = "", $force = false){
|
||||
$health = (int) $health;
|
||||
if($health < $this->health){
|
||||
$dmg = $this->health - $health;
|
||||
if(($this->dmgcounter[0] < microtime(true) or $this->dmgcounter[1] < $dmg) and !$this->dead){
|
||||
if(($this->gamemode === 0 or $force === true) and ($this->dmgcounter[0] < microtime(true) or $this->dmgcounter[1] < $dmg) and !$this->dead){
|
||||
$this->dmgcounter = array(microtime(true) + 0.5, $dmg);
|
||||
}else{
|
||||
return false; //Entity inmunity
|
||||
|
Loading…
x
Reference in New Issue
Block a user