mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
event: ensure that modifications to items expected to be readonly have no effect
this isn't a very glorious fix, but it's the best I have for now.
This commit is contained in:
@ -69,7 +69,7 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
|
||||
}
|
||||
|
||||
public function getItem() : Item{
|
||||
return $this->item;
|
||||
return clone $this->item;
|
||||
}
|
||||
|
||||
public function getBlock() : Block{
|
||||
|
@ -60,6 +60,6 @@ class PlayerItemHeldEvent extends PlayerEvent implements Cancellable{
|
||||
* Returns the item in the slot that the player is trying to equip.
|
||||
*/
|
||||
public function getItem() : Item{
|
||||
return $this->item;
|
||||
return clone $this->item;
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class PlayerItemUseEvent extends PlayerEvent implements Cancellable{
|
||||
* Returns the item used.
|
||||
*/
|
||||
public function getItem() : Item{
|
||||
return $this->item;
|
||||
return clone $this->item;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user