-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix Recipe book dupe(s) and Block break dupes #89
base: master
Are you sure you want to change the base?
Conversation
src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBMachine.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/gui/STBInventoryGUI.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/sensibletoolbox/core/gui/STBInventoryGUI.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBMachine.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There, easier to fix
src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/items/BaseSTBMachine.java
Outdated
Show resolved
Hide resolved
…ms/BaseSTBMachine.java Co-authored-by: Sfiguz7 <[email protected]>
if (hasOpenGUI(player)) { | ||
Debugger.getInstance().debug(player.getName() + " opened GUI for " + getOwningItem()); | ||
setOpenGUI(player, this); | ||
listener.onGUIOpened(player); | ||
player.openInventory(inventory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shit is horrible
Why don't we have a method to do the whole setOpenGUI, onGUIOpened and openInv.... out of scope here but fuck meeeeeeee
|
||
@Override | ||
public void hideForAll() { | ||
for (HumanEntity player : new ArrayList<>(inventory.getViewers())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getViewers already a List...
Description
STB Recipe books will allow users to remove items if opened twice fast enough (autoclicker makes this trivial) allowing for the removal of any STB/Vanilla/other registered recipe item assuming they are on the correct page before attempting.
STB machines allow their items to be removed if the machine is broken while being viewed either by TNT or a 2nd player.
Changes
For recipe book dupes, I added a check to see if the player has the inventory opened before allowing the 2nd instance to open. This resolved the dupe and has no noticable side effects on machine GUIs.
For the machines I added a check for viewing players and kick them out.
Related Issues
Don't think these have ever been reported weirdly!
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values