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

EventValue Changers #7485

Open
1 task done
ShaneBeee opened this issue Jan 20, 2025 · 4 comments
Open
1 task done

EventValue Changers #7485

ShaneBeee opened this issue Jan 20, 2025 · 4 comments
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. PR available Issues which have a yet-to-be merged PR resolving it priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@ShaneBeee
Copy link
Contributor

Suggestion

I would like to suggest the option to have changers in EventValues

Why?

As of right now all you can do is GET, but you cannot modify the event-values.

This would be handy in cases where I wanna do something like
set event-value to some new value

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
@Efnilite
Copy link
Member

I get the utility here, but I think the immutability of the event values is important. Changing the event-player midway through a long event can be pretty confusing if you're reading back the code a few months later, or if you're trying to understand it. Curious to see what others think here though

@ShaneBeee
Copy link
Contributor Author

ShaneBeee commented Jan 22, 2025

but I think the immutability of the event values is important.

This statement confuses me. The whole reason for Bukkit calling events is so plugins can manipulate the outcome of the event.
Skript is often:
a) Limited on what it can do in events, since quite often you can only get event-values, but you can't manipulate them.
b) Skript often has to make another expression just so it can have a changer, and then we have a simple expression which can be used in only ONE event.

As an addon dev, its super frustrating having to create single expressions for single events, just so someone can manipulate the outcome of said event.

Changing the event-player midway through a long event...

Correct me if Im wrong, but is there a single event in Bukkit that you can change the player?
... ok, 2 events.
Image

Lets take a quick peak at the PlayerItemDamageEvent
What if I wanted to set the damage amount?
Skript wont let me do it, since we don't have changers for the event-values, even tho the Bukkit event supports setting the damage.
Now because Skript doesn't have changers for event-values.... now I have to create a whole new expression, just for this one thing, in this one event.

@Efnilite
Copy link
Member

What if I wanted to set the damage amount?
Skript wont let me do it, since we don't have changers for the event-values, even tho the Bukkit event supports setting the damage.

this isn't a skript feature?!?

i thought you meant changing what skript thinks the event-value is that is used in the rest of the method, so it'd only update in skript, not also on the event

@Efnilite Efnilite added enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Jan 22, 2025
@ShaneBeee
Copy link
Contributor Author

ShaneBeee commented Jan 22, 2025

What if I wanted to set the damage amount?
Skript wont let me do it, since we don't have changers for the event-values, even tho the Bukkit event supports setting the damage.

this isn't a skript feature?!?

i thought you meant changing what skript thinks the event-value is that is used in the rest of the method, so it'd only update in skript, not also on the event

OHHHHHHHHHH, yeah no.
I meant like changing the outcome of the event, via the event values.
A simple example would be like:

on some event:
    set event-item to 1 of stick

And no, currently event-values are getters only

better yet:

on consume:
	set event-item to 1 of stick
Image

@erenkarakal erenkarakal added the PR available Issues which have a yet-to-be merged PR resolving it label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. PR available Issues which have a yet-to-be merged PR resolving it priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

3 participants