Skip to content

Conversation

@Tigerpanzer02
Copy link

In my case it was useful to have a clearCloseHandler (having a default close handler which gets removed after something in gui got accepeted). I just added it for the other handlers in this pr, too. Just in case someone else needs it.

[A different way would be to make the handlers list public / accesable]

@MrMicky-FR
Copy link
Owner

Hi, wouldn't be easier to add a condition in the [close/click/open] handler to "remove" it when it's not needed ? Like in the example in the README

@Tigerpanzer02
Copy link
Author

Can you Show me the Part on the readme, I cant find.

@MrMicky-FR
Copy link
Owner

My bad it’s not directly in the README, but for example you can do this:

boolean ignoreClicks = false;

inv.addClickHandler(e -> {
  if (ignoreClicks) {
    return;
  }
  
  if (someConditionThatShouldRemoveHandler) {
    ignoreClicks = true;
  }
});

@Tigerpanzer02
Copy link
Author

Yep thats possible but if I cold remove all added handlers with Just one Line as the inventory should Close without any Interactions it would be way easier. Also it would be possible to create multiple default handlers which I can add and remove Like I want for the inventory 😅
To make it more understanble if you do a refreshable gui out of fastinv such as paged ones or updated inventories. It will be very useful.

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.

2 participants