From 8d5bbea13f763d1b109608640b6df4c29cc9e484 Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:21:37 +0300 Subject: [PATCH 1/6] Update skript_repo_ref to version 2.15.0-pre1 --- .github/workflows/test-skripts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-skripts.yml b/.github/workflows/test-skripts.yml index 61be5e3..aaf0a0a 100644 --- a/.github/workflows/test-skripts.yml +++ b/.github/workflows/test-skripts.yml @@ -88,7 +88,7 @@ jobs: test_script_directory: tests # Skript version or ref (tag, branch, or commit) - skript_repo_ref: dev/feature + skript_repo_ref: 2.15.0-pre1 # directory containing addon/plugin jars (relative to repo root) extra_plugins_directory: build/libs From b5bddc9419a5140e3f67c1173aad524ce3fcf4b6 Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:22:53 +0300 Subject: [PATCH 2/6] Delete scripts/libs/pdc.sk --- scripts/libs/pdc.sk | 210 -------------------------------------------- 1 file changed, 210 deletions(-) delete mode 100644 scripts/libs/pdc.sk diff --git a/scripts/libs/pdc.sk b/scripts/libs/pdc.sk deleted file mode 100644 index b101372..0000000 --- a/scripts/libs/pdc.sk +++ /dev/null @@ -1,210 +0,0 @@ -import: - org.bukkit.NamespacedKey - org.bukkit.persistence.PersistentDataContainer - org.bukkit.persistence.PersistentDataHolder - org.bukkit.persistence.PersistentDataType - java.io.ByteArrayInputStream - java.io.ByteArrayOutputStream - org.bukkit.util.io.BukkitObjectInputStream - org.bukkit.util.io.BukkitObjectOutputStream - ch.njol.skript.lang.Variable - java.lang.Byte - java.lang.Short - java.lang.Integer - java.lang.Long - java.lang.Float - java.lang.Double - java.lang.Boolean - -on load: - set scoped {-primitives::pdt::*} to PersistentDataType.BOOLEAN, PersistentDataType.BYTE, PersistentDataType.SHORT, PersistentDataType.INTEGER, PersistentDataType.LONG, PersistentDataType.FLOAT, PersistentDataType.DOUBLE, PersistentDataType.STRING, PersistentDataType.TAG_CONTAINER - set scoped {-primitives::str::*} to "bool", "byte", "short", "int", "long", "float", "double", "str", "pdc" - set scoped {-primitives::int::*} to 8, 6, 7, 2, 3, 4, 5, 1, 9 - -local function validate_pdcexpr(key: object, pdc: object, pdt: object) :: boolean: - if all: - {_pdt} is set - {_pdt} is not an instance of PersistentDataType - then: - return false - if any: - {_key} is not an instance of NamespacedKey - {_pdc} is not an instance of PersistentDataContainer - then: - return false - return true - - -local function coerce_pdt_value(pdt: object, value: object) :: object: - if {_value} is not set: - return {_none} - - if {_pdt} is PersistentDataType.INTEGER: - return try new Integer({_value}) if {_value} is an integer - - else if {_pdt} is PersistentDataType.BYTE: - return try new Byte({_value}) if {_value} is an integer - - else if {_pdt} is PersistentDataType.SHORT: - return try new Short({_value}) if {_value} is an integer - - else if {_pdt} is PersistentDataType.LONG: - return try new Long({_value}) if {_value} is an integer - - else if {_pdt} is PersistentDataType.FLOAT: - return try new Float({_value}) - - else if {_pdt} is PersistentDataType.DOUBLE: - return try new Double({_value}) - - else if {_pdt} is PersistentDataType.STRING: - return {_value} if {_value} is a text - - else if {_pdt} is PersistentDataType.BOOLEAN: - return {_value} if {_value} is a boolean - - else if {_pdt} is PersistentDataType.TAG_CONTAINER: - return {_value} if {_value} is an instance of PersistentDataContainer - - else if {_pdt} is PersistentDataType.BYTE_ARRAY: - return {_value} - - return {_none} - - -expression [devdinc] [namespaced]( |-)key %string% [with]in %object%[ for %-object%]: - parse: - set {_pdt} to expr-3 - - if any: - "%{_pdt}%" contains "[devdinc] (pdt|[persistent data ]type)" - "%{_pdt}%" contains "PersistentDataType" - {_pdt} is instance of Variable - {_pdt} is not set - then: - continue - - get: - set {_key} to NamespacedKey.fromString(expr-1, null) - set {_pdc} to expr-2.getPersistentDataContainer() if expr-2 is instance of PersistentDataHolder else expr-2 - set {_pdt} to expr-3 - - stop if validate_pdcexpr({_key}, {_pdc}, {_pdt}) is false - - if {_pdt} is not set: - set {_typeKey} to NamespacedKey.fromString("%{_key}%..type", null) - - if {_pdc}.has({_typeKey}, PersistentDataType.STRING): - set {_typeId} to {_pdc}.get({_typeKey}, PersistentDataType.STRING) - - set {_i} to 1 - loop scoped {-primitives::str::*}: - if {_typeId} is loop-value: - set {_pdt} to {_i}th element of scoped {-primitives::pdt::*} - return try {_pdc}.get({_key}, {_pdt}) # try is used for if the key does not exist - add 1 to {_i} - - else: - if {_pdc}.has({_key}, PersistentDataType.BYTE_ARRAY) is false: - return {_none} - - set {_bytes} to {_pdc}.get({_key}, PersistentDataType.BYTE_ARRAY) - set {_in} to new BukkitObjectInputStream(new ByteArrayInputStream({_bytes})) - set {_obj} to {_in}.readObject() - {_in}.close() - return {_obj} - else: - return {_pdc}.get({_key}, {_pdt}) - - set: - set {_key} to NamespacedKey.fromString(expr-1, null) - set {_pdc} to expr-2.getPersistentDataContainer() if expr-2 is instance of PersistentDataHolder else expr-2 - set {_pdt} to expr-3 - - stop if validate_pdcexpr({_key}, {_pdc}, {_pdt}) is false - - set {_value} to change value - - if any: - {_value} is null - {_value} is not set - then: - {_pdc}.remove({_key}) - stop - - if {_pdt} is not set: - set {_typeKey} to NamespacedKey.fromString("%{_key}%..type", null) - - set {_i} to 1 - loop scoped {-primitives::pdt::*}: - set {_try} to coerce_pdt_value(loop-value, {_value}) - - if {_try} is set: - {_pdc}.set({_key}, loop-value, {_try}) - {_pdc}.set({_typeKey}, PersistentDataType.STRING, {_i}th element of scoped {-primitives::str::*}) - - stop - - add 1 to {_i} - - set {_baos} to new ByteArrayOutputStream() - set {_out} to new BukkitObjectOutputStream({_baos}) - {_out}.writeObject({_value}) - {_out}.close() - - set {_boxedBytes::*} to ...{_baos}.toByteArray() - set {_bytes} to new byte[size of {_boxedBytes::*}] - loop {_boxedBytes::*}: - set {_bytes}[loop-index parsed as number - 1] to loop-value - - {_pdc}.set({_key}, PersistentDataType.BYTE_ARRAY, {_bytes}) - - else: - set {_coerced} to coerce_pdt_value({_pdt}, {_value}) - {_pdc}.set({_key}, {_pdt}, {_coerced}) - - - delete: - set {_key} to NamespacedKey.fromString(expr-1, null) - set {_pdc} to expr-2.getPersistentDataContainer() if expr-2 is instance of PersistentDataHolder else expr-2 - set {_pdt} to expr-3 - - stop if validate_pdcexpr({_key}, {_pdc}, {_pdt}) is false - - set {_typeKey} to NamespacedKey.fromString("%{_key}%..type", null) - {_pdc}.remove({_typeKey}) - {_pdc}.remove({_key}) - - -object property p[ersistent ]d[ata ]c[ontainer]: - parse: - continue - get: - return expr-1.getPersistentDataContainer() - - -expression [devdinc] new p[ersistent ]d[ata ]c[ontainer] from %object%: - parse: - continue - get: - set {_src} to expr-1 - - if {_src} is instance of PersistentDataHolder: - set {_ctx} to {_src}.getPersistentDataContainer().getAdapterContext() - return {_ctx}.newPersistentDataContainer() - - if {_src} is instance of PersistentDataContainer: - set {_ctx} to {_src}.getAdapterContext() - return {_ctx}.newPersistentDataContainer() - - return {_none} - - -expression [devdinc] (pdt|[persistent data ]type) [of] (1:str[ing]|2:int[eger]|3:long|4:float|5:double|6:byte|7:short|8:bool[ean]|9:container): - parse: - continue - get: - set {_l::*} to scoped {-primitives::int::*} - set {_i} to {_l::%parse mark%} - return {_i}th element of scoped {-primitives::pdt::*} - From e983fff3d98916ef586dfdcc6bfa569c267a846b Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:23:22 +0300 Subject: [PATCH 3/6] Delete tests/working/libs/pdc.test.sk --- tests/working/libs/pdc.test.sk | 115 --------------------------------- 1 file changed, 115 deletions(-) delete mode 100644 tests/working/libs/pdc.test.sk diff --git a/tests/working/libs/pdc.test.sk b/tests/working/libs/pdc.test.sk deleted file mode 100644 index aad6eb4..0000000 --- a/tests/working/libs/pdc.test.sk +++ /dev/null @@ -1,115 +0,0 @@ -import: - java.util.HashMap - -on load: - set scoped {-key} to "plugin:test_pdt" - -after each test: - event-script is current script - delete namespaced-key scoped {-key} within test-world if scoped {-key} is set - -# since we use after each test we have to use devdinc test pattern here - -devdinc test "pdc basic set/get with typed pdt": - - set namespaced-key scoped {-key} within test-world for pdt integer to 42 - assert namespaced-key scoped {-key} within test-world for pdt integer is 42 with "typed pdt get failed" - -devdinc test "pdc overwrite typed value": - - set namespaced-key scoped {-key} within test-world for pdt string to "a" - set namespaced-key scoped {-key} within test-world for pdt string to "b" - - assert namespaced-key scoped {-key} within test-world for pdt string is "b" with "overwrite failed" - -devdinc test "pdc delete typed value": - set namespaced-key scoped {-key} within test-world for pdt long to 100 - delete namespaced-key scoped {-key} within test-world for pdt long - - assert namespaced-key scoped {-key} within test-world for pdt long is not set with "delete failed" - -devdinc test "pdc object serialization (byte_array implicit)": - - set {_obj} to new HashMap() - {_obj}.put("a", 1) - {_obj}.put("b", 2) - - set namespaced-key scoped {-key} within test-world to {_obj} - - set {_out} to namespaced-key scoped {-key} within test-world - assert {_out}.get("a") is 1 with "object deserialize failed (a)" - assert {_out}.get("b") is 2 with "object deserialize failed (b)" - -devdinc test "pdc remove object via null": - - set namespaced-key scoped {-key} within test-world to "temp" - set namespaced-key scoped {-key} within test-world to null - - assert namespaced-key scoped {-key} within test-world is not set with "object remove via null failed" - -devdinc test "pdc holder vs direct pdc equivalence": - set {_pdc} to test-world's pdc - - set namespaced-key scoped {-key} within test-world for pdt byte to 7 - assert namespaced-key scoped {-key} within {_pdc} for pdt byte is 7 with "direct pdc access failed" - -devdinc test "pdc boolean pdt": - - set namespaced-key scoped {-key} within test-world for pdt boolean to true - assert namespaced-key scoped {-key} within test-world for pdt boolean is true with "boolean pdt failed" - -devdinc test "pdc default object missing returns none": - - assert namespaced-key scoped {-key} within test-world is not set with "missing object did not return none" - -devdinc test "pdc unspecified pdt boolean": - - set namespaced-key scoped {-key} within test-world to true - assert namespaced-key scoped {-key} within test-world is true with "unspecified boolean failed" - -devdinc test "pdc unspecified pdt byte": - - set namespaced-key scoped {-key} within test-world to 5 - assert namespaced-key scoped {-key} within test-world is 5 with "unspecified byte failed" - -devdinc test "pdc unspecified pdt short": - - set namespaced-key scoped {-key} within test-world to 12 - assert namespaced-key scoped {-key} within test-world is 12 with "unspecified short failed" - -devdinc test "pdc unspecified pdt integer": - - set namespaced-key scoped {-key} within test-world to 123 - assert namespaced-key scoped {-key} within test-world is 123 with "unspecified integer failed" - -devdinc test "pdc unspecified pdt long": - - set namespaced-key scoped {-key} within test-world to 123 - assert namespaced-key scoped {-key} within test-world is 123 with "unspecified long failed" - -devdinc test "pdc unspecified pdt float": - - set namespaced-key scoped {-key} within test-world to 1.5 - assert namespaced-key scoped {-key} within test-world is 1.5 with "unspecified float failed" - -devdinc test "pdc unspecified pdt double": - - set namespaced-key scoped {-key} within test-world to 2.75 - assert namespaced-key scoped {-key} within test-world is 2.75 with "unspecified double failed" - - -devdinc test "pdc unspecified pdt string": - - set namespaced-key scoped {-key} within test-world to "hello" - assert namespaced-key scoped {-key} within test-world is "hello" with "unspecified string failed" - -devdinc test "pdc unspecified pdt tag_container": - - set {_inner-pdc} to new pdc from test-world - set {_inner-key} to "plugin:inner_key" - set namespaced-key {_inner-key} within {_inner-pdc} for pdt integer to 9 - - set namespaced-key scoped {-key} within test-world to {_inner-pdc} - - set {_out-pdc} to namespaced-key scoped {-key} within test-world - assert namespaced-key {_inner-key} within {_out-pdc} for pdt integer is 9 with "unspecified tag_container failed" From 7188e7112ffeeb18cac2a535bf3d6253c790d8f5 Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:23:36 +0300 Subject: [PATCH 4/6] Delete tests/working/libs/routines.test.sk --- tests/working/libs/routines.test.sk | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 tests/working/libs/routines.test.sk diff --git a/tests/working/libs/routines.test.sk b/tests/working/libs/routines.test.sk deleted file mode 100644 index b76a3dc..0000000 --- a/tests/working/libs/routines.test.sk +++ /dev/null @@ -1,13 +0,0 @@ -import: - java.net.URL - -test "routines basic": - set {_res} to routine.fluent(instant now).context(async context).supply(lambda:+ new URL("https://www.dummy2.com")).join() - assert "%{_res}%" is "https://www.dummy2.com" with "java call" - - set {_res} to wait for fluent routine lambda:+ routine_local_get_url() - assert "%{_res}%" is "https://www.dummy1.com" with "function call" - - -function routine_local_get_url() :: object: # has to be not local - return new URL("https://www.dummy1.com") From 620dac24d9a59816d9420f349569a95aeb9c3c80 Mon Sep 17 00:00:00 2001 From: devdinc <234956748+devdinc@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:23:46 +0300 Subject: [PATCH 5/6] Delete scripts/libs/routines.sk --- scripts/libs/routines.sk | 181 --------------------------------------- 1 file changed, 181 deletions(-) delete mode 100644 scripts/libs/routines.sk diff --git a/scripts/libs/routines.sk b/scripts/libs/routines.sk deleted file mode 100644 index a64662c..0000000 --- a/scripts/libs/routines.sk +++ /dev/null @@ -1,181 +0,0 @@ -# ============================================================================= -# FLUENT ROUTINES INTEGRATION (Paper / Skript) -# ============================================================================= -# -# This script exposes the devdinc/routines API to Skript via skript-reflect, -# enabling fluent, composable, and contextual routine execution. -# -# It allows scheduling and chaining of Java-compatible functional interfaces -# (Runnable, Supplier, Function, Consumer) with explicit execution contexts -# (virtual, async, global). -# -# ----------------------------------------------------------------------------- -# REQUIREMENTS -# ----------------------------------------------------------------------------- -# -# - Paper server -# - Skript -# - skript-reflect -# - Skcrew (for lambda support) -# -# The following MUST be present in skript-reflect's directory: -# - routines-core.jar -# - routines-paper.jar - -# The following MUST be installed as a skript: -# - devdinc/skript/functionsv2.sk -# -# ----------------------------------------------------------------------------- -# INITIALIZATION -# ----------------------------------------------------------------------------- -# -# On load, this script: -# - Instantiates a singleton RoutineService -# - Registers Paper execution contexts: -# * virtual → lightweight, non-thread-affine execution -# * async → Paper async scheduler -# * global → main server thread -# -# These are stored in global variables for reuse. -# -# ----------------------------------------------------------------------------- -# PROVIDED EXPRESSIONS -# ----------------------------------------------------------------------------- -# -# 1) instant now -# - Returns java.time.Instant.now() -# -# 2) routine service -# - Returns the singleton RoutineService instance -# -# 3) context -# - Returns a PaperContext for routine execution -# -# 4) fluent routine [at