added keepinventory into extra.properties

This commit is contained in:
GameHerobrine 2024-11-28 22:23:54 +03:00
parent 57f8067434
commit a39791f092
5 changed files with 9 additions and 5 deletions

View file

@ -14,6 +14,7 @@ class Entity extends Position
public $fallDistance = 0;
public static $updateOnTick, $allowedAI;
public static $allowFly = true;
public static $keepInventory = false;
public $canBeAttacked;
public $moveTime, $lookTime, $idleTime, $knockbackTime = 0;
public $attackTimeout = 0;
@ -341,6 +342,9 @@ class Entity extends Position
{
if($this->class === ENTITY_PLAYER and $this->player instanceof Player and ($this->player->gamemode & 0x01) === 0){
$inv = [];
if(self::$keepInventory){
return [];
}
for($i = 0; $i < PLAYER_SURVIVAL_SLOTS; ++ $i){
$slot = $this->player->getSlot($i);
$this->player->setSlot($i, BlockAPI::getItem(AIR, 0, 0));