Fixed removing EChests from Tuner and Tuner opening in other GUIs#90
Fixed removing EChests from Tuner and Tuner opening in other GUIs#90Sefiraat wants to merge 2 commits intoSlimefun:masterfrom
Conversation
TheBusyBiscuit
left a comment
There was a problem hiding this comment.
I don't quite understand the issue nor the fix here.
Can you please explain this, perhaps with a video and some code comments?
|
Ender Tuner Hijacking GUIs Edit : Weird 4k clipping fixed |
| @Override | ||
| public void onInteractItem(PlayerInteractEvent event) { | ||
| if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { | ||
| if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { // Make sure user is interacting intentionally (i.e. Not in a GUI) |
There was a problem hiding this comment.
- Code and comments should never go on the same line
- The comment is a bit misleading, the
PlayerInteractEventis not called for GUI events anyway?
There was a problem hiding this comment.
Given all other onInteractItem methods from other items have a getAction check before without comment and you can see the issue it's resolving, shall I just remove the comment? I originally shipped without one as it seemed to just bring it in line with other items?
As for why this fires, im not sure if its just the SF Guide, but any GUI icon clicked makes the player interact with their item in hand - so this isn't specific to the endertuner on further inspection. Here is a clip from a server with SF only :
https://user-images.githubusercontent.com/20646323/124713615-b1224180-def8-11eb-9922-e15a7c5c306b.mp4
I had made the assumption that this behavior was normal and intended, if not, let me know and ill create an issue on the SF GitHub.
Regardless, we still only want the tuner to trigger if the player is using it in a natural manner so limiting to these action types is still wise I think?
Description
Placed Ender Boxes can be pulled out from the tuner GUI without any effort.
Found while testing this issue, the Ender Tiner will overide interactions in other GUI's (like /sf open_guide)
Changes
Fixed the return when tuningblock != null in EnderTuner#onShiftClickExtract.
Wrapped onInteractEvent with an action check.
Related Issues
N/A
Checklist
NonnullandNullableannotations to my methods to indicate their behaviour for null values