Posted March 18, 20214 yr Hello! Is there a good way to detect if a player is trying to open their inventory? I want to open some other container is some cases when they do that. This is only server side. I also want to make sure that in the case where I want to open a different container instead they are 100% unable to take their armor off. I think that may not be possible tho, because it might just be up to the client to modify its inventory and send the changes to the server (like it can say "hey I moved my helmet to slot 35, cool?") But not sure on that, if this is not possible it's not that big of deal, but I will need another solution to make sure they can't move their armor into their inventory (thinking of tagging their armor with something like "disallowed" and then periodically checking if they somehow managed to get a disallowed item). Thanks
March 18, 20214 yr Author Damn, that is slightly problematic for my case. Oh, well I will find a workaround then, thank you
March 19, 20214 yr Author Continuing this topic I still want to prevent a lot of inventory interaction, is it possible to mess with the itemstack held by the cursor from the server? Only the client appears to know about that, how is that possible, the inventory actually changes when the client picks up an item from their inventory, the server has to know about the new empty slot, or is that it, just a new empty slot that appears? As far as the server is concerned, where is the itemstack that is being held?
March 19, 20214 yr Author Is it possible that it is a bug that it isnt being set correctly on the server ?
March 20, 20214 yr I think you can subscribe to the GuiOpenEvent and check if the event.getGui is an InventoryScreen. Then just replace with you own gui and load the custom container
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.