skLambda by eult

skLambda is a Skript addon that adds lambda functions and listeners to Skript.

Events

0

Expressions

13

Effects

7

Conditions

2

Types

2

Sections

1

Structures

0

Total

27

1.1.1 1 day, 2 hours and 24 minutes ago


This addon is no longer maintained. As of 1.1.1, skLambda will not receive further updates. The source stays available, but there are no planned releases, fixes, or support going forward. Feel free to fork it.


skLambda 1.1.1
Supports: Paper 1.21.1+ · Skript 2.15+

Removed
  • Duplicate list expressions: %objects% filtered where %objects% passes, count of %objects% where %objects% passes, and first of %objects% where %objects% passes have been removed. Skript core already ships its own filtered, count, and first list operations, so these were redundant and only added overlap. The lambda forms ( filtered, count of … where, and the %lambda%-based expressions) still work as before.


Improvements
  • Listener internals cleaned up: listener tracking, owner cleanup, and the active-listener registry were pulled out of one large class into focused pieces. No behavior change, just easier to maintain.

View Update

1.1.0 1 day, 9 hours and 59 minutes ago

skLambda 1.1.0
Supports: Paper 1.21.1+ · Skript 2.15+

New expressions

  • Highest / Lowest By: highest of %objects% by %lambda% and lowest of %objects% by %lambda% give you back the one item with the biggest or smallest value. You write a small lambda that scores each item, and it hands you the winning item itself. Ties keep the first one; an empty list gives nothing. You can also say min or max.
  • Bound: %lambda% with %objects% bound fills in the first argument(s) ahead of time. An "add two numbers" lambda can become "add 5 to whatever you give me." Fill in every argument and you get a lambda that takes nothing and just returns the answer.
  • Negated: negated %lambda% (or negation of %lambda%) flips a yes/no check so it passes when the original would fail. Handy with filtered where and count of … where.
  • Active Listeners: all active listeners gives you every listener running right now (the same ones /sklambda listeners shows). listeners owned by %object% gives you just the ones tied to one owner. You can loop over them and shut them down.


New listener options
  • on register:: runs once, right when the listener starts up. It's the partner to on end:, so you can set things up and clean them up in one place.


Improvements
  • One-line lambdas can return a value: before, a one-line lambda could only check something or do something. Now it can also give back a value, lambda (a, b): return {_a} + {_b}, or even shorter, lambda (n): {_n} * 2.
  • Lambdas remember nearby variables: a lambda keeps a copy of the local variables ( {_x}) from where you wrote it, so it can still read them when it runs later. It's a snapshot from that moment, changing those variables afterward won't affect it, and changes inside won't leak out. If a parameter shares a name with one of them, the parameter wins.
  • Reduce with a starting value: %objects% reduced with %lambda% from %object% lets you set what the total starts at. An empty list just gives back the starting value, and the start can be a different type than the items (like joining a list of items into one piece of text).
  • More owner types: owner: used to really only work for players. Now an entity, chunk, or world can own a listener too. It cleans itself up automatically when the owner goes away, a player logging off, an entity dying or despawning, or a chunk/world unloading. (Teleporting between worlds no longer wrongly kills a player's listeners.)
  • Use lambdas from Java: developers can turn a Skript lambda straight into a normal Java function with asPredicate(), asFunction(), asBiFunction(), asConsumer(), and asSupplier().

View Update

1.0.0 4 days, 15 hours and 9 minutes ago

skLambda 1.0.0
Supports: Paper 1.21.1+ · Skript 2.15+

New expressions
List loops can now be written as one-line operations instead of Skript loop blocks. Each one runs a lambda or predicate over a list.

  • Mapped: %objects% mapped with %lambda% turns every element into something new.
  • Filtered: %objects% filtered where %predicate% passes keeps only the elements that pass.
  • Reduced: %objects% reduced with %lambda% folds the whole list down to a single value.
  • Sorted: %objects% sorted by %lambda% sorts the list using a key pulled from each element.
  • Count Where: count of %objects% where %predicate% passes counts how many elements pass.
  • First Where: first element of %objects% where %predicate% passes returns the first element that passes.
  • End Reason: end reason reports why a listener stopped, so you can branch on it. Comes with its own type.


New functions
  • Constant predicates: always() and never() are drop-in predicates. always() always passes and never() never passes.


New listener options
These go inside a listen section.
  • owner: ties a listener to an owner (for example a player). When the owner disconnects, the listener unregisters itself.
  • on end: a callback that always runs no matter how the listener stops (completion, timeout, cancel, unregister, or owner disconnect). One single cleanup path.
  • cooldown: %timespan% debounces rapid re-triggers. A debounced event does not run on trigger and does not count toward triggers:.
  • every %timespan%: a repeating timer callback that runs while the listener is active. It pauses and stops along with the listener.


New effect
  • Unregister owned listeners: unregister all listeners owned by %object% stops only the listeners tied to that owner, for scoped cleanup.


Update checker
  • Startup check: update-notifications now actually works (it used to be a reserved toggle that did nothing). On startup the plugin checks for newer releases and notifies op players when they join.


Improvements
  • /sklambda command: now has tab-completion, and /sklambda listeners shows owner info for each listener. The plugin link now points to Modrinth instead of GitHub.
  • Internal refactor: element registration was split into LambdaModule and ListenerModule, trimming the main SkLambda class by about 90 lines.
  • Examples: example.sk gained 5 new showcases ( 10 to 14) covering the features above.
  • Build: version bumped to 1.0.0.


Full Changelog: git... 1.0.0

View Update

Changelog 0.0.3-alpha 6 days, 4 hours and 42 minutes ago

Supports: Paper 1.21.1+ · Skript 2.15+

New expressions

  • Inline Lambda: write a lambda on one line: lambda (p: player): {_p} is op. The body is either a condition, which acts as a predicate returning true/ false, or an effect, which runs and returns nothing. Parameters become locals like {_p}.
  • Function Lambda: function lambda "name" wraps an existing Skript function in a lambda you can store, pass around, and call like any other lambda.
  • Call Lambda new forms: alongside call/ invoke lambda, you can now write calling lambda %lambda% [with ...] and the result of calling lambda %lambda% [with ...].

New condition
  • Predicate Passes: treat a lambda as a yes/no test: %lambdas% pass[es] [for %values%], also readable as matches or holds. With a list of lambdas, a quantifier decides how many must pass: all of, which is the default, any of, or none of. Negate with doesn't pass or a leading not. Works inside listen ... where, too.


New effects
  • Unregister All Listeners: unregister all listeners stops every active listener on the server, across all scripts.
  • Unregister Last Listener: unregister the last created listener stops the most recently created one that is still active. Neither fires on completion or on timeout.

New command
  • /sklambda: shows the version and GitHub link. /sklambda listeners lists every active listener, including where it was created, the event it watches, and how long it has been alive. Alias: /skl. Guarded by the sklambda.admin permission, defaulting to op.

Configuration
  • config.yml added. Toggle features with lambda and listener. A disabled feature registers no syntax at all. Both default to true.
  • Listener leak detector ( notifier): optional console warnings about listeners that stay registered longer than warn-after, repeated every warn-every, with a customizable message. Supported placeholders: {location}, {event}, {duration}. Off by default.
  • update-notifications toggle reserved for a future update check.


Improvements
  • Type hints: lambda and saved-listener variables now register a Skript type hint, so misuse is caught at parse time when a script opts into Skript's experimental using type hints.
  • Listener effects and conditions, including register, unregister, pause, resume, and the registered/paused/running checks, now take a %listener% instead of %object%, giving clearer errors.
  • remaining triggers and remaining countdown share a common base and now report 0 correctly once a listener has finished.
  • Website link now points to GitHub.

View Update

skLambda 7 days, 3 hours and 37 minutes ago




This addon is no longer maintained. As of 1.1.1, skLambda will not receive further updates. The source stays available, but there are no planned releases, fixes, or support going forward. Feel free to fork it.



skLambda


A Skript addon that adds two things:

  • Lambdas — small functions you can save in a variable and run later.
  • The listen section — a short way to make a temporary event listener with a timer, a hit count, and what to do at the end.



Example: same task, two ways
The task: tell the player to mine 10 stone in 30 seconds. Give a diamond if they finish. Say "too slow" if they don't.

Without skLambda
on break of stone:
if {challenge::%player%} is not set:
stop
add 1 to {challenge::progress::%player%}
send "keep going..." to player
if {challenge::progress::%player%} >= 10:
send "you did it!" to player
give 1 diamond to player
delete {challenge::%player%}
delete {challenge::progress::%player%}

command /challenge:
trigger:
set {challenge::%player%} to true
set {challenge::progress::%player%} to 0
send "mine 10 stone in 30s" to player
wait 30 seconds
if {challenge::%player%} is set:
send "too slow" to player
delete {challenge::%player%}
delete {challenge::progress::%player%}


This works, but you have to do a lot by hand:

  • A global on break of stone that runs for every player on the server.
  • A flag variable to know which player is in the challenge.
  • A counter variable.
  • A separate wait 30 seconds to handle the timeout.
  • Lots of delete lines to clean up.


With skLambda
command /challenge:
trigger:
send "mine 10 stone in 30s" to player
listen for block break where event-block is stone:
countdown: 30 seconds
triggers: 10
on trigger:
send "keep going... (%remaining triggers% left)" to event-player
on completion:
send "you did it!" to event-player
give 1 diamond to event-player
on timeout:
send "too slow!" to event-player


That's it. The listener belongs to this one command run. The counter and the timer are built in. When it finishes or times out, it cleans up by itself.



Links




License
MIT



Notes
If you experience any problems, let me know on Discord — eult, or join the Discord server.

View Update

© Copyright 2014-2026 skUnity

All rights reserved.