-
-
Notifications
You must be signed in to change notification settings - Fork 391
Structure API #4108
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
Structure API #4108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the two questions. Implementation looks pretty good to me overall. Nice job ;D
src/main/java/ch/njol/skript/structures/PreloadingStructure.java
Outdated
Show resolved
Hide resolved
I just realized - would it be possible to create a Structure for events? I suppose their pattern would kind of match everything though - so maybe it would not be worth the trouble. |
It would be possible, but I don't think it would improve anything, so I did not do it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very neat changes! This is something I will probably adapt in skript-parser as well! The system is quite flexible without being too clunky.
src/main/java/ch/njol/skript/structures/PreloadingStructure.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some things that need to be addressed since the current system is not powerful enough to support add-on developers.
src/main/java/ch/njol/skript/structures/PreloadingStructure.java
Outdated
Show resolved
Hide resolved
SkriptEvents are now also Structures |
This issue was directed to this pull request #4246 Has this been addressed in this pull request? Yes -> This issue can be referenced. No -> The PR available tag can be removed on the issue in question. |
See #4252 (comment) and 58d70d2, it's been included, I've updated the description |
Fixes an issue where ParserInstance could unintentionally have a null Node
This allows a ParserInstance's tracked Node to be null
- Ensures entry data constructors funnel to 1 main constructor - Fixes some minor formatting errors - Fixes an issue where Literals did not work with ExpressionStructureEntryData and adds the ability to specify the SkriptParser flags to use
The entry data system has been made to work with all SectionNode's - not just those representing a Structure (top-level SectionNodes) There wasn't any real reason to enforce this, as the system has no real dependency on Structure. This makes it more accessible for developers who may wish to combine it with something like the Section API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Skript 2.7.0-beta1 , getCurrentScript return Script instead of Config SkriptLang/Skript#4108
Description
This PR adds a new Structure API that is used for creating and registering top-level elements. It also includes a Structure-specific entry parsing system to simplify the usage of entries (like in command structures).
A priority system is also included to determine the order in which structures should initially load. This is particularly useful for things like function definitions.
Also included is a new Script object, with the goal of creating a consistent object to be used across Skript's loading and unloading processes. The Script object includes things such as events and script-specific data values. The "script warning" system has also been moved to this object. Many places across Skript where Config or File were used have been refactored to use this new Script object.
ScriptLoader and SkriptEventHandler have had methods reduced and removed in an effort to promote system isolation / more "softcoding" of systems.
It converts and improves Skript's current structures:
Other notable changes:
registerBukkitEvents()
method has been replaced with more specific methods to be called by SkriptEvent during the registration process.ParserInstance#getCurrentScript
now returnsScript
instead ofConfig
.ParserInstance#getCurrentOptions
has been deprecated. The method will still function properly though.Functions#clearFunctions
has been deprecated.ScriptOptions
has been removed as it was integrated intoScript
.Trigger#getScript
now returnsScript
instead ofFile
.SkriptParser#parseEvent(String, String)
has been removed.Commands#loadCommand(SectionNode)
andCommands#loadCommand(SectionNode, boolean)
have been removed.Commands#unregisterCommands(Script)
has been deprecated.-
)loadStructure
methods within ScriptLoader privatecurrentEvents
system to always require an event. A newContextlessEvent
has been added for when there is no specific event(s) to take into account when parsing. Essentially, instead of usingnull
,ContextlessEvent
should be used.SelfRegisteringSkriptEvent#afterParse(Config)
asStructure#postLoad
now exists.Target Minecraft Versions: any
Requirements: none
Related Issues:
Fixing:
Non-Fixing: