File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed
Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -62,20 +62,18 @@ public function onInventoryTransaction(InventoryTransactionEvent $event) : void{
6262
6363 $ player_instance = $ this ->player_manager ->get ($ player );
6464 $ current = $ player_instance ->getCurrent ();
65- if ($ current === null ){
66- foreach ($ transaction ->getActions () as $ action ){
67- if ($ action instanceof SlotChangeAction && $ action ->getInventory () instanceof InvMenuInventory){
68- $ event ->cancel ();
69- return ;
70- }
71- }
72- return ;
73- }
74-
75- $ inventory = $ current ->menu ->getInventory ();
65+ $ inventory = $ current ?->menu->getInventory ();
7666 $ network_stack_callbacks = [];
7767 foreach ($ transaction ->getActions () as $ action ){
78- if (!($ action instanceof SlotChangeAction) || $ action ->getInventory () !== $ inventory ){
68+ if (!($ action instanceof SlotChangeAction)){
69+ continue ;
70+ }
71+
72+ if ($ action ->getInventory () !== $ inventory ){
73+ if ($ action ->getInventory () instanceof InvMenuInventory){
74+ $ event ->cancel ();
75+ return ;
76+ }
7977 continue ;
8078 }
8179
You can’t perform that action at this time.
0 commit comments