-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block unrealistic interactions to avoid getting items from gui #22
Comments
I think I must add that: you can put items into the gui by just shift-clicking them. (tested on paper version 1.8) I dont know why I didn't create another issue... |
@Tuchan - is this in the case of setting Note that you needn't set @h00z3x - same as above, the event should be cancelled regardless of The idea is that |
First of all, Thanks for your response I really appreciate it! Second, It looks like I didn't provide much Information. Also I thought It wasn't possible, when I saw your response... So I took a look at SGMenuListener.java: To fix it : just change the
to and also i think you might want to change the line 91
to Note: this would also mean that the player cant move items of his own when the GUI is open! |
Okay I’m following what you’re saying now. I suspect what @Tuchan is suggesting is possible is double clicking in the player inventory to steal the items from the other (SpiGUI) inventory (as that could be possible as a result of the same issue) so I’ll work under the assumption that both of these are about the lower inventory (unless this is also an issue with events in just the upper inventory - in which case if someone could post a video to clarify). With respect to the problem you’ve outlined, it looks like this might have been introduced in #19 which fixed the problem it intended to fix but introduced this one (which was trying to stop click events in the player’s inventory from registering as being the SpiGUI inventory). (Honestly the way the Bukkit/Spigot API does inventories seems weird). So, I think what needs to be introduced is one of the following:
I’m happy to hear your thoughts otherwise I’ll probably just go with the last one. |
Tbh I don't remember much other than that I was able to get the items from the inventory. For example, instead of left clicking I did a shift click and the action obviously went through but the item stayed in my inventory. I think the item would disappear when you interacted with it (placing a block etc), but that was easily bypassed by just dropping and picking it back. 99% of the time an item inside a GUI will be used as a button and not as an item that you can grab and put in your inventory. So yeah, the last option is probably the best one. |
Okay. It's probably a 'phantom/ghost item' in most cases (e.g., the client might make it look like the user obtained the item but the event was cancelled on the server so it's not actually there) but I guess there are some workarounds possible. I'll try and find some time to just try and break it in every way I can think of and implement the above changes. |
Currently, if we use any interaction not including
LEFT
andRIGHT
click, we can essentially get items from the inventory. This probably isn't an intended behavior, but it would be good to add that as a boolean nonetheless.SpiGUI/src/main/java/com/samjakob/spigui/SpiGUI.java
Line 41 in b57ffc0
Such as:
blockUnrealisticInteractions
(?), which defaults totrue
, since 99% of interactions will be handled with either left or right click.Than it's probably just a case of:
You can already achieve the same behavior without that change, but it would be helpful nonetheless:
Would've made a PR but I would rather give that someone who actually knows what they're doing lmao
The text was updated successfully, but these errors were encountered: