ArcanePlugins / Treasury

🏦 A powerful multi-platform library for next-level plugin integrations.
https://hangar.papermc.io/ArcanePlugins/Treasury
Other
57 stars 14 forks source link

Use `Event` interface #150

Closed lokka30 closed 2 years ago

lokka30 commented 2 years ago

Instead of using the Object type for events, I think all events should implement an empty Event interface.

MrIvanPlays commented 2 years ago

My ears are all open for hearing your very good reason of why we should.

lokka30 commented 2 years ago

My ears are all open for hearing your very good reason of why we should.

What's wrong with enforcing an explicit statement that a class is an event? I haven't heard any reasons we shouldn't.

The coolest thing about our events is that you can make literally every object an event. What do I mean by that is that you don't need to extend any voodoo magic classes. You just create your object and call it and you're good to go.

This is exactly it. Why should an object that was never intended to be an event, become such?

A class can simply implement Event, an empty interface that just declares it is intention. Zero extending of any voodoo magic classes.

I'm not going to die on this hill but I am trying to do what's best for the long-term rigidity of our code. The last thing I want is for a headache to happen and anyone says 'Told you so'.

MrIvanPlays commented 2 years ago

Extending a class to explicitly say its an event is redundancy. Why Velocity doesn't require you to extend any Event class? Because its unnecessary bloat. No one said that every object shall or can be an event. We have class names and that's how in my opinion treasury shall opt on creating events.

lokka30 commented 2 years ago

Extending a class to explicitly say its an event is redundancy. Why Velocity doesn't require you to extend any Event class? Because its unnecessary bloat. No one said that every object shall or can be an event. We have class names and that's how in my opinion treasury shall opt on creating events.

Alright, let's go with this route, I'm comfortable with this :)