github SkriptLang/Skript 2.16.0-pre1
Pre-Release 2.16.0-pre1

pre-release2 hours ago

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 player

Text 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 player

You 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 structuretype to treetype.

Changelog

Additions

Changes

  • #8579 Adds additional aliases to the 'send block change' effect.
  • #8640 Overhauls Skript's existing tree type support, including a rename from structuretype to treetype.
  • #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

API Changes

  • #8557 Adds SectionUtils#loadDelayableLinkedCode, an alternative to SectionUtils#loadLinkedCode that permits the use of delays within the linked code.
  • #8677 Deprecates the registerComparator options of EnumClassInfo and RegistryClassInfo. This functionality was required due to a previous bug which has since been resolved.
  • #8677 Adds support to EnumClassInfo and RegistryClassInfo for 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 EffTeleport and removes dependency on PaperLib.
  • #8729 Adds a constructor (SimpleEvent(String)) for creating SimpleEvents with a custom toString value.

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.

Click to reveal the experiments available in this release

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 variable

Previously, 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 hints

Runtime 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)

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 equipment

For more details about the syntax, visit equippable component on our documentation website.

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.

Don't miss a new Skript release

NewReleases is sending notifications on new releases.