InventoryTransaction: prevent client-authoritative item overstacking

this cheat is often used to carry more items in the inventory, wear multiple pieces of armour in one slot, and more.
This commit is contained in:
Dylan K. Taylor
2022-08-21 20:35:23 +01:00
parent af2babec23
commit 5426b41447
2 changed files with 9 additions and 0 deletions

View File

@ -42,6 +42,9 @@ class DropItemAction extends InventoryAction{
if($this->targetItem->isNull()){
throw new TransactionValidationException("Cannot drop an empty itemstack");
}
if($this->targetItem->getCount() > $this->targetItem->getMaxStackSize()){
throw new TransactionValidationException("Target item exceeds item type max stack size");
}
}
public function onPreExecute(Player $source) : bool{