mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-09 11:31:49 +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:
parent
cd4bb91676
commit
c1fbac412e
@ -72,7 +72,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
|
|||||||
* Returns the item used to destroy the block.
|
* Returns the item used to destroy the block.
|
||||||
*/
|
*/
|
||||||
public function getItem() : Item{
|
public function getItem() : Item{
|
||||||
return $this->item;
|
return clone $this->item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ class BlockPlaceEvent extends BlockEvent implements Cancellable{
|
|||||||
* Gets the item in hand
|
* Gets the item in hand
|
||||||
*/
|
*/
|
||||||
public function getItem() : Item{
|
public function getItem() : Item{
|
||||||
return $this->item;
|
return clone $this->item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockReplaced() : Block{
|
public function getBlockReplaced() : Block{
|
||||||
|
@ -69,7 +69,7 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getItem() : Item{
|
public function getItem() : Item{
|
||||||
return $this->item;
|
return clone $this->item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlock() : Block{
|
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.
|
* Returns the item in the slot that the player is trying to equip.
|
||||||
*/
|
*/
|
||||||
public function getItem() : Item{
|
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.
|
* Returns the item used.
|
||||||
*/
|
*/
|
||||||
public function getItem() : Item{
|
public function getItem() : Item{
|
||||||
return $this->item;
|
return clone $this->item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user