File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,10 +81,13 @@ public function onInventoryClose(InventoryCloseEvent $event) : void{
8181
8282 $ current = $ session ->current ;
8383 if ($ current !== null && $ event ->getInventory () === $ current ->menu ->getInventory ()){
84- $ current? ->graphic->remove ($ player );
84+ $ current ->graphic ->remove ($ player );
8585 $ session ->current = null ;
8686 }
8787 $ session ->network ->wait (PlayerNetwork::DELAY_TYPE_ANIMATION_WAIT , static fn ($ success ) => false );
88+ if ($ session ->dispatcher !== null && $ session ->dispatcher ->state === PlayerWindowDispatcher::STATE_SENDING && $ session ->dispatcher ->info === $ current ){
89+ return ;
90+ }
8891 $ current ?->menu->onClose ($ player );
8992 }
9093
Original file line number Diff line number Diff line change @@ -21,12 +21,13 @@ public function __construct(
2121 * @internal
2222 */
2323 public function finalize () : void {
24+ $ this ->network ->finalize ();
25+ $ this ->dispatcher ?->finalize(); // dispatcher finalized first, it has authority to nullify current
26+ $ this ->dispatcher = null ;
2427 if ($ this ->current !== null ){
2528 $ this ->current ->graphic ->remove ($ this ->player );
2629 $ this ->player ->removeCurrentWindow ();
30+ $ this ->current = null ;
2731 }
28- $ this ->network ->finalize ();
29- $ this ->dispatcher ?->finalize();
30- $ this ->dispatcher = null ;
3132 }
3233}
You can’t perform that action at this time.
0 commit comments