Fixed spectator players being able to drop items (#4775)

closes #4765
This commit is contained in:
Covered123 2022-01-26 21:03:19 -03:00 committed by GitHub
parent 822af4f7f5
commit 6673289c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,9 @@ class DropItemAction extends InventoryAction{
public function onPreExecute(Player $source) : bool{
$ev = new PlayerDropItemEvent($source, $this->targetItem);
if($source->isSpectator()){
$ev->cancel();
}
$ev->call();
if($ev->isCancelled()){
return false;