Skip to content

Instantly share code, notes, and snippets.

@Pikachu920
Last active March 13, 2023 15:08
Show Gist options
  • Save Pikachu920/4d2dba06cf8cf753121d182f2ca821fb to your computer and use it in GitHub Desktop.
Save Pikachu920/4d2dba06cf8cf753121d182f2ca821fb to your computer and use it in GitHub Desktop.

Additions / Improvements

+ [max[imum]] age of %blocks/entities%
+ %blocks/entities%'s [max[imum]] age
+ %entities% (isn't|is not|aren't|are not) frozen
+ %entities% (is|are) frozen

+ freeze time of %entities%
+ %entities%'[s] freeze time

+ max[imum] freeze time of %entities%
+ %entities%'[s] max[imum] freeze time
  • Random vector now has negative values. (closes SkriptLang/Skript#3135)
  • Added support for checking the attacker entity type in the event syntax damag(e|ing) [of %entitydata%] [by %entitydata%] (Thanks @Ankoki)
  • Added pathfinding for Mobs. This is a PaperSpigot exclusive effect. (closes SkriptLang/Skript#2334)
+ make %livingentities% (pathfind|move) to[wards] %livingentity/location% [at speed %-number%]
+ make %livingentities% stop (pathfinding|moving)
+ [(all [[of] the]|the)] [loaded] plugins
+ [(safe:(safe|valid)|(unsafe|invalid))] bed[s] [location[s]] of %offlineplayers%
+ %offlineplayers%'[s] [(safe:(safe|valid)|(unsafe|invalid))] bed[s] [location[s]]
  • Added [on] anvil prepar(e|ing) for when an item is put in a slot for repair by an anvil. Event values are: event-inventory and event-itemstack. (closes SkriptLang/Skript#4456)
  • Added [on] anvil damag(e|ing) for when an anvil is damaged from repair use. Event values are: event-inventory. (closes SkriptLang/Skript#4456)
  • Added an expression to get all possible colours (closes SkriptLang/Skript#1177)
+ ([all [[of] the]] colo[u]rs|(the|every) colo[u]r)
  • Added future and past event-value options for the location in the entity move event for Paper. (closes SkriptLang/Skript#4890)
  • Added a new config.sk option long parse time warning threshold that will print an error message if a line is taking too long to parse. The default option for this will be 0 seconds, which means it will be disabled. Change this setting yourself if you would like to enable this feature. It takes a timespan, so examples like 5 seconds, 5 minutes and 10 seconds and 500 ticks will work for this option. (closes SkriptLang/Skript#4759)
  • Added raw string of a string. This means that the expression will not colour format and also not remove the colour symbols such as "&6&lExample" will be how the value is returned without the quotes. (closes SkriptLang/Skript#4102 thanks @UnderscoreTud)
+ raw %strings%
  • Added support for setting the collar colour of a tamed wolf/dog when spawning. (closes SkriptLang/Skript#1760)
+ (<age> dog(|1¦s)|tamed <age> wol(f|1¦ves)|(4¦)pupp(y|1¦ies)) [[with collar] colo[u]r[ed] %-color%]

#example:
spawn a dog with collar colour lime at player
  • Added potion tier expression (Thanks @Ankoki)
+ [the] [potion] (tier|amplifier|level) of %potioneffecttypes% (of|for|on) %livingentities%
  • Added egg throwing event and it's related syntaxes
Conditions
+ [the] egg (:will|will not|won't)

Events
+ [on] throw[ing] [of] [an] egg
+ [on] [player] egg throw
Event value expression:
+ [the] [thrown] egg
+ [the] hatching number (byte, all changers)
+ [the] hatching entity [type] (entitydata, settable and reset)

Effects
+ make [the] egg [:not] hatch
  • Added player trade event, currently this event is villagers. [on] player trad(e|ing) the event values are event-entity and event-player the entity being a villager. (thanks @AbeTGT)
  • Added last launched firework to ExprLastSpawnedEntity (closes #4942)
  • Added environment of world property expression. (closes SkriptLang/Skript#3673 thanks @UnderscoreTud)
+ [world] environment of %worlds%
+ %worlds%'[s] [world] environment

+ New type %environment%
  • Added condition for checking if living entities are gliding. (closes #5145 thanks @Ankoki)
+ %livingentities% (is|are) gliding
+ %livingentities% (isn't|is not|aren't|are not) gliding
  • Added invisibility state of livingentities, this is different from potions. (thanks @D4isDAVID)
#Condition
+ %livingentities% (is|are) (invisible|:visible)
+ %livingentities% (isn't|is not|aren't|are not) (invisible|:visible)

#Effect
+ make %livingentities% (invisible|not visible)
+ make %livingentities% (visible|not invisible)
  • Added entity jump event. (Requires PaperSpigot 1.15.2+) (thanks @AbeTGT)
+ [on] entity jump[ing]
  • Added fire ticks expression to get burning time of an entity. (thanks @UnderscoreTud)
# Timespan
+ (burn[ing]|fire) (time|duration) of %entities%
+ %entities%'[s] (burn[ing]|fire) (time|duration)
  • Added local functions. Local functions are functions that can only be accessed in the script it was declared in, meaning it won't reserve the signature globally. Local Functions are ALWAYS prioritized before Global Functions. Global Functions are defined without the [local] part of the syntax. (thanks @UnderscoreTud)
+ [local] function ...

Example:

function example(number: number = 0):
    return "can only be used if a local function is not defined with the same signature or if this function is called in another script."

local function example(number: number = 0)
    return "will be used in this script"

on script load:
    broadcast example() #will return "will be used in this script"
+ [the] nearest %*entitydatas% [[relative] to %entity/location%]
+ [the] %*entitydatas% nearest [to %entity/location%]
+ %locations% (is|are) within %number% (block|metre|meter)[s] (around|of) %locations%
+ %locations% (isn't|is not|aren't|are not) within %number% (block|metre|meter)[s] (around|of) %locations%
  • Added an expression to get all the banned players or ip address of those banned players. (thanks @UnderscoreTud)
+ [all [[of] the]|the] banned (players|ips:(ips|ip addresses))
  • Added a condition to check if a location is between two other locations that form a cuboid. (thanks @UnderscoreTud)
+ %locations% (is|are) within %location% and %location%
+ %locations% (isn't|is not|aren't|are not) within %location% and %location%
# Type
moon phases:
+ first quarter
+ full moon
+ last quarter
+ new moon
+ waning crescent
+ waning gibbous
+ waxing crescent
+ waxing gibbous

# Expression
+ (lunar|moon) phase[s] of %worlds%
+ %worlds%'[s] (lunar|moon) phase[s]
  • Added an expression to get and modify the amount of sea pickles in a block stack.
+ [:(min|max)[imum]] [sea] pickle(s| (count|amount) of %blocks%
+ %blocks%'[s] [:(min|max)[imum]] [sea] pickle(s| (count|amount)
  • Added support for getting the item type of a block data.
  • Made the event-item event value return the itemstack from the BlockPlaceEvent (on place). This allows event-item to maintain information like name, lore, and nbt instead of being the plain item type name that was placed. (Thanks @sovdeeth)
  • Added an expression to get the anvil input of an anvil inventory.
+ anvil [inventory] (rename|text) input of %inventories%
+ %inventories%'[s] anvil [inventory] (rename|text) input
  • Added the possiblity to set a block to a player skull WITH the owning player, for example set block at {_loc} to player's skull will set the block to the player's skull. (closes SkriptLang/Skript#1789)
  • Adds support for and/or condition sections, more details at SkriptLang/Skript#5152.
if:
  player's name is "Skript"
  player's tool is dirt
then:
  # This code will run if both conditions passed

if at least one of:
  player can fly
  player is op
then:
  # This code will run if at least one of the conditions passed
  • Added syntaxes to make entities look at a location, requires paper spigot. 1.19.1 can make players look at locations.
1.19.1+
+ (force|make) %livingentities% [to] (face [towards]|look [(at|towards)])
+ (%entity%['s (feet:feet|eyes)]|of:(feet:feet|eyes) of %entity%)
+ [at [head] [rotation] speed %-number%] [[and] max[imum] [head] pitch %-number%]

Other versions 1.17+
+ (force|make) %livingentities% [to] (face [towards]|look [(at|towards)]) %vector/location/entity%
+ [at [head] [rotation] speed %-number%] [[and] max[imum] [head] pitch %-number%]
  • Added support for setting the real max player count in 1.16+ (thanks @kiip1)
  • Added support for spectator events.
+ [player] stop spectating [(of|from) %-*entitydatas%]
+ [player] (swap|switch) spectating [(of|from) %-*entitydatas%]
+ [player] start spectating [of %-*entitydatas%]
  • Added time support for the spectator target if the events are these new spectator events.
Example switching from a spider to a creeper:
if the spectator target was a spider
if the future spectator target is a creeper
All %blocks% must be a respawn anchor.
The respawn location condition must be in the on respawn event only.

Expression
+ [:max[imum]] charge[s] of %blocks%
+ %blocks%'[s] [:max[imum]] charge[s]

Conditions
+ [the] respawn location (was|is)[1:(n'| no)t] [a] (:bed|respawn anchor)

+ respawn anchors [do[1:(n't| not)]] work in %worlds%
  • Added literal pi or the symbol for getting the mathematical constant. (closes SkriptLang/Skript#5288) (thanks @kiip1)
  • Added a command prefix option for your script commands. Example:
command /test:
    prefix: custom_prefix
    trigger:
        wait 1 tick

image

  • Added support for worlds in the name of expression. (thanks @DelayedGaming)
  • Added isValid condition, which checks whether the entities are dead or have been despawned for some other reason than dying.
%entities% (is|are) valid
%entities% (isn't|is not|aren't|are not) valid
  • Added a way to get the source block in BlockSpreadEvent source block expression used in the on spread event (closes SkriptLang/Skript#5346) (thanks @GodModed)
  • Added support for loot generate event, and [the] loot which returns a list of the items, can be modified with changers.
# Events
+ [on] loot generat(e|ing)
+ event-location
+ event-entity

# Expression
+ [the] loot
  • Added support for getting and changing the amount of sea pickles a sea pickle block stack has.
+ [:(min|max)[imum]] [sea] pickle(s| (count|amount)) of %blocks%
+ %blocks%'[s] [:(min|max)[imum]] [sea] pickle(s| (count|amount))
+ unequip %itemtypes% [from %livingentities%]
+ unequip %livingentities%'[s] (armor|equipment)
  • Added support for copy to clipboard text component 1.15+ (closes SkriptLang/Skript#5351) The following example will copy "text to copy" to the player's clipboard when clicked.
send "<copy:text to copy>click me to copy text to your clipboard"
  • Added a condition to check whether a tool is a preferred tool for a given block or blocks. Meaning it will allow the block to drop it's items like how a diamond pickaxe is required for obsidian to drop. Requires 1.16.5+ and Paper 1.19.2 for blockdatas (thanks @sovdeeth)
#Conditions
%itemtypes% (is|are) %blocks/blockdatas%'s preferred tool[s]
%itemtypes% (is|are) [the|a] preferred tool[s] (for|of) %blocks/blockdatas%
%itemtypes% (is|are)(n't| not) %blocks/blockdatas%'s preferred tool[s]
%itemtypes% (is|are)(n't| not) [the|a] preferred tool[s] (for|of) %blocks/blockdatas%
+ %itemstacks% (is|are) stackable
+ %itemstacks% (isn't|is not|aren't|are not) stackable
  • Re-enabled player's view distance expression for MC 1.14+ which was disabled due to not supported on MC 1.14+ (note that this may not return player's view distance in some versions mostly 1.14-1.16.x instead it will return server's view distance in system.properties) (Thanks @ShaneBeee)
  • Added support for all enchantments, all potion effects and all other classinfos [(all [[of] the]|the|every)] %*classinfo% (closes #5082, #5235) (Thanks @UnderscoreTud)
  • Added an expression to get block break speed for Minecraft 1.17+ (Thanks @sovdeeth)
+ [the] break speed[s] [of %blocks%] [for %players%]
+ %block%'[s] break speed[s] [for %players%]
  • Added support for stopping all sounds (Requires Minecraft 1.17.1+) (Thanks @kiip1)
+ stop (all sound[s]|sound[s] %strings%) [(in|from) %-soundcategory%] [(from playing to|for) %players%]
  • Added an expression to get a type value within a list of objects.
+ [the] (%-*classinfo%|value[:s]) (within|in) %~objects%

Examples:
set {_entity} to a random entity out of all entities
delete entity within {_entity} # This deletes the entity itself and not the value stored in the variable

set {_list::*} to "something", 10, "test" and a zombie
broadcast the strings within {_list::*} # "something", "test
  • Added an effect to simulate a knockback velocity (thanks @sovdeeth)
+ (apply knockback to|knock[back]) %livingentities% [%direction%] [with (strength|force) %-number%]
  • Added support for rounding by decimal within the round() default function. (closes SkriptLang/Skript#3579)
    Untitled
  • Added inventory slot change event [player] inventory slot chang(e|ing) (thanks @sovdeeth) Warning: setting the event-slot to a new item can result in an infinite loop.
  • Added paper 1.16+ event [player] deep sleep[ing] which is called when a player has slept long enough to count as passing the night/storm. (thanks @DelayedGaming)
  • Added chunk enter event player (enter[s] [a] chunk|chunk enter[ing]), has event-chunk with time states. (closes SkriptLang/Skript#5441) (thanks @DelayedGaming)
  • Added the PlayerExpChangeEvent event. (thanks @GodModed)
# events
+ [player] (level progress|[e]xp|experience) (change|update|:increase|:decrease)
  • Added the ability to change Skript prefix from .lang files (it was actually in the lang files but not used within the code) (Thanks @Fusezion)
  • Added translatable message components into the Skript text system. (closes SkriptLang/Skript#4875) (thanks @UnderscoreTud)

Untitled

Fixes

  • Various optimizations.
  • Optimized expression list parsing, it won't crash the server for super duper long lines now.
  • Drastically improved parsing speed on expression lists. This now avoids the usage of placing every element in braces.
  • Fixed an issue where functions would report double errors (closes SkriptLang/Skript#4771)
  • Fixed a bug causing 1.13 to not load properly relating to poitions (closes SkriptLang/Skript#4897)
  • Fixed a bug when attempting to parse an empty player.
  • Fixed a bug where the return type of a function was making an error in some cases (closes SkriptLang/Skript#4524)
  • Fixed an issue where no warnings would show when passing plurals in singular parameters for functions (closes SkriptLang/Skript#4859)
  • Fixed a bug with variables in the time format syntax (closes SkriptLang/Skript#4664)
  • Fixed a bug where the past/present state of the location event value in the player move event wouldn't work (closes SkriptLang/Skript#4890)
  • Fixed a bug that would happen when teleporting an entity to a location without a world.
  • Fixed on silverfish enter and on silverfish exit to actually work now.
  • Fixed multiple entities not being allowed in the equip effect (closes SkriptLang/Skript#5083 thanks @UnderscoreTud)
  • Fixed a bug where single quotes would throw an error (closes #5149)
  • Fixed a bug when combining ExprParse with ExprElement (e.g. first element of ((uncolored name of {_i}) parsed as "text%string%"), this results in an ArrayStoreException, since ExprElement creates an array based on the expression's return type. (closes SkriptLang/Skript#5262)
  • Fixed rounding accuracy (closes SkriptLang/Skript#4235)
  • Fixed an issue where some event expressions didn't work for their correct test classes. See SkriptLang/Skript#5372
  • Fixed an issue where literal lists were not being random in ExprRandom, as they were determined at parse time. Mainly aliases. Example: Having a function return a random item out of a list of items would always return the same item. (closes SkriptLang/Skript#5345)
  • Fixed an issue where the elements of the arrays returned from some expressions were not a new array reference causing modification of it in other expressions. (closes SkriptLang/Skript#5322)
  • Fixed uncolored expression not stripping nested colors such as &&aa which would become &a before this fix (thanks @kiip1)
  • Fixed an issue where not all the expressions in an expression list were taken into consideration when negating.
  • Fixed NPE caused by ExprSets [(all [[of] the]|the|every)] %*classinfo% (closes #5065) (Thanks @UnderscoreTud)
  • Fixed default variables not working at all (closes SkriptLang/Skript#2174 and SkriptLang/Skript#4567)

Removal/Changes

  • Removed WorldGuard 6 support as this version supports 1.13+ now. WorldGuard 7 is supported.
  • Removed weather condition use comparator now, examples below:
- is %weathertypes% [in %worlds%]
if world is rainy
if event-world is sunny
  • Changed ExprSpawn to use the actual location provided to the set changer, rather than forcing the location to be the block location. (closes #4955)
  • Skript will now unregister events that are no longer used by an event trigger. This check happens when unloading a script.
  • Changed the order of actual script file loading. Skript will now prioritize the directories in the /scripts folder over files that aren't in directories. This change is to help those that want to organize their scripts easier and better. Below is an image of how it works now. (closes SkriptLang/Skript#466)

Changes

  • Changed how operator checking is performed. It's now a condition instead of an EntityData. Due to this, non(-| |)op(|1¦s) is no longer a valid entity data. So the following will not be possible anymore if player is a non-op and if player is not a non-op this is poorly worded, and the new condition should be used. Reminder that %players% are offline players, so online players work with this syntax.
+ %offlineplayers% (is|are) [[a] server|an] op[erator][s]
+ %offlineplayers% (isn't|is not|aren't|are not) [[a] server|an] op[erator][s]
  • It seems like in 1.19.2 Mojang has brought back the infamous "ghost item" bug caused by desync from the server when cancelling an inventory click event while someone else modifies the inventory. So due to this, we've forced the server to update the client's inventory when an inventory click event is cancelled. This ensures this doesn't happen. It's purely client side, and the player doesn't actually have the item. If this conflicts with any of your plugins, please make an issue report. It shouldn't for the most part.
  • The on spread event-block value returned the same value for all time states. You can now use previous event-block or event-block was ... to get the previous block state of the newly changed block. Example: if the spread was a mycelium block; the previous state would be dirt or any block it can spread to and the present/future state will be the new mycelium it's changing into. (Pull request info at SkriptLang/Skript#5343)
  • Changed material classinfo to now reflect itemtype rather than item. item = ItemStack material = ItemType. Shouldn't break much compatibility as converters should handle it.
  • Changed how the within condition works. %entity% is in [[the] world] %world% ->%locations% (is|are) (within|in[side [of]]) %world% read more at SkriptLang/Skript#5371
@CerialPvP
Copy link

In my opinion, best Skript update ever (not only did my suggestion become a thing, other things people wanted became a thing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment