Fix GC cycle count increases on player disconnect (#6487)

This commit is contained in:
kostamax27 2024-11-11 16:10:19 +01:00 committed by GitHub
parent 2ff6470792
commit d2c3b8dacb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,7 +42,7 @@ class ArmorInventory extends SimpleInventory{
){ ){
parent::__construct(4); parent::__construct(4);
$this->validators->add(new CallbackSlotValidator($this->validate(...))); $this->validators->add(new CallbackSlotValidator(self::validate(...)));
} }
public function getHolder() : Living{ public function getHolder() : Living{
@ -81,7 +81,7 @@ class ArmorInventory extends SimpleInventory{
$this->setItem(self::SLOT_FEET, $boots); $this->setItem(self::SLOT_FEET, $boots);
} }
private function validate(Inventory $inventory, Item $item, int $slot) : ?TransactionValidationException{ private static function validate(Inventory $inventory, Item $item, int $slot) : ?TransactionValidationException{
if($item instanceof Armor){ if($item instanceof Armor){
if($item->getArmorSlot() !== $slot){ if($item->getArmorSlot() !== $slot){
return new TransactionValidationException("Armor item is in wrong slot"); return new TransactionValidationException("Armor item is in wrong slot");