-
-
Notifications
You must be signed in to change notification settings - Fork 417
Script development auto reloading on save #7464
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
Script development auto reloading on save #7464
Conversation
APickledWalrus
left a comment
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.
The entry validator is a parameter for registering the structure. Is there a reason you aren't/can't just do that?
Oh no. Didn't see that. Interesting way of setting the EntryValidator. I still believe this overriding implementation is good so it can be changed dynamically. |
|
If it needs to be done dynamically (which seems unlikely), I think it would be better for the developer to manage it in init themselves |
You'd have to set the EntryValidator by getting the StructureData then the StructureInfo, and that would override the existing EntryValidator if it was also needed because the Structure init is called before the implemented Structure. |
|
They can simply store the EntryValidator on the class and validate it (receive an entry container) themselves in the overridden init. It does't necessarily have to be the internal one. This is the common approach for addon developers who implement these for Sections. |
|
I'd rather see this as an addon or script personally |
Ya that's one way of doing it. It probably should've been an overriding method from the start to avoid storing it in ram, like Njol did with everything. Changers for example. |
ShaneBeee
left a comment
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.
I was interested in trying this, but ran into a few minor issues.
We don't want to be creating an EntryValidator every time the Structure is parsed. I don't think storing it in RAM is anything to be concerned about (or how much memory that might be - it won't be that much). Handling the validation through the syntax info is fine as-is. |
It'll be needed at parse time since that's when the Structure is created and parsed. Once the EntryValidator is used during parsing, it'll be garbage collected. |
|
add it |
|
Been using this actively since, been so useful. |
* Finish base implementation for auto reloading * Finish auto reloading * Adjust entryValidator method * Add the [Skript] prefix * Use LiteralString for parsing * Add multiple expressions support for single line parsing * Clean imports * Apply suggestions from code review * Update src/main/java/ch/njol/skript/structures/StructAutoReload.java * Fix bugs, simplify implementation, add `reloading...` message. * uuids too --------- Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
* Finish base implementation for auto reloading * Finish auto reloading * Adjust entryValidator method * Add the [Skript] prefix * Use LiteralString for parsing * Add multiple expressions support for single line parsing * Clean imports * Apply suggestions from code review * Update src/main/java/ch/njol/skript/structures/StructAutoReload.java * Fix bugs, simplify implementation, add `reloading...` message. * uuids too --------- Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Description
Target Minecraft Versions: any
Requirements: none
Related Issues: #4313