Skip to content

Conversation

@TheLimeGlass
Copy link
Contributor

@TheLimeGlass TheLimeGlass commented Jan 17, 2025

Description

  • Adds structure to denote automatic script reloading per script.
  • Adds entryValidator method to set an EntryValidator for a structure.
auto reload:
        # Cancels out permission node. Define the players that will get reload notifications.
	recipients: "LimeGlass" and "Dinnerbone"

	# Players with this permission will receive reload notifications.
	permission: "skript.reloadnotify"

Target Minecraft Versions: any
Requirements: none
Related Issues: #4313

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.

The entry validator is a parameter for registering the structure. Is there a reason you aren't/can't just do that?

@TheLimeGlass
Copy link
Contributor Author

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.

@APickledWalrus
Copy link
Member

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

@TheLimeGlass
Copy link
Contributor Author

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.

@APickledWalrus
Copy link
Member

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.

@Pikachu920
Copy link
Member

I'd rather see this as an addon or script personally

@TheLimeGlass
Copy link
Contributor Author

TheLimeGlass commented Jan 17, 2025

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.

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.

Copy link
Contributor

@ShaneBeee ShaneBeee left a 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.

@Moderocky Moderocky added the up for debate When the decision is yet to be debated on the issue in question label Jan 17, 2025
@APickledWalrus
Copy link
Member

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.

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.

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.

@TheLimeGlass
Copy link
Contributor Author

TheLimeGlass commented Jan 17, 2025

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.

@TheLimeGlass TheLimeGlass marked this pull request as draft January 17, 2025 23:27
@TheLimeGlass TheLimeGlass marked this pull request as ready for review January 18, 2025 00:08
@Dummybell
Copy link

add it

@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label May 15, 2025
@sovdeeth sovdeeth removed the up for debate When the decision is yet to be debated on the issue in question label Jun 3, 2025
@sovdeeth sovdeeth requested review from a team as code owners June 3, 2025 05:26
@sovdeeth sovdeeth requested review from UnderscoreTud and removed request for a team and ShaneBeee June 3, 2025 05:26
@APickledWalrus APickledWalrus linked an issue Jun 4, 2025 that may be closed by this pull request
1 task
@TheLimeGlass
Copy link
Contributor Author

Been using this actively since, been so useful.

@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Jul 5, 2025
@Absolutionism Absolutionism moved this to Awaiting Merge in 2.13 Releases Sep 4, 2025
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Sep 21, 2025
@sovdeeth sovdeeth merged commit ab707f8 into SkriptLang:dev/feature Sep 21, 2025
5 checks passed
@skriptlang-automation skriptlang-automation bot added the completed The issue has been fully resolved and the change will be in the next Skript update. label Sep 21, 2025
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.13 Releases Sep 21, 2025
@skriptlang-automation skriptlang-automation bot removed needs reviews A PR that needs additional reviews feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. labels Sep 21, 2025
@TheLimeGlass TheLimeGlass deleted the feature/auto-reload branch October 2, 2025 07:56
@sovdeeth sovdeeth moved this from Done - Awaiting Release to Done - Released in 2.13 Releases Oct 15, 2025
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
* 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>
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

completed The issue has been fully resolved and the change will be in the next Skript update.

Projects

No open projects
Status: Done - Released

Development

Successfully merging this pull request may close these issues.

[feature] - Automatic Script Reload

9 participants