Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add check to event-values #8758

Copy link
Copy link

Description

@AnOwlBe
Issue body actions

Suggestion

Okay so random idea I had but basically:

Skript has a chunk of events that are built on top of normal bukkit events but with conditions (e.g. EvtPressurePlate or EvtFirstJoin)

which can cause some annoying but (I guess so far) resolvable issues

so my idea is allow us to have a check for event-values e.g.


eventValueRegistry.register(EventValue.builder(PlayerGameModeChangeEvent.class, GameMode.class)
			.getter(PlayerGameModeChangeEvent::getNewGameMode)
			.patterns("gamemode")
                        .check(PlayerGameModeChangeEvent::isCancelled)
			.build());

or a more advanced one


eventValueRegistry.register(EventValue.builder(PlayerGameModeChangeEvent.class, GameMode.class)
			.getter(PlayerGameModeChangeEvent::getNewGameMode)
			.patterns("gamemode")
                        .check(event -> {
                             if (conditions blah blah)
                                 return true;
                             return false;
                        })
			.build());

Basically it'd act like a check similiar to how events have check
e.g. lets say 2 events have same bukkit event (PlayerMoveEvent) but one wants event-item stack but one does not

currently that could work with a check in get/in a changer if x conditions meet then return nothing but that can be confusing for users so

instead if false is returned inside check then the event-value act like it does not exist on the event else if they do the event-value will work perfectly fine

Why?

Seems useful

Other

this possibly might already exist but I don't believe it does in the way I described only excludes

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.