Skip to content

Function modifier rework - #8847

Open
Efnilite wants to merge 13 commits into
dev/featurefrom
feature/function-modifier-rework
Open

Function modifier rework#8847
Efnilite wants to merge 13 commits into
dev/featurefrom
feature/function-modifier-rework

Conversation

@Efnilite

@Efnilite Efnilite commented Aug 18, 2026

Copy link
Copy Markdown
Member

Problem

Parameter modifiers previously did not have proper support for containing data within a modifier, requiring messy code to make it work. Additionally, modifiers that defined constraints (such as RangedModifier) required internal changes to check values, thereby not allowing any addon from registering a custom modifier.

Signature modifiers, such as a function being local or returning a value, were previously dictated by fields in the Signature class. To allow for easier future expansion, signature modifiers have been migrated to use the same system as parameter modifiers.

Solution

Parameters

  • Added support for custom modifiers.
  • Made modifiers instances instead of static variables. This allows each instance to contain data specific to the function.
  • Added support for Constraint parameter modifiers, which check parameter values and deny function execution if a parameter value is invalid.

Signature

  • Added support for custom modifiers.
  • Added custom modifiers to DefaultFunction builder.

Priority

  • Added isBefore, isEqual, isAfter for simpler priority comparisons.

Parameters.java

  • Updated for future PRs.

Testing Completed

Added ParameterTest and SignatureTest for testing toFormattedString, and existing tests.

Supporting Information


Completes: none
Related: #8657
AI assistance: none

@Efnilite
Efnilite requested a review from a team as a code owner August 18, 2026 14:06
@Efnilite Efnilite added enhancement Feature request, an issue about something that could be improved, or a PR improving something. needs reviews A PR that needs additional reviews labels Aug 18, 2026
@Efnilite
Efnilite requested review from Burbulinis and removed request for a team August 18, 2026 14:06
@Efnilite
Efnilite requested a review from TheMug06 August 18, 2026 14:06
@Efnilite Efnilite moved this to In Review in 2.17 Releases Aug 18, 2026
Comment thread src/main/java/ch/njol/skript/lang/function/Parameter.java Outdated
Comment thread src/main/java/ch/njol/skript/lang/function/Signature.java Outdated
/**
* Represents a modifier that can be applied to a function signature.
*/
interface Modifier {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do we have 2 modifier interfaces now? Can't they be unified? idk it seems a bit confusing to have these duplicated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the modifiers mentioned here are applicable to function signatures (e.g. local or async). the other modifiers are for parameters (e.g. optional, keyed). i don't think it makes sense to merge them, since additional checks would be required to determine whether any given modifier is applicable to a signature or a parameter. do you think it could be useful to have a unified interface for modifiers that feature the priority and toFormattedString functions?

also, referencing these two modifiers is done through Signature.Modifier and Parameter.Modifier. do you want me to rename them to something clearer?

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. needs reviews A PR that needs additional reviews

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants