Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Sefiraat
Copy link
Member

@Sefiraat Sefiraat commented Jul 5, 2021

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

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values

@Sefiraat Sefiraat requested a review from a team as a code owner July 5, 2021 16:07
Copy link
Member

@Sfiguz7 Sfiguz7 left a 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

Comment on lines +206 to +210
if (hasOpenGUI(player)) {
Debugger.getInstance().debug(player.getName() + " opened GUI for " + getOwningItem());
setOpenGUI(player, this);
listener.onGUIOpened(player);
player.openInventory(inventory);
Copy link
Member

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())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getViewers already a List...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants