mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 03:35:33 +00:00
Allow armor replacing (changing armor to another armor)
This commit is contained in:
parent
e42314ade7
commit
a34595292d
@ -415,7 +415,6 @@ class PlayerAPI{
|
||||
public function remove($CID){
|
||||
if(isset($this->server->clients[$CID])){
|
||||
$player = $this->server->clients[$CID];
|
||||
$this->server->clients[$CID] = null;
|
||||
unset($this->server->clients[$CID]);
|
||||
$player->close();
|
||||
if($player->username != "" and ($player->data instanceof Config)){
|
||||
@ -423,8 +422,8 @@ class PlayerAPI{
|
||||
}
|
||||
$this->server->query("DELETE FROM players WHERE name = '".$player->username."';");
|
||||
if($player->entity instanceof Entity){
|
||||
$player->entity->player = null;
|
||||
$player->entity = null;
|
||||
unset($player->entity->player);
|
||||
unset($player->entity);
|
||||
}
|
||||
$this->server->api->entity->remove($player->eid);
|
||||
$player = null;
|
||||
|
@ -1432,6 +1432,10 @@ class Player{
|
||||
}elseif($s->getID() !== AIR and $slot->getID() === AIR and ($sl = $this->hasItem($s->getID())) !== false){
|
||||
$this->armor[$i] = $this->getSlot($sl);
|
||||
$this->setSlot($sl, BlockAPI::getItem(AIR, 0, 0), false);
|
||||
}elseif($s->getID() !== AIR and $slot->getID() !== AIR and ($sl = $this->hasItem($s->getID())) !== false){
|
||||
$item = $this->armor[$i];
|
||||
$this->armor[$i] = $this->getSlot($sl);
|
||||
$this->setSlot($sl, $item, false);
|
||||
}else{
|
||||
$data["slot$i"] = 255;
|
||||
}
|
||||
|
@ -383,6 +383,10 @@ class Entity extends Position{
|
||||
$this->tickCounter = 0;
|
||||
}
|
||||
|
||||
if($this->closed === true){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->isStatic === false){
|
||||
$startX = floor($this->x - 0.5 - $this->size - 1);
|
||||
$y = (int) round($this->y - 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user