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

Registry rework #5331

Closed
wants to merge 55 commits into from
Closed

Conversation

kiip1
Copy link
Contributor

@kiip1 kiip1 commented Jan 6, 2023

Description

This is the first PR in an effort to split Skript from api, the parser implementation and Bukkit implementation. The final goal is to have org.skriptlang.skript as main package for all api in relation to Skript, with a default implementation for the parser. The Bukkit implementation would be elsewhere.

Currently the API is marked as experimental so changes can still be applied, but merging this does allow addons to start using the new API. This PR is focused on the migrating the registration process to the new API, without breaking changes.

@AyhamAl-Ali AyhamAl-Ali added enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature Pull request adding a new feature. labels Jan 6, 2023
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great work!!

I've left a decent number of comments, but most are just formatting suggestions that can be batch added if you agree with them :)

I don't immediately have any major concerns. My "biggest" worry would be the inclusion of Event stuff in the default classes - but this is easy fixable (see my comments for more details on this)

Feel free to respond back to my comments here directly or we can discuss on Discord :)

src/main/java/ch/njol/skript/Skript.java Show resolved Hide resolved
src/main/java/ch/njol/skript/Skript.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/Skript.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/Skript.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/Skript.java Outdated Show resolved Hide resolved
@TheLimeGlass TheLimeGlass self-requested a review January 7, 2023 00:18
@kiip1 kiip1 requested review from APickledWalrus and removed request for TheLimeGlass January 7, 2023 15:02
@TheLimeGlass
Copy link
Collaborator

You have to be double tabbing on new line method builds and messages.

@kiip1 kiip1 requested a review from TheLimeGlass May 1, 2023 13:08
@TheLimeGlass TheLimeGlass added this to the v3.0 milestone May 2, 2023
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really good. Here are my current thoughts :)

src/main/java/ch/njol/skript/lang/SyntaxElementInfo.java Outdated Show resolved Hide resolved
src/main/java/org/skriptlang/skript/Skript.java Outdated Show resolved Hide resolved
*/
@ApiStatus.Experimental
@ApiStatus.NonExtendable
public interface Skript {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little unsure about this design. I might prefer something where we offer a generic Skript implementation to developers but also allow it to be customized. We would keep this interface, but also provide some sort of SimpleSkript or GenericSkript implementation that can be used (e.g. a minor rework of SkriptImpl).

This would also allow us to remove the static instance() method here in favor of the developers creating a Skript object themselves (for us, this would be done in the Skript JavaPlugin class). It could be something as simple as SimpleSkript.create()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added Skript#setInstance so Skript#instance will still return the current Skript instance (for internal usage). Design might be possible without Skript#instance but it'd mean passing the instance around everywhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO a Skript instance should be creatable by the user (e.g. you could run multiple Skript instances at once)
We could do something like Skript.create (keep a default implementation hidden) or do the SimpleSkript method I proposed

/**
* Used for sorting in ascending order.
*/
int priority();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should use the same Priority class as present in Structure (maybe it could be moved out)? That way a consistent ordering system is used too (lowest numbers take highest priority)

Also, it should be possible for this value to be overridden by developers.

return SyntaxInfo.of(origin, type, patterns);
}

public static final class Expression<E extends ch.njol.skript.lang.Expression<R>, R> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO these builders should extend the generic builder class and just add on their additional methods (ExpressionType, EntryValidator)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered this but that would be entering a generic hell. Might change this later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be a little rough, but worth pursuing IMO

@Moderocky Moderocky changed the base branch from master to dev/feature September 18, 2023 10:02
@kiip1 kiip1 marked this pull request as draft September 18, 2023 17:37
@APickledWalrus APickledWalrus removed this from the v3.0 milestone Nov 20, 2023
@APickledWalrus APickledWalrus removed the request for review from TheLimeGlass December 19, 2023 22:07
@APickledWalrus
Copy link
Member

Closing in favor of #6246

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. feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants