skript-mirror icon indicating copy to clipboard operation
skript-mirror copied to clipboard

[Suggestion] Custom Events / Event Aliases

Open ShaneBeee opened this issue 7 years ago • 3 comments

Is your feature request related to a problem? Please describe. Not really. I just think this would be a handy feature to clean up Skript coding. If I was to HAVE to pick a problem, I guess I could say, that using things like on "org.bukkit.event.player.PlayerChatTabCompleteEvent": Doesn't match the fluidity of how a Skript is written.

Describe the solution you'd like I wanted to suggest adding an option to create custom event aliases. Example: Right now I know you can do

on "org.bukkit.event.player.PlayerChatTabCompleteEvent":

But in my opinion that looks messy in a Skript, and doesn't match the fluidity of how you write a Skript. I think it would be super handy if you could import the event (maybe not actually import it since spigot stuff is already imported) with an alias, and use the alias as the event. example of what I'm thinking:

#import event (if not already imported)
import:
    org.bukkit.event.player.PlayerChatTabCompleteEvent as tabby
#or if its a bukkit event, just create an alias
mirror-aliases:
    org.bukkit.event.player.PlayerChatTabCompleteEvent = tabby

#use custom event alias
on tabby:
    do something

Describe alternatives you've considered I was told that Skellett has custom events, but I haven't been able to get them to work. I do not know of any other alternatives to this.

Additional context It seems like a LOT of people are starting to use skript-mirror and ditching other add-ons since a lot of said add-ons are outdated / unmaintained. I feel like being able to create your own events, essentially creating your own personal add-on to be using in your skirts would be super duper handy. I could see myself creating a skript that would load before all my other skripts that would house all of my custom events/expressions/effects/conditions and then be able to call them in my other skripts. All I'm missing right now is these custom event aliases.

Thank you for reading!

ShaneBeee avatar Aug 17 '18 05:08 ShaneBeee

Partially fixed in 7b3197a4ab659935726dcfb7e41f8053cf2b0fbf, though it is still restricted to the alias requirements for imports (so no spaces). It still isn't recommended to use import aliases to make reflection-based events look like a normal Skript event.

True custom event support is still planned, so I'm leaving this issue open.

btk5h avatar Aug 19 '18 07:08 btk5h

I'd rather have custom events over event aliases, because it means we can make events from java/our own custom ones with easy usage. Here's my idea of how these events would work:

  1. Java Events These are custom events from java with expressions like "player" or "location" to keep ease of use.
  2. Custom Events These are events caused by a 'cause effect' in the same script.

I'm not good at explaining so I'll show my idea of how these would work in an example.

Hastebin of Example

Cormanz avatar Jun 14 '19 11:06 Cormanz

I'd rather have custom events over event aliases, because it means we can make events from java/our own custom ones with easy usage. Here's my idea of how these events would work:

  1. Java Events These are custom events from java with expressions like "player" or "location" to keep ease of use.
  2. Custom Events These are events caused by a 'cause effect' in the same script.

I'm not good at explaining so I'll show my idea of how these would work in an example.

Hastebin of Example

Thanks for the suggestion! As I stated above, custom event support is planned, the hard part is figuring out how to actually implement it within our current codebase.

Right now, I simply don't have much time to dedicate to skript-mirror's development, so I've put this feature on hold.

btk5h avatar Jun 15 '19 00:06 btk5h