Skip to content

Conversation

Absolutionism
Copy link
Contributor

@Absolutionism Absolutionism commented Aug 3, 2025

Problem

With the introduction of ExpressionSection in Skript 2.10, a suggestion at the time was to make an item builder section. however there was no way to achieve such without some of the changes that are introduced in this PR. Though this broadens the usage to more than just items.

Solution

Overview

This PR makes it possible to customize an object inside a section, allowing that object to be used as a default value and not require of x for the elements inside the section. This works by creating an object during #init that includes the type being customized that is checked for and used within a default context. This makes it safer and easier to write expressions that rely on context, because the right type is already known and enforced.
It also helps limit where default values can be used, instead of exposing all possible types through conversion, which could cause issues of confusion.

Adds ExprSecCustomizable

This class allows the user to input any object that can contain/hold data and customize it in the section, using the respective expressions to the type being built. This does extensive checking and expression handling in #init ensuring that the provided expression can only be used as one type and to check the type is able to be customized.
It is imperative that the type is determined during #init to allow successful parsing and usage of expressions in the section, as this class can be anything.

Adds SectionEvent

This class extends Event storing the object being used.
Hopefully to be mainstreamed to all ExpressionSections and/or EffectSections, but some of those classes require special handling, so the current state may not be applicable.
This class connects ExpressionSections to SectionValueExpression

Adds ExprSectionExpression

Similar to ExprEventExpression, this class is only used for SectionValueExpression

Adds CustomizableRegistry

This class allows registering classes that normally cannot be customized, such as Enums or Registries, to be customized as another type. Example: InventoryType to Inventory.
Also includes disallowing classes/types.

Adds DefaultCustomizables

Utility class for registering and disallowing types during the enabling process of Skript.

Misc
  • Deprecates constructors for EventValueExpression for a Builder.

Testing Completed

ExprSecCustomizable.sk
quickTest

Supporting Information

N/A


Completes: none
Related: none

@Absolutionism Absolutionism added the feature Pull request adding a new feature. label Aug 3, 2025
@Absolutionism
Copy link
Contributor Author

Labeled as draft to get feedback from others on these changes, incase any of them are extensive changes.
Reviews, suggestions, feedback are welcome while during draft.

@Efnilite Efnilite removed this from 2.13 Releases Aug 3, 2025
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

haven't checked the code yet, just commenting on the syntax

@Absolutionism Absolutionism requested a review from sovdeeth August 5, 2025 05:32
@Absolutionism Absolutionism marked this pull request as ready for review August 7, 2025 16:32
@Absolutionism Absolutionism requested review from a team as code owners August 7, 2025 16:32
@Absolutionism Absolutionism requested review from Pesekjak and removed request for a team August 7, 2025 16:32
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Aug 7, 2025
@Absolutionism Absolutionism changed the title Buildable Section Customizable Section Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature. needs reviews A PR that needs additional reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants