Skript 2.16.0-pre1
Supports: Paper 1.21.4 - 26.1.2
Today, we're excited to be releasing the first pre-release of Skript 2.16! This release, while a bit smaller, includes a handful of new features to work with as we continue to lay the groundwork for even more exciting features later this year.
In accordance with supporting the last 18 months of Minecraft updates, Skript 2.16.0 supports Minecraft 1.21.4 to 26.1.2. Newer versions may also work but were not tested at time of release. 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.16.0 on July 15th. We may release additional pre-releases before then should the need arise.
Happy Skripting!
Release Highlights
Boss Bars
At last, support has been added for creating and interacting with boss bars. There is full support for a bar's title, progress, color, and more:
on join:
set {_bar} to a white boss bar titled "<green>Welcome %player%!":
set the progress of event-boss bar to 50%
set the style of event-boss bar to 6 notches
make event-boss bar darken the sky
add the player to the viewers of {_bar}
wait 5 seconds
remove the player from the viewers of {_bar}It is also possible to create keyed bars that persist through restarts and are available in the /bossbar command:
command /create-ad <text> <color> <text>:
trigger:
set {_ad} to a keyed boss bar with id arg 1
set the color of {_ad} to arg 2
set the title of {_ad} to arg 3
every 30 seconds:
# hide any other ads
remove all players from the viewers of all keyed boss bars
# show an ad
set {_bar} to a random boss bar out of all keyed boss bars
add all players to the viewers of {_bar}The ability to interact with the boss bar of actual bosses is available too:
on spawn of wither:
set the title of the boss bar of the event-entity to "<red>Angry Wither"Stored Enchantments
A 'stored enchantments' expression has been added for working with enchanted books. This enables the creation of enchanted books that can be applied onto items.
Here's an example for creating a book to apply to a sword:
command /godbook:
trigger:
set {_item} to minecraft:enchanted_book
add mending to stored enchants of {_item} # adds mending 1
add knockback 12 to stored enchants of {_item}
add fire aspect 3 to stored enchants of {_item}
give {_item} to playerText Component Resolution
A 'resolved component' expression has been added which provides support for using certain MiniMessage tags such as selector, score, and nbt.
Consider this example:
send formatted "My name is <selector:@s>!"The component must be resolved with a player so that the @s selector can be identified. Simply using the syntax:
send formatted "My name is <selector:@s>!" resolved for playerYou can get an actual input, such as My name is Njol!
Wait Section
The 'wait' effect can used as a section to delay the code within it. The code after the section will continue to run as normal, without a delay.
Consider this example:
broadcast "A"
wait 1 second:
broadcast "B"
broadcast "C"Running this would result in A and then C being broadcast, followed by B after 1 second.
⚠ Breaking Changes
- Skript's support for tree types has been significantly overhauled internally. Functionality within scripts should generally rename the same, though some names have changed.
- Note for Addon Developers: the syntax usage name has changed from
structuretypetotreetype.
- Note for Addon Developers: the syntax usage name has changed from
Changelog
Additions
- #8413 Adds support for all entities (not just living entities) to the leash syntaxes.
- #8500 Adds a 'skull texture' expression for obtaining and modifying the texture of a player head.
- #8501 Adds a 'pathfind' event, 'pathfinding target entity' expression, and 'pathfinding target location' expression.
- #8540 Adds an 'entity' function for obtaining an entity from its UUID.
- #8547 Adds support for using the 'wait' effect as a section.
- #8587 Adds a 'replace' expression for performing string replacements in line.
- #8600 Adds a 'player list priority' expression for ordering players in the player (tab) list.
- #8620 Adds support for writing
uuids(plural) in the 'UUID' expression. - #8630 Adds support for managing potion effects of area effect clouds and arrows (in entity form/in flight).
- #8668 Adds support for obtaining the minimum/maximum enchantment level of an enchantment, the stored enchantments of an item (e.g., enchanted book), and the enchantment hint that was shown to the player.
- #8673 Adds support for boss bars (see the dedicated section above).
- #8688 Adds support for getting multiple random elements, with or without repetition, from lists using the 'elements' expression.
- #8698 Adds a 'resolved component' expression for resolving certain parts of text components, such as selectors.
- #8708 Adds support for obtaining the location of an offline player.
- #8714 Adds an optional 'player' keyword to the 'gamemode change' event.
Changes
- #8579 Adds additional aliases to the 'send block change' effect.
- #8640 Overhauls Skript's existing tree type support, including a rename from
structuretypetotreetype. - #8659 Makes internal improvements to world border syntaxes.
- #8712 Deprecates the
[player]and[message]placeholders in the 'chat format' expression in favor of the existing 'player' and 'chat message' expressions.
Bug Fixes
- #8630 Fixes an issue where using
remove allwith the 'potion effects of entity/item' expression did not correctly consider active/hidden effects.
API Changes
- #8557 Adds
SectionUtils#loadDelayableLinkedCode, an alternative toSectionUtils#loadLinkedCodethat permits the use of delays within the linked code. - #8677 Deprecates the
registerComparatoroptions ofEnumClassInfoandRegistryClassInfo. This functionality was required due to a previous bug which has since been resolved. - #8677 Adds support to
EnumClassInfoandRegistryClassInfofor providing a callback consumer to be invoked on a successful parse. This is available through new constructors. - #8709 Adds methods (
SyntaxInfo#simple) for creating syntax infos from a class and patterns, without having to use a builder. - #8728 Cleans up internals of
EffTeleportand removes dependency on PaperLib. - #8729 Adds a constructor (
SimpleEvent(String)) for creating SimpleEvents with a customtoStringvalue.
Click here to view the full list of commits made since 2.15.4
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.
Enable by adding 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.
Queues can be looped over like a regular list.
Enable by adding This feature includes:
Enable by adding Local variable type hints enable Skript to understand what kind of values your local variables will hold at parse time. Consider the following example:
Previously, the code above would parse without issue. However, Skript now understands that when it is used, 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:
Enable by adding A new Enable by adding 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:
Changes can be made directly on to the existing equippable component of an item whether using the item itself or the retrieved equippable component
For more details about the syntax, visit equippable component on our documentation website.
Click to reveal the experiments available in this release
Queue
using queues to your script.
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
Script Reflection
using script reflection to your script.
Local Variable Type Hints
using type hints to your script.
set {_a} to 5
set {_b} to "some string"
... do stuff ...
set {_c} to {_a} in lowercase # oops i used the wrong variable
{_a} could only be a number (and not a text). Thus, the code above would now error with a message about mismatched types.
{_var} # can use type hints
{_var::%player's name%} # can't use type hintsRuntime Error Catching
using error catching to your script.
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)Equippable Components
using equippable components to your script.
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}
set the equipment slot of {_item} to helmet slot
set {_component} to the equippable component of {_item}
allow {_component} to swap equipment
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:
- @ahmadmsaleem
- @AnOwlBe
- @APickledWalrus
- @bluelhf
- @MrScopes
- @novystar
- @ShaneBeee
- @Shroobz ⭐ First contribution! ⭐
- @sovdeeth
- @TheLimeGlass
- @tibisabau
- @UnderscoreTud
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.