
skLambda
Skript addon that adds lambda functions and listeners to Skript.
Оцените первым
81
3
Список изменений
skLambda 1.3.0
Supports: Paper 1.21.1+ · Skript 2.15+
This release is about async. A lambda can run off the main thread, a trigger can wait for something without freezing the server, and a new watcher polls values and conditions for you so you don't have to write a loop.
New sections
- Wait for a future:
wait for %future% [within %timespan%]:suspends the trigger until the future resolves, then runs the body, whereresult of %future%is ready to read. The server keeps ticking while it waits, it doesn't block. Usewait for all of %futures%to join several (when-all) orwait for any of %futures%for the first to finish. An optionalon timeout:block runs instead if the time runs out, and locals from either branch carry on to the code after the block. - Wait for the next event:
wait for next <event> [where <condition>] [within %timespan%]:pauses a trigger until that event fires, with the event's values in scope in the body (somessageworks forchat). Filter with a trailingwhere, cap the wait withwithin, and handle the no-show withon timeout:. The event has already dispatched by the time the body runs, so you can't cancel or change it there. - Watch a value:
watch %value% every %timespan%:re-reads the expression on a timer and runson change:only when it differs from last time, withold valueandnew valuein scope. Passwithin %timespan%for anon timeout:, addon end:for teardown, and tie it to anowner:so it stops itself when the owner goes away. It's a normal listener, sopause,resume,unregisterand/sklambda listenersall work on it. - Watch a condition:
watch when <condition> every %timespan%:is edge-triggered.on rising:fires the moment the condition goes false to true,on falling:fires on true to false. The state at the first poll is the baseline, so a condition that's already true won't fireon risinguntil it goes false and back. This is "do X the first time Y becomes true" without a poll loop.
New expressions
- Future of a lambda:
future of calling lambda %lambda% [with %objects%]starts the lambda on a background thread right away and hands you a future for its result. The body must be pure computation or I/O with no Bukkit API (no blocks, entities, inventories, or players), since touching the server off-thread will throw. Arguments are read on the main thread before it starts. - New future:
a new futureis an empty promise you resolve yourself later withcomplete. Good for bridging a callback or another thread back into a waiting trigger. - Future result:
result of %future%is the resolved value, or nothing for a future that isn't done yet or that failed. Read it after await for, when the future is guaranteed resolved. - Old and new value:
old valueandnew valuehold the previous and current readings inside a watcher'son change:block.
New condition
- Future state:
%future% is done(alsoresolvedorcompleted),%future% is pending, and%future% has failed, each with a negated form. Check a future before reading its result, or branch on whether a background job blew up.
New effect
- Complete a future:
complete %future% with %object%resolves one or more futures with a value and wakes any trigger waiting on them.complete %future%with no value resolves it with nothing. A future that's already resolved is left alone.
Файлы
skLambda-1.3.0.jar(220.40 KiB)
ОсновнойМетаданные
Канал релиза
Release
Номер версии
1.3.0
Загрузчики
PaperPurpur
Версии игры
1.21–26.1.2
Загрузок
27
Дата публикации
15.06.2026
