Releases: SkriptLang/Skript
Patch Release 2.13.2
Skript 2.13.2
Supports: Paper 1.20.4 - 1.21.10
Today, we are releasing Skript 2.13.2 to resolve some various issues found with Skript 2.13, as well as solving a few older bugs.
We have also revamped our contributor guide to be much more beginner-friendly, so now's a great time to try making your first PR! For existing contributors, please note the addition of the AI usage disclosure requirement for PRs:
If you relied on AI assistance to make a pull request, you must disclose it in the
pull request, together with the extent of the usage.
As always, you can report any issues on our issue tracker.
Happy Skripting!
Changelog
Additions / Changes
- #8285 Improves variable thread safety, preventing race conditions and conflicts when accessing variables on parallel threads.
- #8286 Adds 'child' as an option for the 'make adult/baby' effect.
- #8294 Updates contribution guidelines and adds AI disclosure requirement
Bug Fixes
- #8250 Fixes an issue where functions could be unloaded prior to the 'on unload' event firing, leading to Skript being unable to resolve function calls.
- #8263 Fixes issues with do-whiles not running properly in concurrent scenarios.
- #8271 Ensures legacy syntax infos have reference to their modern counterparts to support modern features like suppliers.
- #8278 Fixes vague and unclear errors when attempting to parse regions that do not exist or are ambiguous.
- #8284 Fixes an issue where
on brew completewas not a valid pattern, buton brew completwas. - #8293 Makes the auto-reload player name input case-insensitive.
- #8295 Fix an issue that prevented the use of
pastandfuturewhen using thelevel of playerin thelevel changeevent. - #8299 Fixes a bug where a delay in one event trigger could affect the behavior of another trigger of the same event that was parsed later on.
- #8304 Fixes an issue where a warning would be displayed when using an empty variable for cooldown storage.
Click here to view the full list of commits made since 2.13.1
Notices
Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.
While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.
Additionally, example scripts demonstrating usage of the available experiments can be found here.
Click to reveal the experiments available in this release
For-Each Loop
Enable by adding using for loops to your script.
A new kind of loop syntax that stores the loop index and value in variables for convenience.
This can be used to avoid confusion when nesting multiple loops inside each other.
for {_index}, {_value} in {my list::*}:
broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
send "Hello %{_player}%!" to {_player}
All existing loop features are also available in this section.
Queue
Enable by adding using queues to your script.
A collection that removes elements whenever they are requested.
This is useful for processing tasks or keeping track of things that need to happen only once.
set {queue} to a new queue of "hello" and "world"
broadcast the first element of {queue}
# "hello" is now removed
broadcast the first element of {queue}
# "world" is now removed
# queue is empty
set {queue} to a new queue of all players
set {player 1} to a random element out of {queue}
set {player 2} to a random element out of {queue}
# players 1 and 2 are guaranteed to be distinct
Queues can be looped over like a regular list.
Script Reflection
Enable by adding using script reflection to your script.
This feature includes:
- The ability to reference a script in code.
- Finding and running functions by name.
- Reading configuration files and values.
Local Variable Type Hints
Enable by adding using type hints to your script.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching
Enable by adding using error catching to your script.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources
Enable by adding using damage sources to your script.
Note that
typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Equippable Components
Enable by adding using equippable components to your script.
Equippable components allows retrieving and changing the data of an item in the usage as equipment/armor.
Below is an example of creating a blank equippable component, modifying it, and applying it to an item:
set {_component} to a blank equippable component:
set the camera overlay to "custom_overlay"
set the allowed entities to a zombie and a skeleton
set the equip sound to "block.note_block.pling"
set the equipped model id to "custom_model"
set the shear sound to "ui.toast.in"
set the equipment slot to chest slot
allow event-equippable component to be damage when hurt
allow event-equippable component to be dispensed
allow event-equippable component to be equipped onto entities
allow event-equippable component to be sheared off
allow event-equippable component to swap equipment
set the equippable component of {_item} to {_component}Changes can be made directly on to the existing equippable component of an item whether using the item itself or the retrieved equippable component
set the equipment slot of {_item} to helmet slot
set {_component} to the equippable component of {_item}
allow {_component} to swap equipmentFor more details about the syntax, visit equippable component on our documentation website.
Join us on Discord
We have an official Discord community where we share announcements and and perform testing for upcoming features.
Thank You
Special thanks to the contributors whose work was included in this version:
- @erenkarakal
- @ericd590 ⭐ First contribution! ⭐
- @HarshMehta112 ⭐ First contribution! ⭐
- @JakeGBLP
- @sovdeeth
- @TFSMads
- @UnderscoreTud ⭐ First contribution! ⭐
As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.
Patch Release 2.13.1
Skript 2.13.1
Today, we are releasing Skript 2.13.1 to resolve some of the most common issues reported with Skript 2.13.0.
As always, you can report any issues on our issue tracker.
Happy Skripting!
Changelog
Additions / Changes
- #8225 Added support for using a list of strings in the
text ofexpression. - #8226 Adds support for using
closestas an alias in the 'nearest entity' expression.
Bug Fixes
- #8221 Fixes an issue where functions with one plural parameter that has default values would cause an exception when the default values were used.
- #8240 Removes legacy code used in the bucket events, preventing Skript from loading legacy material support and causing a temporary server freeze.
- #8242 Fixes an extraneous
thein the 'tablisted players' expression. - #8245 Fixes an issue with matching functions that have a single list parameter.
- #8248 Fixes an issue with how the 'has scoreboard tag' condition handled
ORinputs. - #8249 Fixes an issue where the name of blocks (such as chests) would not carry over when those blocks were placed.
Click here to view the full list of commits made since 2.13.0
Notices
Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.
While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.
Additionally, example scripts demonstrating usage of the available experiments can be found here.
Click to reveal the experiments available in this release
For-Each Loop
Enable by adding using for loops to your script.
A new kind of loop syntax that stores the loop index and value in variables for convenience.
This can be used to avoid confusion when nesting multiple loops inside each other.
for {_index}, {_value} in {my list::*}:
broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
send "Hello %{_player}%!" to {_player}
All existing loop features are also available in this section.
Queue
Enable by adding using queues to your script.
A collection that removes elements whenever they are requested.
This is useful for processing tasks or keeping track of things that need to happen only once.
set {queue} to a new queue of "hello" and "world"
broadcast the first element of {queue}
# "hello" is now removed
broadcast the first element of {queue}
# "world" is now removed
# queue is empty
set {queue} to a new queue of all players
set {player 1} to a random element out of {queue}
set {player 2} to a random element out of {queue}
# players 1 and 2 are guaranteed to be distinct
Queues can be looped over like a regular list.
Script Reflection
Enable by adding using script reflection to your script.
This feature includes:
- The ability to reference a script in code.
- Finding and running functions by name.
- Reading configuration files and values.
Local Variable Type Hints
Enable by adding using type hints to your script.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching
Enable by adding using error catching to your script.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources
Enable by adding using damage sources to your script.
Note that
typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Equippable Components
Enable by adding using equippable components to your script.
Equippable components allows retrieving and changing the data of an item in the usage as equipment/armor.
Below is an example of creating a blank equippable component, modifying it, and applying it to an item:
set {_component} to a blank equippable component:
set the camera overlay to "custom_overlay"
set the allowed entities to a zombie and a skeleton
set the equip sound to "block.note_block.pling"
set the equipped model id to "custom_model"
set the shear sound to "ui.toast.in"
set the equipment slot to chest slot
allow event-equippable component to be damage when hurt
allow event-equippable component to be dispensed
allow event-equippable component to be equipped onto entities
allow event-equippable component to be sheared off
allow event-equippable component to swap equipment
set the equippable component of {_item} to {_component}Changes can be made directly on to the existing equippable component of an item whether using the item itself or the retrieved equippable component
set the equipment slot of {_item} to helmet slot
set {_component} to the equippable component of {_item}
allow {_component} to swap equipmentFor more details about the syntax, visit equippable component on our documentation website.
Join us on Discord
We have an official Discord community where we share announcements and and perform testing for upcoming features.
Thank You
Special thanks to the contributors whose work was included in this version:
- @AfkUserMC ⭐ First contribution! ⭐
- @CJH3139
- @CrebsTheCoder ⭐ First contribution! ⭐
- @Efnilite
- @sovdeeth
- @TFSMads
As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.
Feature Release 2.13.0
Skript 2.13.0
Today, we are excited to release Skript 2.13.0. This release includes a handful of new features, bug fixes, and behind-the-scenes API improvements to play with. For addon developers, we strongly recommend reviewing the Type Properties section below.
Please also note our changes to the supported versions. 2.13 will be 1.20.4+, and Paper is required.
Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!
Per our release model, we plan to release 2.13.1 on November 1st. We may release emergency patches before then should the need arise.
Happy Skripting!
Changes to Supported Versions and Platforms
As announced with 2.12, we have updated our policy for supported versions. Going forward, Skript will guarantee support for the last 18 months of Minecraft releases. This means 2.13 will be 1.20.4+, while 2.14 will be 1.21+.
Additionally, with Paper forking itself from Spigot, it has become increasingly difficult to support both platforms. As a result, this version of Skript has dropped support for Spigot. Skript now requires Paper or a downstream fork of Paper, such as Purpur or Pufferfish.
Major Changes
Equippable Components (Experimental)
Added in #7194
Note
This feature is currently experimental and can be used by enabling the equippable components experiment.
Equippable components allow retrieving and changing the data of an item in the usage as equipment/armor.
Below is an example of creating a blank equippable component, modifying it, and applying it to an item:
set {_component} to a blank equippable component:
set the camera overlay to "custom_overlay"
set the allowed entities to a zombie and a skeleton
set the equip sound to "block.note_block.pling"
set the equipped model id to "custom_model"
set the shear sound to "ui.toast.in"
set the equipment slot to chest slot
allow event-equippable component to be damage when hurt
allow event-equippable component to be dispensed
allow event-equippable component to be equipped onto entities
allow event-equippable component to be sheared off
allow event-equippable component to swap equipment
set the equippable component of {_item} to {_component}Automatic Reloading
Added in #7464
A new Structure has been added that enables automatic reloading of a script when it is updated (e.g. the file is saved). This feature is only supported if asynchronous loading is enabled in Skript's configuration file (config.sk).
automatically reload this script:
recipients: "Sahvde" # The names or uuids of players who, apart from console, will see the success/error messages in chat.
OR
auto reload:
permission: myserver.see_auto_reloads # all players with this permission will see the messages.Debug Information Expression
Added in #8207
A new expression that returns additional information about a value has been added. Currently, this consists of the value itself and its class, though this is subject to change in the future.
set {my_list::*} to 1, "2", and vector(1, 2, 3)
broadcast debug info of {my_list::*}
# prints:
# 1 (integer)
# "2" (text)
# x: 1, y: 2, z: 3 (vector)Type Properties (Experimental)
Added in #8165
Included in 2.13 is an experimental opt-in API for what we're tenatively calling 'type properties'. These are a way for addons to be able to use the same generic name of x or x contains y syntaxes that Skript does without causing syntax conflicts. You can register your type (ClassInfo) as having a property, such as Property#NAME for name of x, and Skript will automatically allow it to be used in the name of expression. For more details on how to do this and what else you can do with type properties, see the PR. We plan on making a more comprehensive API spec/tutorial once the implementation is solidified, but for now the PR description should be more than sufficient to try it out.
However, since this is still experimental and not well tested, it requires a secret config option to enable. To activate property syntaxes, add the line use type properties: true somewhere in your config.sk. Without it, Skript will still use the old syntaxes for things like name of. We hope you try out this new API and give us feedback on what works, what doesn't, and what you'd like to see for its full release in 2.14. The number of property-driven syntaxes is rather small, but we plan on adding many more in the coming months!
⚠ Breaking Changes
- #7985 Changes the method signature for the abstract
EntityData#init. Adds parametermatchedCodeNameand refactorsmatchedPattern. - #8072 Enforces using
physicsinstead ofphysicin the block update effect.
Changelog
Additions
- #7194 Adds experimental support for equippable components and all correlating data.
- #7275 Adds elements for brewing stands such as brewing stand slots, fuel, time, and events.
- #7464 Adds a structure that allows a script to be automatically reloaded when it is saved, if async loading is enabled in config.sk.
- #7878 Adds support for specifying the amount of damage in the 'force attack' effect.
- #7888 Adds a 'midpoint' expression to obtain the midpoint between two locations or vectors.
- #7985 Adds an 'is spawnable' condition to check whether an entity is spawnable in a world.
- #8008 Adds literals for the maximum 'double', 'float', 'integer', and 'long' values and the minimum 'double', 'float', 'integer', and 'long' values.
- #8092 Adds support for using 'vehicle' alone in the 'mount' event.
- #8101 Adds a 'tablisted players' expression to obtain and modify the players listed in the tablist menu for a given player.
- #8113 Adds the ability to enchant an item at as a specific level, as if an enchanting table was used, to the 'enchant' effect.
- #8134 Adds a 'time lived' expression to get the duration an entity has been alive for.
- #8196 Adds a runtime error when attempting to get the distance between locations in different worlds.
- #8197 Adds support for changing the
event-locationfor 'portal' event. - #8206 Adds a runtime error when using the sort effect and mapping the input to a null value, which cannot be sorted.
- #8207 Adds a 'debug info' expression that returns extra information about a value.
- #8219 Adds early support for Minecraft 1.21.10.
- #8229 Adds
playtimeas an alias to the 'time played' expression. - #8230 Adds
pullas an alias to the 'push' effect.
Changes
- #8072 Enforces using
physicsinstead ofphysicin the block update effect.
Bug Fixes
- #7985 Fixes being unable to spawn certain entities in certain states, such as
red foxandsnow fox. - #8064 Fixes an issue where it was not possible to spawn a
minecart. - #8177 Fixes the 'cannot reset' and 'cannot delete' error messages of the 'change' effect being swapped around.
- #8182 Fixes an issue where variable changes across multiple threads could be processed in the wrong order, resulting in data loss.
- #8185 Fixes the 'system time' event not triggering on the main thread.
- #8189 Fixes an issue where function calls with a single parameter to functions with 0 required parameters would fail to parse.
- #8195 Fixes an issue where the 'catch runtime errors' section would stop catching errors after the default error limit was reached.
- #8199 Fixes an issue where functions could not use Expression Sections.
- #8232 Fixes an issue where Expression Sections did not work properly with Effect Sections (used as an Effect).
API Changes
Pre-Release 2.13.0-pre1
Skript 2.13.0-pre1
Hi all, we've got a new feature pre-release for you all. Thankfully, this one's a bit more reasonable in size than the massive releases of 2.10, 2.11, and 2.12. We have some great features and a bunch of behind-the-scenes API improvements for you this go around. Addon developers should pay special attention to the Type Properties section below.
Please also note our changes to the supported versions. 2.13 is 1.20.4+, and Paper only.
Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!
Per our release model, we plan to release 2.13.0 on October 15th. We may release additional pre-releases before then should the need arise.
Happy Skripting!
Changes to Supported Versions and Platforms
As announced with 2.12, we have updated our policy for supported versions. Going forward, Skript will guarantee support for the last 18 months of Minecraft releases. This means 2.13 is 1.20.4+, while 2.14 will be 1.21+.
Additionally, with Paper forking itself from Spigot, it has become increasingly difficult to support both platforms. As a result, this version of Skript is dropping support for Spigot. Skript now requires Paper or a downstream fork of Paper, such as Purpur or Pufferfish.
Major Changes
- #7194 Adds support for equippable components and all correlating data. Smurfy put in a lot of work into the backing API for components, so look forward to a lot more component support in the next few releases!
set the allowed entities of {_item} to a zombie and a skeleton
make {_item} lose durability when hurt
if {_item} can be dispensed:
add "Dispensable" to lore of {_item}- #7464 Adds a structure that allows a script to be automatically reloaded when it is saved, if async loading is enabled in
config.sk:
automatically reload this script:
recipients: "Sahvde" # The names or uuids of players who, apart from console, will see the success/error messages in chat.
OR
auto reload:
permission: myserver.see_auto_reloads # all players with this permission will see the messages.- #8165 Adds Type Property API. See below.
- #8207 Adds a
debug infoexpression that prints out extra information about a value. Currently this consists of the value itself and its class, though this is subject to expansion in the future!
set {my_list::*} to 1, "2", and vector(1, 2, 3)
broadcast debug info of {my_list::*}
# prints:
# 1 (integer)
# "2" (text)
# x: 1, y: 2, z: 3 (vector)Type Properties (For Addon Devs)
Included in 2.13 is an experimental opt-in API for what we're tenatively calling 'type properties'. These are a way for addons to be able to use the same generic name of x or x contains y syntaxes that Skript does without causing syntax conflicts. You can register your type (ClassInfo) as having a property, such as Property#NAME for name of x, and Skript will automatically allow it to be used in the name of expression. For more details on how to do this and what else you can do with type properties, see the PR. We plan on making a more comprehensive API spec/tutorial once the implementation is solidified, but for now the PR description should be more than sufficient to try it out.
However, since this is still experimental and not well tested, it requires a secret config option to enable. To activate property syntaxes, add the line use type properties: true somewhere in your config.sk. Without it, Skript will still use the old syntaxes for things like name of. We hope you try out this new API and give us feedback on what works, what doesn't, and what you'd like to see for its full release in 2.14. The number of property-driven syntaxes is rather small, but we plan on adding many more in the coming months!
⚠ Breaking Changes
- #7985 Changes the method signature for the abstract
EntityData#init. Adds parametermatchedCodeNameand refactorsmatchedPattern. - #8072 Enforces using
physicsinstead ofphysicin the block update effect.
Changelog
Additions
- #7194 Adds support for equippable components and all correlating data.
- #7275 Adds elements for brewing stands such as brewing stand slots, fuel, time, and events.
- #7464 Adds a structure that allows a script to be automatically reloaded when it is saved, if async loading is enabled in config.sk.
- #7888 Adds an expression to get the midpoint between two locations or vectors.
- #7985 Adds a condition to check if an entity is spawnable in a world.
- #8008 Adds literals for the maximum and minimum numerical values, such as longs, doubles, or ints.
- #8101 Adds an expression to get and modify the players listed in the tab menu for a given player.
- #8113 Adds the ability to enchant an item at as a specific level, as if an enchanting table was used.
- #8134 Adds an expression to get the duration an entity has been alive for.
- #8207 Adds a
debug infoexpression that prints out extra information about a value. Currently this consists of the value itself and its class, though this is subject to expansion in the future!
Changes
- #7797 Uses
project.testEnvinbuild.gradleinstead of updating the latest version for both. - #7878 Allows specifying the amount of damage in the
force entity to attack entityeffect. - #8072 Enforces using
physicsinstead ofphysicin the block update effect. - #8092 Allows using
vehiclealone in the mount event. - #8196 Adds a runtime error when attempting to get the distance between locations in different worlds.
- #8197 Adds support for changing the
event-locationforon portal. - #8206 Adds a runtime error when using the sort effect and mapping the input to a null value, which cannot be sorted.
Bug Fixes
- #7985 Fixes being unable to spawn certain entities in certain states, such as
red foxandsnow fox. - #8064 Fixes an issue where it was not possible to spawn a
minecart. - #8177 Fixes the 'cannot reset' and 'cannot delete' error messages being swapped around.
- #8182 Fixes the order of which queued variable changes are processed.
- #8185 Fixes
at %time% [in] real timeby triggering the code on the main thread. - #8189 Fixes functions with 0 required parameters.
- #8195 Fixes an issue where the runtime error catching section would not catch errors after the default error limit is reached.
- #8199 Fixes issues with expression sections not claiming sections when used as function parameters.
API Changes
- #7985 Changes
Patternto allow providingnullas the object for generic usage. - #8011 Exposes the script loader executor via the
Taskapi. - #8035 Adds support for using an
EntryDatamultiple times. - #8065 Adds support for custom operators.
- #8116 Makes
JSONGeneratoravailable for addons and updates thedocs.jsonformat. - #8120 Adds a method to get a
Coloras an ARGB integer. - #8138 Adds getting pattern combinations from
PatternElementand tests to catch possible pattern conflicts. - #8150 Adds
SimplifiedConditionfor constant conditions.ConditionimplementsSimplifiable. - #8165 Adds the Type Property API.
- #8180 Changes the parameter name for
Expressionclass fromexpressionTypetoexpressionClassinSkript#registerExpression. - #8195 Improves runtime error filtering with the introduction of
RuntimeErrorFilter, which allows different consumers to apply different levels of filtering to the errors they print. - #8201 Adds support for excluding packages from being loaded in
ClassLoader. - #8211 Improves the classes
ExpressionListreturns foracceptChangeto more accurately reflect the changers of the expressions within the list. - #8213 Fixes
Functions#getJavaFunctionsto only returnJavaFunctions.
Click here to view the full list of commits made since 2.12.2
Notices
Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.
While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.
Additionally, example scripts demonstrating usage of the available experiments can be found here.
Click to reveal the experiments available in this release
For-Each Loop
Enable by adding using for loops to your script.
A new kind of loop syntax that stores the loop index and value in variables for convenience.
This can be used to avoid confusion when nesting multiple loops inside each other.
for {_index}, {_value} in {my list::*}:
broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
send "Hello %{_player}%!" to {_player}
All existing loop features are also available in this section.
Queue
Enable by adding using queues to your script.
A collection that removes elements whenever they are requested.
This is useful for processing tasks or keeping track of things that need to happen only once.
set {queue} to a new queue of "hello" and "w...
Patch Release 2.12.2
Skript 2.12.2
Today, we are releasing Skript 2.12.2 to continue resolving issues reported with 2.12.
As always, you can report any issues on our issue tracker.
Happy Skripting!
Changelog
Bug Fixes
- #8077 Fixes an issue where using entities with the second 'play effect' pattern was not possible.
- #8098 Implements type-aware function parsing to fix issues where function calls could not be parsed as the correct functions.
- #8109 Fixes an issue where the 'loop value' expression sometimes failed to evaluate when used with other expressions.
- #8135 Fixes issues with function parsing related to loading and having singular default values.
- #8151 Removes an errant colon in the examples for the fire resistance effect.
- #8164 Fixes an exception being thrown for some uses of the
%classinfo% inputexpression. - #8147 Fixes a bug where an
elsesection was considered delayed due to a delay in itsifsection. - #8171 Fixes parsing order issue with
reversed 2 timesby only allowing plural inputs toreversed %objects%.
API/Development
- #8041 Exposes
BukkitUtils#getRegistryClassInfo()to assist with creating types backed by Bukkit or Paper registries. - #8121 Allows null inputs to
Direction.combine(). - #8132 Loosens generics for
EntryDataExpressionfromTto? extends Tto allow for subtypes for the default values. - #8145 Prioritizes Skript syntaxes before addon-provided syntaxes when ordering syntaxes of the same priority.
- #8154 Ensures the possible return types for
ExpressionListare accurate after use ofgetConvertedExpression(). - #8158 Makes
SectionContextandSectionContext#modify()public for addon use.
Click here to view the full list of commits made since 2.12.1
Notices
Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.
While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.
Additionally, example scripts demonstrating usage of the available experiments can be found here.
Click to reveal the experiments available in this release
For-Each Loop
Enable by adding using for loops to your script.
A new kind of loop syntax that stores the loop index and value in variables for convenience.
This can be used to avoid confusion when nesting multiple loops inside each other.
for {_index}, {_value} in {my list::*}:
broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
send "Hello %{_player}%!" to {_player}
All existing loop features are also available in this section.
Queue
Enable by adding using queues to your script.
A collection that removes elements whenever they are requested.
This is useful for processing tasks or keeping track of things that need to happen only once.
set {queue} to a new queue of "hello" and "world"
broadcast the first element of {queue}
# "hello" is now removed
broadcast the first element of {queue}
# "world" is now removed
# queue is empty
set {queue} to a new queue of all players
set {player 1} to a random element out of {queue}
set {player 2} to a random element out of {queue}
# players 1 and 2 are guaranteed to be distinct
Queues can be looped over like a regular list.
Script Reflection
Enable by adding using script reflection to your script.
This feature includes:
- The ability to reference a script in code.
- Finding and running functions by name.
- Reading configuration files and values.
Local Variable Type Hints
Enable by adding using type hints to your script.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching
Enable by adding using error catching to your script.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources
Enable by adding using damage sources to your script.
Note that
typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Join us on Discord
We have an official Discord community where we share announcements and and perform testing for upcoming features.
Thank You
Special thanks to the contributors whose work was included in this version:
- @Absolutionism
- @APickledWalrus
- @arpita2525 ⭐ First contribution! ⭐
- @JakeGBLP
- @sovdeeth
- @TheLimeGlass
As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.
Patch Release 2.12.1
Skript 2.12.1
Today, we are releasing Skript 2.12.1 to resolve some of the most common issues reported with Skript 2.12.0. This release includes support for Minecraft 1.21.8.
As always, you can report any issues on our issue tracker.
Happy Skripting!
Changelog
Additions / Changes
- #8009 Adds
launchas an alternative keyword for the 'shoot' event. - #8010 Adds support for checking whether an entity has any potion effects using the 'has potion' condition.
- #8054 Adds support for Minecraft 1.21.8
- #8076 Further tweaks the default syntax ordering to improve performance and error messages.
Bug Fixes
- #8043 Fixes being able to wait for an indefinite amount of time.
- #8046 Fixes an issue where attempting to register overloaded functions with an argument type of one function being convertable to an argument type of another failed.
- #8068 Fixes an issue where literal specification could be too eager and fail with function parameters.
- #8069 Fixes an issue where looping over
all item typescould result in an error on newer versions. - #8071 Fixes an issue where valid arguments for a single list parameter function sometimes failed to resolve to that function.
- #8081 Fixes an issue where seemingly non-literal inputs for the 'x of item/entity type' expression caused the syntax to fail to parse.
- #8082 Fixes an issue where valid statements including a section expression could fail to parse.
- #8086 Fixes an issue where harnesses could not be equipped onto happy ghasts.
- #8087 Fixes edge-case errors that could occur from rounding.
- #8088 Fixes a few minor typographical errors in the configuration.
- #8089 Fixes an issue where default expressions could fail to be used.
- #8090 Fixes an issue where the 'loop value' expression was too accepting of
loop-Xinputs for specific types. - #8096 Fixes an issue where single list parameter functions were always chosen over functions with a specific number of parameters of the same type.
API/Development
- #8000 Improves the testing assertion output for the 'contains' condition.
- #8066 Fixes an issue where the project's checkstyle configuration incorrectly treated tab width.
Click here to view the full list of commits made since 2.12.0
Notices
Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.
While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.
Additionally, example scripts demonstrating usage of the available experiments can be found here.
Click to reveal the experiments available in this release
For-Each Loop
Enable by adding using for loops to your script.
A new kind of loop syntax that stores the loop index and value in variables for convenience.
This can be used to avoid confusion when nesting multiple loops inside each other.
for {_index}, {_value} in {my list::*}:
broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
send "Hello %{_player}%!" to {_player}
All existing loop features are also available in this section.
Queue
Enable by adding using queues to your script.
A collection that removes elements whenever they are requested.
This is useful for processing tasks or keeping track of things that need to happen only once.
set {queue} to a new queue of "hello" and "world"
broadcast the first element of {queue}
# "hello" is now removed
broadcast the first element of {queue}
# "world" is now removed
# queue is empty
set {queue} to a new queue of all players
set {player 1} to a random element out of {queue}
set {player 2} to a random element out of {queue}
# players 1 and 2 are guaranteed to be distinct
Queues can be looped over like a regular list.
Script Reflection
Enable by adding using script reflection to your script.
This feature includes:
- The ability to reference a script in code.
- Finding and running functions by name.
- Reading configuration files and values.
Local Variable Type Hints
Enable by adding using type hints to your script.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching
Enable by adding using error catching to your script.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources
Enable by adding using damage sources to your script.
Note that
typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Join us on Discord
We have an official Discord community where we share announcements and and perform testing for upcoming features.
Thank You
Special thanks to the contributors whose work was included in this version:
- @Absolutionism
- @APickledWalrus
- @Efnilite
- @Pesekjak
- @sovdeeth
- @sweetestpiper ⭐ First contribution! ⭐
- @TheLimeGlass
As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.
Feature Release 2.12.0
Skript 2.12.0
2.12.0 is here! Please excuse the later release time, Pickle's on vacation! We've got a bounty of new features, changes, and bug fixes for you in Skript 2.12, along with early support for 1.21.6/7.
Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!
Per our release model, we plan to release 2.12.1 on August 1st. We may release emergency patches before then should the need arise.
We would also like to welcome a new addition to the team, @Absolutionism!
Happy Skripting!
Changes to Supported Versions and Platforms
Back in 2.10, we switched to supporting the last three major versions. While reasonable at the time, Mojang has continued to make significant changes between minor versions and seems to have shyed away from incrementing the major version counter. In order to reduce the development burden of supporting so many versions with different features, as of 2.13 (next release) we have decided to switch to supporting the last 18 months of Minecraft releases. This means as of 2.13, Skript will support 1.20.4 and newer. 2.14 will be 1.21.0 and newer. We hope this change will allow us to modernize Skript more quickly and more fully support new systems like item components going forward. To clarify, 2.12 still supports 1.19.4+. These changes will affect 2.13 and later.
In the same vein, Paper has recently completed its fork away from Spigot. We have aimed to maintain support for both versions so far, but we are running into issues where the API differences between Paper and Spigot are becoming too great. It is not feasible for us to develop two parallel versions of Skript, and as a result, we will be dropping support for Spigot starting with 2.13. We encourage the small portion of our users who are still using Spigot to upgrade to Paper if possible.
Major Changes
Ephemeral Variables
Ephemeral variables (or ram vars, or memory vars) are now fully implemented by default for all users. These are global variables that are not saved between restarts. To make a variable ephemeral, add a hyphen (-) to the start of its name: {-var}. These variables are about 2.5x faster to change compared to normal global variables. You do not need to do anything to enable them.
Function Overloading
Note
The script reflection experiment, which includes syntax for dynamically referencing and executing functions, does not yet support working with overloaded functions.
Function overloading enables creating functions that have the same name but different parameters types/parameter counts.
function send_welcome(p: player):
send_welcome({_p}, false)
function send_welcome(p: player, first_time: boolean):
if {_first_time} is true:
send "Welcome to our server for the first time, %name of {_p}%!" to {_p}
else:
send "Welcome back to our server, %name of {_p}%!" to {_p}
Local Variable Type Hints (Experimental)
Note
This feature is currently experimental and can be used by enabling the type hints experiment.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching (Experimental)
Note
This feature is currently experimental and can be used by enabling the error catching experiment.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources (Experimental)
Note
This feature is currently experimental and can be used by enabling the damage sources experiment.
Caution
Note that type has been removed as an option for the 'damage cause' expression as damage cause and damage type now refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Contributing Updates
We are now allowing contributors to release their code contributions under the more-permissive MIT License. For more information, please review our LICENSING.md file.
⚠ Breaking Changes
- When using
index of "a" in "b", values that do not appear in the second string will now returnnoneinstead of the previous-1. - The
is enchanted withcondition now looks for exact levels instead of the specified level or better. Old behavior can be replicated withif {_item} is enchanted with sharpness 2 or better. Some examples:
if {_item} is enchanted with sharpness 2 # only passes for sharpness 2. Previous behavior allowed sharpness of 2 or greater to pass.
if {_item} is enchanted with sharpness 2 or better # sharpness 2+
if {_item} is enchanted with sharpness 2 or worse # sharpness 2 or 1
if {_item} is enchanted with sharpness # sharpness of any level- An infinite timespan literal was added, meaning Timespan math operations can now result in an infinite timespan value (just like numbers).
- The parsing behavior of the 'amount' expression has changed. Given an expression like
amount of {a::*}, "b", it was before parsed as(amount of {a::*}), "b", but it is now parsed asamount of ({a::*}, "b"). Use parentheses as necessary to clarify your intent. - For the old 'beacon values' expression,
beaconis now a required keyword for therangeandtierexpressions. - The
remove allchanger for the 'custom model data' expression has been removed. It functioned the same asremove. headhas been removed as an option for the 'player skull' expression ashead of playerconflicts with the 'head location' expression.typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.- The 'load world' effect now requires
world. - The API method
RegistryParser#getAllNameshas been removed in favor ofRegistryParser#getCombinedPatterns(from thePatternedParserinterface). - API methods for the
sincedocumentation field have changed on SkriptEventInfo:SkriptEventInfo#getSince() (String) -> SkriptEventInfo#getSince() (String[])BukkitSyntaxInfos.Event.since() (String) -> BukkitSyntaxInfos.Event.since() (Collection<String>)BukkitSyntaxInfos.Event.Builder.since(String) -> BukkitSyntaxInfos.Event.Builder.addSince(String)
- (API) Syntax ordering is no longer based on registration order when a priority is shared. This may expose syntax conflicts if this behavior was depended on.
Changelog
Additions
- #4154 Adds support for boolean values to the 'toggle' effect and an 'inverse boolean' expression to obtain the inverse of a boolean (at long last).
- #6902 Adds a 'buried item' expression and a 'dusted stage' expression for working with brushable blocks.
- #7495 Adds ephemeral variables (starting with
-) which are cleared when the server restarts. - #7561 Adds an '[except](https://docs.skriptlang.org/docs.html?search=#Ex...
Pre-Release 2.12.0-pre2
Skript 2.12.0-pre2
Today, we are releasing Skript 2.12.0-pre2. This pre-release includes additional bug fixes, including some for issues that were reported with the first pre-release. Skript 2.12 includes dozens of new features and bug fixes, along with early support for 1.21.6/7.
Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!
Per our release model, we plan to release 2.12.0 on July 15th. We may release additional pre-releases before then should the need arise.
We would also like to welcome a new addition to the team, @Absolutionism!
Happy Skripting!
Changes to Supported Versions and Platforms
Back in 2.10, we switched to supporting the last three major versions. While reasonable at the time, Mojang has continued to make significant changes between minor versions and seems to have shyed away from incrementing the major version counter. In order to reduce the development burden of supporting so many versions with different features, as of 2.13 (next release) we have decided to switch to supporting the last 18 months of Minecraft releases. This means as of 2.13, Skript will support 1.20.4 and newer. 2.14 will be 1.21.0 and newer. We hope this change will allow us to modernize Skript more quickly and more fully support new systems like item components going forward. To clarify, 2.12 still supports 1.19.4+. These changes will affect 2.13 and later.
In the same vein, Paper has recently completed its fork away from Spigot. We have aimed to maintain support for both versions so far, but we are running into issues where the API differences between Paper and Spigot are becoming too great. It is not feasible for us to develop two parallel versions of Skript, and as a result, we will be dropping support for Spigot starting with 2.13. We encourage the small portion of our users who are still using Spigot to upgrade to Paper if possible.
Major Changes
Ephemeral Variables
Ephemeral variables (or ram vars, or memory vars) are now fully implemented by default for all users. These are global variables that are not saved between restarts. To make a variable ephemeral, add a hyphen (-) to the start of its name: {-var}. These variables are about 2.5x faster to change compared to normal global variables. You do not need to do anything to enable them.
Function Overloading
Note
The script reflection experiment, which includes syntax for dynamically referencing and executing functions, does not yet support working with overloaded functions.
Function overloading enables creating functions that have the same name but different parameters types/parameter counts.
function send_welcome(p: player):
send_welcome({_p}, false)
function send_welcome(p: player, first_time: boolean):
if {_first_time} is true:
send "Welcome to our server for the first time, %name of {_p}%!" to {_p}
else:
send "Welcome back to our server, %name of {_p}%!" to {_p}
Local Variable Type Hints (Experimental)
Note
This feature is currently experimental and can be used by enabling the type hints experiment.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching (Experimental)
Note
This feature is currently experimental and can be used by enabling the error catching experiment.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources (Experimental)
Note
This feature is currently experimental and can be used by enabling the damage sources experiment.
Caution
Note that type has been removed as an option for the 'damage cause' expression as damage cause and damage type now refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Contributing Updates
We are now allowing contributors to release their code contributions under the more-permissive MIT License. For more information, please review our LICENSING.md file.
⚠ Breaking Changes
- When using
index of "a" in "b", values that do not appear in the second string will now returnnoneinstead of the previous-1. - The
is enchanted withcondition now looks for exact levels instead of the specified level or better. Old behavior can be replicated withif {_item} is enchanted with sharpness 2 or better. Some examples:
if {_item} is enchanted with sharpness 2 # only passes for sharpness 2. Previous behavior allowed sharpness of 2 or greater to pass.
if {_item} is enchanted with sharpness 2 or better # sharpness 2+
if {_item} is enchanted with sharpness 2 or worse # sharpness 2 or 1
if {_item} is enchanted with sharpness # sharpness of any level- An infinite timespan literal was added, meaning Timespan math operations can now result in an infinite timespan value (just like numbers).
- The parsing behavior of the 'amount' expression has changed. Given an expression like
amount of {a::*}, "b", it was before parsed as(amount of {a::*}), "b", but it is now parsed asamount of ({a::*}, "b"). Use parentheses as necessary to clarify your intent. - For the old 'beacon values' expression,
beaconis now a required keyword for therangeandtierexpressions. - The
remove allchanger for the 'custom model data' expression has been removed. It functioned the same asremove. headhas been removed as an option for the 'player skull' expression ashead of playerconflicts with the 'head location' expression.typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.- The 'load world' effect now requires
world. - The API method
RegistryParser#getAllNameshas been removed in favor ofRegistryParser#getCombinedPatterns(from thePatternedParserinterface). - API methods for the
sincedocumentation field have changed on SkriptEventInfo:SkriptEventInfo#getSince() (String) -> SkriptEventInfo#getSince() (String[])BukkitSyntaxInfos.Event.since() (String) -> BukkitSyntaxInfos.Event.since() (Collection<String>)BukkitSyntaxInfos.Event.Builder.since(String) -> BukkitSyntaxInfos.Event.Builder.addSince(String)
- (API) Syntax ordering is no longer based on registration order when a priority is shared. This may expose syntax conflicts if this behavior was depended on.
Changelog
Pre-Release 2 Changes
- #7943 Fixes numerous issues with the 'gamerule value' expression.
- #7992 Fixes an issue where some examples diplayed incorrectly on the documentation site.
- #7993 Adds
SyntaxInfobuilder methods to the "property" type syntax classes, in favor of the existingregistermethods. - #7996 Fixes an error that would occur when using experimental syntax in effect commands.
- #7997 Fixes an issue where the 'indices of value' expression failed to respect the c...
Pre-Release 2.12.0-pre1
Skript 2.12.0-pre1
Today, we are excited to celebrate the beginning of the second half of the year with a new Skript pre-release! Skript 2.12.0-pre1 is now available! This release includes dozens of new features and bug fixes, along with early support for 1.21.6/7.
Below, you can familiarize yourself with the changes. Additionally, by clicking here, you can view the list of new syntax on our documentation site. As always, report any issues to our issues page!
Per our release model, we plan to release 2.12.0 on July 15th. We may release additional pre-releases before then should the need arise.
We would also like to welcome a new addition to the team, @Absolutionism!
Happy Skripting!
Major Changes
Ephemeral Variables
Ephemeral variables (or ram vars, or memory vars) are now fully implemented by default for all users. These are global variables that are not saved between restarts. To make a variable ephemeral, add a hyphen (-) to the start of its name: {-var}. These variables are about 2.5x faster to change compared to normal global variables. You do not need to do anything to enable them.
Function Overloading
Note
The script reflection experiment, which includes syntax for dynamically referencing and executing functions, does not yet support working with overloaded functions.
Function overloading enables creating functions that have the same name but different parameters types/parameter counts.
function send_welcome(p: player):
send_welcome({_p}, false)
function send_welcome(p: player, first_time: boolean):
if {_first_time} is true:
send "Welcome to our server for the first time, %name of {_p}%!" to {_p}
else:
send "Welcome back to our server, %name of {_p}%!" to {_p}
Local Variable Type Hints (Experimental)
Note
This feature is currently experimental and can be used by enabling the type hints experiment.
Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variablePreviously, the code above would parse without issue. However, Skript now understands that when it is used, {_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
Please note that this feature is currently only supported by simple local variables. A simple local variable is one whose name does not contain any expressions:
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching (Experimental)
Note
This feature is currently experimental and can be used by enabling the error catching experiment.
A new catch [run[ ]time] error[s] section allows you to catch and suppress runtime errors within it and access them later with [the] last caught [run[ ]time] errors.
catch runtime errors:
...
set worldborder center of {_border} to {_my unsafe location}
...
if last caught runtime errors contains "Your location can't have a NaN value as one of its components":
set worldborder center of {_border} to location(0, 0, 0)Damage Sources (Experimental)
Note
This feature is currently experimental and can be used by enabling the damage sources experiment.
Caution
Note that type has been removed as an option for the 'damage cause' expression as damage cause and damage type now refer to different things.
Damage sources are a more advanced and detailed version of damage causes. Damage sources include information such as the type of damage, the location where the damage originated from, the entity that directly caused the damage, and more.
Below is an example of what damaging using custom damage sources looks like:
damage all players by 5 using a custom damage source:
set the damage type to magic
set the causing entity to {_player}
set the direct entity to {_arrow}
set the damage location to location(0, 0, 10)For more details about the syntax, visit damage source on our documentation website.
Contributing Updates
We are now allowing contributors to release their code contributions under the more-permissive MIT License. For more information, please review our LICENSING.md file.
⚠ Breaking Changes
- When using
index of "a" in "b", values that do not appear in the second string will now returnnoneinstead of the previous-1. - The
is enchanted withcondition now looks for exact levels instead of the specified level or better. Old behavior can be replicated withif {_item} is enchanted with sharpness 2 or better. Some examples:
if {_item} is enchanted with sharpness 2 # only passes for sharpness 2. Previous behavior allowed sharpness of 2 or greater to pass.
if {_item} is enchanted with sharpness 2 or better # sharpness 2+
if {_item} is enchanted with sharpness 2 or worse # sharpness 2 or 1
if {_item} is enchanted with sharpness # sharpness of any level- An infinite timespan literal was added, meaning Timespan math operations can now result in an infinite timespan value (just like numbers).
- The parsing behavior of the 'amount' expression has changed. Given an expression like
amount of {a::*}, "b", it was before parsed as(amount of {a::*}), "b", but it is now parsed asamount of ({a::*}, "b"). Use parentheses as necessary to clarify your intent. - For the old 'beacon values' expression,
beaconis now a required keyword for therangeandtierexpressions. - The
remove allchanger for the 'custom model data' expression has been removed. It functioned the same asremove. headhas been removed as an option for the 'player skull' expression ashead of playerconflicts with the 'head location' expression.typehas been removed as an option for the 'damage cause' expression asdamage causeanddamage typenow refer to different things.- The 'load world' effect now requires
world. - The API method
RegistryParser#getAllNameshas been removed in favor ofRegistryParser#getCombinedPatterns(from thePatternedParserinterface). - API methods for the
sincedocumentation field have changed on SkriptEventInfo:SkriptEventInfo#getSince() (String) -> SkriptEventInfo#getSince() (String[])BukkitSyntaxInfos.Event.since() (String) -> BukkitSyntaxInfos.Event.since() (Collection<String>)BukkitSyntaxInfos.Event.Builder.since(String) -> BukkitSyntaxInfos.Event.Builder.addSince(String)
- (API) Syntax ordering is no longer based on registration order when a priority is shared. This may expose syntax conflicts if this behavior was depended on.
Changelog
Additions
- #4154 Adds support for boolean values to the 'toggle' effect and an 'inverse boolean' expression to obtain the inverse of a boolean (at long last).
- #6902 Adds a 'buried item' expression and a 'dusted stage' expression for working with brushable blocks.
- #7495 Adds ephemeral variables (starting with
-) which are cleared when the server restarts. - #7561 Adds an 'except' expression which provides a simple way to filter values from a list.
- #7658 Adds an 'On-screen kick message' expression to get and change the on-screen message that appears when a user is kicked, usable in the kick event.
- #7685 Adds support for the Catalan language (thanks to @TwistedWar3713, @Lukarius11, and @ItzDuck364 for their language insights).
- #7707 Adds support for the 'item cooldown' syntax to respect cooldown groups (cooldown components) defined on items.
- #7738 Adds an 'exact item' expression that acts like creative-mode middle-click, copying the block's data exactly.
- #7745 Add...
Patch Release 2.11.2
Skript 2.11.2
As we prepare for Skript 2.12 in July, Skript 2.11.2 is here to resolve some additional bugs.
As always, you can report any issues on our issue tracker.
Skript 2.11.2 supports Spigot or Paper servers on versions 1.19.4 to 1.21.4, with tentative support for 1.21.5.
Happy Skripting!
Changelog
Bug Fixes
- #7845 Fixes types marked as
ainstead ofanin the default language file. - #7850 Fixes an issue where LiteralUtils#hasUnparsedLiteral() would not check recursively and therefore could miss some UnparsedLiterals.
- #7886 Fixes an exception/crash that could occur when using blockdata in a click event.
- #7889 Fixes an issue where the 'stop trigger' effect used the incorrect ExecutionIntent.
- #7890 Fixes an issue where the 'no damage ticks' expression printed an improper (non-suppressable) deprecation warning.
- #7895 Fixes the
playerevent value not working in a 'flight toggle' event. - #7907 Fixes an issue with the 'arithmetic' expression that could result in valid operations failing or exceptions.
API Changes
- #7826 Cleans up tests and removes outdated checks for unsupported versions.
- #7883 Adds safe arithmetic methods for Timespans.
Click here to view the full list of commits made since 2.11.1
Notices
Experimental Features
Experimental features can be used to enable syntax and other behavior on a per-script basis. Some of these features are new proposals that we are testing while others may have unsafe or complex elements that regular users may not need.
While we have tested the available experiments to the best of our ability, they are they are still in development. As a result, they are subject to change and may contain bugs. Experiments should be used at your own discretion.
Additionally, example scripts demonstrating usage of the available experiments can be found here.
Click to reveal the experiments available in this release
For-Each Loop
Enable by adding using for loops to your script.
A new kind of loop syntax that stores the loop index and value in variables for convenience.
This can be used to avoid confusion when nesting multiple loops inside each other.
for {_index}, {_value} in {my list::*}:
broadcast "%{_index}%: %{_value}%"
for each {_player} in all players:
send "Hello %{_player}%!" to {_player}
All existing loop features are also available in this section.
Queue
Enable by adding using queues to your script.
A collection that removes elements whenever they are requested.
This is useful for processing tasks or keeping track of things that need to happen only once.
set {queue} to a new queue of "hello" and "world"
broadcast the first element of {queue}
# "hello" is now removed
broadcast the first element of {queue}
# "world" is now removed
# queue is empty
set {queue} to a new queue of all players
set {player 1} to a random element out of {queue}
set {player 2} to a random element out of {queue}
# players 1 and 2 are guaranteed to be distinct
Queues can be looped over like a regular list.
Script Reflection
Enable by adding using script reflection to your script.
This feature includes:
- The ability to reference a script in code.
- Finding and running functions by name.
- Reading configuration files and values.
Help Us Test
We have an official Discord community for beta testing Skript's new features and releases.
Thank You
Special thanks to the contributors whose work was included in this version:
As always, if you encounter any issues or have some minor suggestions, please report them at https://github.com/SkriptLang/Skript/issues.
If you have any bigger ideas or input for the future of Skript, you can share those too at https://github.com/SkriptLang/Skript/discussions.