File tree Expand file tree Collapse file tree
invui/src/main/java/xyz/xenondevs/invui/internal/menu Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -444,10 +444,10 @@ public UpdateType processIncoming() {
444444 */
445445 protected UpdateType processPacket (Packet <? super ServerGamePacketListener > packet ) {
446446 return switch (packet ) {
447- case ServerboundContainerButtonClickPacket p -> handleButtonClick (p .buttonId ());
448- case ServerboundContainerClickPacket p -> handleClick (p );
447+ case ServerboundContainerButtonClickPacket p when p . containerId () == containerId -> handleButtonClick (p .buttonId ());
448+ case ServerboundContainerClickPacket p when p . containerId () == containerId -> handleClick (p );
449449 case ServerboundSelectBundleItemPacket p -> handleBundleSelect (p );
450- case ServerboundContainerClosePacket p -> {
450+ case ServerboundContainerClosePacket p when p . getContainerId () == containerId -> {
451451 handleClose (p );
452452 yield UpdateType .NONE ;
453453 }
@@ -476,9 +476,6 @@ private void handlePong(ServerboundPongPacket packet) {
476476 * @param packet The packet that was received
477477 */
478478 private void handleClose (ServerboundContainerClosePacket packet ) {
479- if (packet .getContainerId () != containerId )
480- return ;
481-
482479 if (getWindow ().isCloseable ()) {
483480 getWindowEvents ().handleClose (InventoryCloseEvent .Reason .PLAYER );
484481 serverPlayer .containerMenu = serverPlayer .inventoryMenu ;
Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ public void handleClosed() {
4646
4747 @ Override
4848 protected UpdateType processPacket (Packet <? super ServerGamePacketListener > packet ) {
49- if (packet instanceof ServerboundContainerSlotStateChangedPacket slotStateChangedPacket ) {
50- handleSlotStateChange (slotStateChangedPacket );
49+ if (packet instanceof ServerboundContainerSlotStateChangedPacket p && p . containerId () == containerId ) {
50+ handleSlotStateChange (p );
5151 return UpdateType .NONE ;
5252 } else {
5353 return super .processPacket (packet );
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ public void handleClosed() {
5252
5353 @ Override
5454 protected UpdateType processPacket (Packet <? super ServerGamePacketListener > packet ) {
55- if (packet instanceof ServerboundPlaceRecipePacket ) {
56- handleRecipePlace (( ServerboundPlaceRecipePacket ) packet );
55+ if (packet instanceof ServerboundPlaceRecipePacket p && p . containerId () == containerId ) {
56+ handleRecipePlace (p );
5757 return UpdateType .NONE ;
5858 } else {
5959 return super .processPacket (packet );
You can’t perform that action at this time.
0 commit comments