Skip to content

Filter for multiple event types #1976

Answered by zax71
zax71 asked this question in Help
Discussion options

You must be logged in to vote
// Filter if the event is an instanceEvent happening in our instances or a minigameEvent on this minigame
eventNode = EventNode.event(getName(), EventFilter.ALL, (Event event) -> {
    if (event instanceof InstanceEvent instanceEvent) {
        return getInstances().contains(instanceEvent.getInstance());
    }

     if (event instanceof PlayerMinigameEvent minigameEvent) {
        return minigameEvent.getMinigame().equals(getName());
    }

    return false;
});

This is what I ended came up with after some help from other Minestom people :)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zax71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant