diff --git a/datapacks/dataLib/data/datalib/function/api/cmd/ban.mcfunction b/datapacks/dataLib/data/datalib/function/api/cmd/ban.mcfunction index 8c234f1c..27d8e290 100644 --- a/datapacks/dataLib/data/datalib/function/api/cmd/ban.mcfunction +++ b/datapacks/dataLib/data/datalib/function/api/cmd/ban.mcfunction @@ -1,2 +1,8 @@ -$ban $(player) $(reason) -$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"cmd/ban ","color":"aqua"},{"text":"$(player) $(reason)","color":"white"}] +# Gated ban: if the gate system is active (datalib:engine sandbox:1b, the +# default), route through confirmation. If gates were turned off via +# gate/toggle/disable, apply directly like before. +# +# INPUT : $(player) -> exact player name, $(reason) -> ban reason +$execute if data storage datalib:engine {sandbox:1b} run return run function dl_load:gate/request {type:"ban",label:"Ban $(player) — $(reason)",action:"datalib:core/internal/cmd/ban_apply",args:{player:"$(player)",reason:"$(reason)"}} + +$function datalib:core/internal/cmd/ban_apply {player:"$(player)",reason:"$(reason)"} diff --git a/datapacks/dataLib/data/datalib/function/api/cmd/data_remove_storage.mcfunction b/datapacks/dataLib/data/datalib/function/api/cmd/data_remove_storage.mcfunction index f83150fb..5d58c1fa 100644 --- a/datapacks/dataLib/data/datalib/function/api/cmd/data_remove_storage.mcfunction +++ b/datapacks/dataLib/data/datalib/function/api/cmd/data_remove_storage.mcfunction @@ -1,4 +1,11 @@ +# Gated storage removal: if the gate system is active (datalib:engine +# sandbox:1b, the default), route through confirmation — this command can +# destroy arbitrary storage data (including datalib's own engine state) so +# it is treated as dangerous. If gates were turned off via +# gate/toggle/disable, apply directly like before. +# +# INPUT : $(storage) -> storage id, e.g. "datalib:engine" +# $(path) -> NBT path to remove, e.g. "pending_gate" +$execute if data storage datalib:engine {sandbox:1b} run return run function dl_load:gate/request {type:"data_remove_storage",label:"Remove storage $(storage) → $(path)",action:"datalib:core/internal/cmd/data_remove_storage_apply",args:{storage:"$(storage)",path:"$(path)"}} - -$data remove storage $(storage) $(path) -$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"cmd/data_remove_storage ","color":"aqua"},{"text":"$(storage) → $(path)","color":"#555555"}] +$function datalib:core/internal/cmd/data_remove_storage_apply {storage:"$(storage)",path:"$(path)"} diff --git a/datapacks/dataLib/data/datalib/function/api/cmd/kick.mcfunction b/datapacks/dataLib/data/datalib/function/api/cmd/kick.mcfunction index fd003540..e354e440 100644 --- a/datapacks/dataLib/data/datalib/function/api/cmd/kick.mcfunction +++ b/datapacks/dataLib/data/datalib/function/api/cmd/kick.mcfunction @@ -1,2 +1,8 @@ -$kick $(player) $(reason) -$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"cmd/kick ","color":"aqua"},{"text":"$(player) $(reason)","color":"white"}] +# Gated kick: if the gate system is active (datalib:engine sandbox:1b, the +# default), route through confirmation. If gates were turned off via +# gate/toggle/disable, apply directly like before. +# +# INPUT : $(player) -> exact player name, $(reason) -> kick reason +$execute if data storage datalib:engine {sandbox:1b} run return run function dl_load:gate/request {type:"kick",label:"Kick $(player) — $(reason)",action:"datalib:core/internal/cmd/kick_apply",args:{player:"$(player)",reason:"$(reason)"}} + +$function datalib:core/internal/cmd/kick_apply {player:"$(player)",reason:"$(reason)"} diff --git a/datapacks/dataLib/data/datalib/function/config.mcfunction b/datapacks/dataLib/data/datalib/function/config.mcfunction index f4324108..1574917d 100644 --- a/datapacks/dataLib/data/datalib/function/config.mcfunction +++ b/datapacks/dataLib/data/datalib/function/config.mcfunction @@ -20,11 +20,13 @@ execute unless data storage datalib:engine config run data modify storage datali execute unless data storage datalib:engine config.enabled run data modify storage datalib:engine config.enabled set value 1b execute unless data storage datalib:engine config.debug_default run data modify storage datalib:engine config.debug_default set value 0b execute unless data storage datalib:engine config.log_level run data modify storage datalib:engine config.log_level set value 1 -execute unless data storage datalib:engine config.sandbox run data modify storage datalib:engine config.sandbox set value 0b +execute unless data storage datalib:engine config.sandbox run data modify storage datalib:engine config.sandbox set value 1b execute unless data storage datalib:engine config.reload_warn run data modify storage datalib:engine config.reload_warn set value 1b execute unless data storage datalib:engine config.namespace_allowlist run data modify storage datalib:engine config.namespace_allowlist set value ["datalib:"] -# Mirror sandbox flag used by older call sites (informational only; gates removed) +# Mirror sandbox flag used by gate/* — gates are active by default (sandbox:1b). +# Disabling requires confirmation via dl_load:gate/toggle/disable; re-enabling +# (dl_load:gate/toggle/enable) does not. execute if data storage datalib:engine config{sandbox:1b} run data modify storage datalib:engine sandbox set value 1b execute unless data storage datalib:engine config{sandbox:1b} run data modify storage datalib:engine sandbox set value 0b diff --git a/datapacks/dataLib/data/datalib/function/core/disable/main.mcfunction b/datapacks/dataLib/data/datalib/function/core/disable/main.mcfunction index 540cda87..6b25a943 100644 --- a/datapacks/dataLib/data/datalib/function/core/disable/main.mcfunction +++ b/datapacks/dataLib/data/datalib/function/core/disable/main.mcfunction @@ -1,6 +1,7 @@ -# Immediate disable (gate removed) -function dl_load:core/internal/load/cleanup -datapack disable "file/dataLib.zip" -datapack disable "file/dataLib" -scoreboard players set #runtoolkit.packs.datalib.version datalib.meta 0 -tellraw @a ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"dataLib disabled.","color":"red"}] +# Gated disable: if the gate system is active (datalib:engine sandbox:1b, +# the default), route through confirmation instead of disabling +# immediately. If gates were turned off via gate/toggle/disable, apply +# directly like before. +execute if data storage datalib:engine {sandbox:1b} run return run function dl_load:gate/request {type:"disable",label:"Disable dataLib",action:"datalib:core/internal/disable/apply",args:{}} + +function datalib:core/internal/disable/apply diff --git a/datapacks/dataLib/data/datalib/function/core/internal/cmd/ban_apply.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/cmd/ban_apply.mcfunction new file mode 100644 index 00000000..86558dba --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/cmd/ban_apply.mcfunction @@ -0,0 +1,5 @@ +# datalib:core/internal/cmd/ban_apply +# The actual ban logic, run either directly (gates off) or after gate +# confirmation (gates on, the default). +$ban $(player) $(reason) +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"cmd/ban ","color":"aqua"},{"text":"$(player) $(reason)","color":"white"}] diff --git a/datapacks/dataLib/data/datalib/function/core/internal/cmd/data_remove_storage_apply.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/cmd/data_remove_storage_apply.mcfunction new file mode 100644 index 00000000..2d23ac54 --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/cmd/data_remove_storage_apply.mcfunction @@ -0,0 +1,5 @@ +# datalib:core/internal/cmd/data_remove_storage_apply +# The actual storage-removal logic, run either directly (gates off) or +# after gate confirmation (gates on, the default). +$data remove storage $(storage) $(path) +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"cmd/data_remove_storage ","color":"aqua"},{"text":"$(storage) → $(path)","color":"#555555"}] diff --git a/datapacks/dataLib/data/datalib/function/core/internal/cmd/kick_apply.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/cmd/kick_apply.mcfunction new file mode 100644 index 00000000..05aa73ad --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/cmd/kick_apply.mcfunction @@ -0,0 +1,5 @@ +# datalib:core/internal/cmd/kick_apply +# The actual kick logic, run either directly (gates off) or after gate +# confirmation (gates on, the default). +$kick $(player) $(reason) +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"cmd/kick ","color":"aqua"},{"text":"$(player) $(reason)","color":"white"}] diff --git a/datapacks/dataLib/data/datalib/function/core/internal/disable/apply.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/disable/apply.mcfunction new file mode 100644 index 00000000..3fbac593 --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/disable/apply.mcfunction @@ -0,0 +1,8 @@ +# datalib:core/internal/disable/apply +# The actual disable logic, run either directly (gates off) or after +# gate confirmation (gates on, the default). +function dl_load:core/internal/load/cleanup +datapack disable "file/dataLib.zip" +datapack disable "file/dataLib" +scoreboard players set #runtoolkit.packs.datalib.version datalib.meta 0 +tellraw @a ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"dataLib disabled.","color":"red"}] diff --git a/datapacks/dataLib/data/datalib/function/core/internal/gate/run_action.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/gate/run_action.mcfunction new file mode 100644 index 00000000..df72aef0 --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/gate/run_action.mcfunction @@ -0,0 +1,14 @@ +# datalib:core/internal/gate/run_action +# Runs the function stored in pending_gate.action, passing pending_gate.args +# (if any) as macro arguments. Called with +# 'with storage datalib:engine pending_gate' so $(action) resolves to the +# action string set by gate/request. +# +# INPUT (macro, from pending_gate compound): +# $(action) -> function id to run, e.g. "datalib:core/internal/cmd/ban_apply" +# args -> (not a macro var — read directly from storage below) +# optional compound of args passed to $(action) + +execute if data storage datalib:engine pending_gate.args run return run function datalib:core/internal/gate/run_action_with_args with storage datalib:engine pending_gate + +$function $(action) diff --git a/datapacks/dataLib/data/datalib/function/core/internal/gate/run_action_with_args.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/gate/run_action_with_args.mcfunction new file mode 100644 index 00000000..96f5ae95 --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/gate/run_action_with_args.mcfunction @@ -0,0 +1,10 @@ +# datalib:core/internal/gate/run_action_with_args +# Same as run_action but the target function also needs macro args from +# pending_gate.args (e.g. ban/kick need player+reason). Runs $(action) +# with storage pointed at pending_gate.args so its own $(player)/$(reason) +# macros resolve. +# +# INPUT (macro, from pending_gate compound): +# $(action) -> function id to run + +$function $(action) with storage datalib:engine pending_gate.args diff --git a/datapacks/dataLib/data/datalib/function/core/internal/gate/toggle/disable_apply.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/gate/toggle/disable_apply.mcfunction new file mode 100644 index 00000000..a8e7f3f7 --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/gate/toggle/disable_apply.mcfunction @@ -0,0 +1,6 @@ +# datalib:core/internal/gate/toggle/disable_apply +# Runs after gate confirmation. Actually flips the sandbox flag off. + +data modify storage datalib:engine sandbox set value 0b +data modify storage datalib:engine config.sandbox set value 0b +tellraw @a[tag=datalib.admin] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Gate confirmations disabled. Dangerous commands will run immediately.","color":"red"}] diff --git a/datapacks/dataLib/data/datalib/function/core/internal/load/force_apply.mcfunction b/datapacks/dataLib/data/datalib/function/core/internal/load/force_apply.mcfunction new file mode 100644 index 00000000..5e474c06 --- /dev/null +++ b/datapacks/dataLib/data/datalib/function/core/internal/load/force_apply.mcfunction @@ -0,0 +1,9 @@ +# datalib:core/internal/load/force_apply +# Runs after gate confirmation (or immediately if gates are disabled). +# Actually performs the force re-init: drops the loaded flag and +# re-runs the full init pipeline, discarding any live engine state +# that dl_load:load/all's "unless data" guards would otherwise preserve. + +data remove storage datalib:engine global.loaded +tellraw @a ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Force re-init...","color":"yellow"}] +function dl_load:load/all diff --git a/datapacks/dataLib/data/datalib/function/core/tick/player_systems.mcfunction b/datapacks/dataLib/data/datalib/function/core/tick/player_systems.mcfunction index 878f742b..e0429130 100644 --- a/datapacks/dataLib/data/datalib/function/core/tick/player_systems.mcfunction +++ b/datapacks/dataLib/data/datalib/function/core/tick/player_systems.mcfunction @@ -2,7 +2,7 @@ execute as @a[scores={dl_menu=1..}] run function datalib:menu scoreboard players set @a[scores={dl_menu=1..}] dl_menu 0 scoreboard players enable @a[scores={dl_menu=-1..}] dl_menu -execute as @a[scores={dl_run=1..}] run function #datalib:run +execute as @a[scores={dl_run=1..}] run function #datalib:admin/run scoreboard players set @a[scores={dl_run=1..}] dl_run 0 scoreboard players enable @a[scores={dl_run=-1..}] dl_run diff --git a/datapacks/dataLib/data/datalib/predicate/is_freezing.json b/datapacks/dataLib/data/datalib/predicate/is_freezing.json index 7a7ab8ff..2406d4df 100644 --- a/datapacks/dataLib/data/datalib/predicate/is_freezing.json +++ b/datapacks/dataLib/data/datalib/predicate/is_freezing.json @@ -1,8 +1,93 @@ { - "entity": "this", - "predicate": { - "nbt": "{FrozenTicks:1..}", - "entity_type": "minecraft:player" - }, - "condition": "minecraft:entity_properties" -} + "condition": "minecraft:any_of", + "terms": [ + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:1}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:2}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:3}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:4}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:5}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:6}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:7}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:8}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:9}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:10}" + } + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "entity_type": "minecraft:player", + "nbt": "{TicksFrozen:11}" + } + } + ] +} \ No newline at end of file diff --git a/datapacks/dataLib/data/dl_load/function/gate/collision.mcfunction b/datapacks/dataLib/data/dl_load/function/gate/collision.mcfunction new file mode 100644 index 00000000..1f4dfabd --- /dev/null +++ b/datapacks/dataLib/data/dl_load/function/gate/collision.mcfunction @@ -0,0 +1,9 @@ +# dl_load:gate/collision +# A gate request came in while another was already pending. The original +# request keeps priority; this collision is logged instead of silently +# dropped. + +data modify storage datalib:engine _log_add_tmp.message set value "[Gate] Collision: a gate request was dropped because one was already pending" +data modify storage datalib:engine _log_add_tmp.level set value "WARN" +data modify storage datalib:engine _log_add_tmp.color set value "yellow" +execute if score #dl.log_level dl.log_level matches 1.. run function datalib:systems/log/add with storage datalib:engine _log_add_tmp diff --git a/datapacks/dataLib/data/dl_load/function/gate/no.mcfunction b/datapacks/dataLib/data/dl_load/function/gate/no.mcfunction new file mode 100644 index 00000000..0ecf2daf --- /dev/null +++ b/datapacks/dataLib/data/dl_load/function/gate/no.mcfunction @@ -0,0 +1,13 @@ +# dl_load:gate/no +# Cancels the pending gated action without running it. +# Only players with datalib.admin may call this directly (same trust +# boundary as gate/yes). + +execute unless entity @s[tag=datalib.admin] run return 0 +execute unless data storage datalib:engine pending_gate run return 0 + +schedule clear dl_load:gate/timeout + +tellraw @a[tag=datalib.admin] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Cancelled: ","color":"gray"},{"nbt":"pending_gate.label","storage":"datalib:engine","color":"white"}] + +data remove storage datalib:engine pending_gate diff --git a/datapacks/dataLib/data/dl_load/function/gate/request.mcfunction b/datapacks/dataLib/data/dl_load/function/gate/request.mcfunction new file mode 100644 index 00000000..f22f2114 --- /dev/null +++ b/datapacks/dataLib/data/dl_load/function/gate/request.mcfunction @@ -0,0 +1,32 @@ +# dl_load:gate/request +# Starts a confirm/cancel gated action. Any dangerous action (ban, kick, +# disable, sandbox toggle-off, ...) should route through here instead of +# executing immediately. +# +# INPUT (macro — all four required; pass args:{} for no-arg actions): +# $(type) -> gate type, e.g. "disable", "ban", "kick", "gate_bypass" +# $(label) -> human-readable text shown in the confirm prompt +# $(action) -> function to run on confirm, e.g. "datalib:core/disable/main" +# $(args) -> compound of macro args passed to $(action) via +# run_action_with_args, e.g. {player:"Steve",reason:"x"}. +# Pass {} for actions that take no arguments. +# +# A single global pending_gate slot is used. If a second request comes in +# while one is already pending, the new request is dropped and the +# collision is logged — the original request keeps priority. +# +# KNOWN LIMITATION (not fixed here, pre-existing): +# Callers write to storage before gate/request's own #pending check runs, +# so a second caller can still race the check under concurrent execution. +# This affects all gate types, not just this one. + +execute if data storage datalib:engine pending_gate run return run function dl_load:gate/collision + +$data modify storage datalib:engine pending_gate.type set value "$(type)" +$data modify storage datalib:engine pending_gate.label set value "$(label)" +$data modify storage datalib:engine pending_gate.action set value "$(action)" +$data modify storage datalib:engine pending_gate.args set value $(args) + +tellraw @a[tag=datalib.admin] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Confirmation required: ","color":"yellow"},{"nbt":"pending_gate.label","storage":"datalib:engine","color":"white"}," ",{"text":"[Confirm]","color":"green","bold":true,"click_event":{"action":"run_command","command":"/function dl_load:gate/yes"}}," ",{"text":"[Cancel]","color":"red","bold":true,"click_event":{"action":"run_command","command":"/function dl_load:gate/no"}}," ",{"text":"(30s)","color":"gray"}] + +schedule function dl_load:gate/timeout 30s diff --git a/datapacks/dataLib/data/dl_load/function/gate/timeout.mcfunction b/datapacks/dataLib/data/dl_load/function/gate/timeout.mcfunction new file mode 100644 index 00000000..b491128b --- /dev/null +++ b/datapacks/dataLib/data/dl_load/function/gate/timeout.mcfunction @@ -0,0 +1,10 @@ +# dl_load:gate/timeout +# Scheduled 30s after gate/request. If the gate is still pending (nobody +# confirmed or cancelled it), auto-cancel it. If gate/yes or gate/no +# already resolved it, this call is a no-op (the schedule was cleared). + +execute unless data storage datalib:engine pending_gate run return 0 + +tellraw @a[tag=datalib.admin] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Timed out: ","color":"gray"},{"nbt":"pending_gate.label","storage":"datalib:engine","color":"white"},{"text":" (30s, no response)","color":"gray"}] + +data remove storage datalib:engine pending_gate diff --git a/datapacks/dataLib/data/dl_load/function/gate/toggle/disable.mcfunction b/datapacks/dataLib/data/dl_load/function/gate/toggle/disable.mcfunction new file mode 100644 index 00000000..1e8dce06 --- /dev/null +++ b/datapacks/dataLib/data/dl_load/function/gate/toggle/disable.mcfunction @@ -0,0 +1,10 @@ +# dl_load:gate/toggle/disable +# Disables the gate system (datalib:engine sandbox -> 0b), which means +# dangerous commands stop requiring confirmation. Disabling the gates +# is itself gated — same confirm/cancel/30s flow as ban/kick/disable — +# since turning off the safety net is a dangerous action in its own right. +# Re-enabling (gate/toggle/enable) needs no confirmation. + +execute unless entity @s[tag=datalib.admin] run return 0 + +function dl_load:gate/request {type:"gate_bypass",label:"Disable gate confirmations (dangerous commands will run immediately)",action:"datalib:core/internal/gate/toggle/disable_apply",args:{}} diff --git a/datapacks/dataLib/data/dl_load/function/gate/toggle/enable.mcfunction b/datapacks/dataLib/data/dl_load/function/gate/toggle/enable.mcfunction new file mode 100644 index 00000000..1075c589 --- /dev/null +++ b/datapacks/dataLib/data/dl_load/function/gate/toggle/enable.mcfunction @@ -0,0 +1,9 @@ +# dl_load:gate/toggle/enable +# Re-enables the gate system (datalib:engine sandbox -> 1b). No +# confirmation needed — turning the safety net back on is always safe. + +execute unless entity @s[tag=datalib.admin] run return 0 + +data modify storage datalib:engine sandbox set value 1b +data modify storage datalib:engine config.sandbox set value 1b +tellraw @a[tag=datalib.admin] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Gate confirmations re-enabled.","color":"green"}] diff --git a/datapacks/dataLib/data/dl_load/function/gate/yes.mcfunction b/datapacks/dataLib/data/dl_load/function/gate/yes.mcfunction new file mode 100644 index 00000000..df26a3b1 --- /dev/null +++ b/datapacks/dataLib/data/dl_load/function/gate/yes.mcfunction @@ -0,0 +1,14 @@ +# dl_load:gate/yes +# Confirms the pending gated action and runs it. +# Only players with datalib.admin may call this directly — vanilla target +# selectors cannot query real op/permission level, so the tag is the trust +# boundary here (same one load/other.mcfunction already uses for +# dl_menu/dl_run/dl_action). + +execute unless entity @s[tag=datalib.admin] run return 0 +execute unless data storage datalib:engine pending_gate run return 0 + +schedule clear dl_load:gate/timeout + +function datalib:core/internal/gate/run_action with storage datalib:engine pending_gate +data remove storage datalib:engine pending_gate diff --git a/datapacks/dataLib/data/dl_load/function/load/force.mcfunction b/datapacks/dataLib/data/dl_load/function/load/force.mcfunction index 233dfcf8..e4fce868 100644 --- a/datapacks/dataLib/data/dl_load/function/load/force.mcfunction +++ b/datapacks/dataLib/data/dl_load/function/load/force.mcfunction @@ -1,4 +1,11 @@ -# Force full re-init (explicit data loss of engine flags) -data remove storage datalib:engine global.loaded -tellraw @a ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Force re-init...","color":"yellow"}] -function dl_load:load/all +# dl_load:load/force +# Gated force reload: if the gate system is active (datalib:engine +# sandbox:1b, the default), route through confirmation — force reload +# discards live engine state (global.loaded and everything load/all's +# "unless data" guards would otherwise preserve), so it is a dangerous +# action in the same class as ban/kick/disable. If gates were turned +# off via gate/toggle/disable, apply directly like before. + +execute if data storage datalib:engine {sandbox:1b} run return run function dl_load:gate/request {type:"load_force",label:"Force reload dataLib (discards live engine state)",action:"datalib:core/internal/load/force_apply",args:{}} + +function datalib:core/internal/load/force_apply diff --git a/datapacks/dataLib/data/dl_load/function/main.mcfunction b/datapacks/dataLib/data/dl_load/function/main.mcfunction index a4dc25cb..0bd10f6b 100644 --- a/datapacks/dataLib/data/dl_load/function/main.mcfunction +++ b/datapacks/dataLib/data/dl_load/function/main.mcfunction @@ -1,5 +1,9 @@ -# dl_load:main — load entry (no confirmation gate) -# Only soft-guard: if already loaded, optional reload data-loss warning then continue only via force path. +# dl_load:main — load entry +# Initial load runs unblocked (no confirmation gate — must not stall server +# startup). Reload data-loss is only a soft warning here; the actual +# force-reload path (dl_load:load/force) is gated when sandbox:1b — +# clicking the link below opens a confirm/cancel prompt instead of +# force-reiniting immediately. See dl_load:gate/request. function datalib:config @@ -7,7 +11,7 @@ function datalib:config execute if score #runtoolkit.archivedpacks.datalib datalib.meta matches 1 run tellraw @s {"text":"[dataLib] This pack is marked archived (#runtoolkit.archivedpacks.datalib=1).","color":"red"} # Already loaded → data-loss prevention notice (NOT a hard gate; does not block) -execute if data storage datalib:engine global{loaded:1b} if data storage datalib:engine config{reload_warn:1b} run tellraw @s ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Reload: engine already loaded. Live storage kept. To force full re-init: ","color":"yellow"},{"text":"/function dl_load:load/force","color":"aqua","underlined":true,"click_event":{"action":"run_command","command":"/function dl_load:load/force"}}] +execute if data storage datalib:engine global{loaded:1b} if data storage datalib:engine config{reload_warn:1b} run tellraw @s ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"Reload: engine already loaded. Live storage kept. To force full re-init (requires confirmation): ","color":"yellow"},{"text":"/function dl_load:load/force","color":"aqua","underlined":true,"click_event":{"action":"run_command","command":"/function dl_load:load/force"}}] execute if data storage datalib:engine global{loaded:1b} run return 0 diff --git a/datapacks/dataLib/data/player_action/function/core/internal/v1/interact_cartopgraphy_table.mcfunction b/datapacks/dataLib/data/player_action/function/core/internal/v1/interact_cartopgraphy_table.mcfunction index d8dee69b..d5bb570e 100644 --- a/datapacks/dataLib/data/player_action/function/core/internal/v1/interact_cartopgraphy_table.mcfunction +++ b/datapacks/dataLib/data/player_action/function/core/internal/v1/interact_cartopgraphy_table.mcfunction @@ -1,2 +1,2 @@ -function #player_action:v1/internal/interact_cartography_table +function #player_action:v1/internal/interact_cartopgraphy_table diff --git a/datapacks/dataLib/data/player_action/function/v1.7/player/interact/interact_cartopgraphy_table.mcfunction b/datapacks/dataLib/data/player_action/function/v1.7/player/interact/interact_cartopgraphy_table.mcfunction index aa0e32f7..8fa59bad 100644 --- a/datapacks/dataLib/data/player_action/function/v1.7/player/interact/interact_cartopgraphy_table.mcfunction +++ b/datapacks/dataLib/data/player_action/function/v1.7/player/interact/interact_cartopgraphy_table.mcfunction @@ -1,3 +1,3 @@ advancement revoke @s only player_action:v1/interact_cartography_table -function #player_action:v1/interact_cartography_table +function #player_action:v1/interact_cartopgraphy_table diff --git a/datapacks/dataLib/data/player_action/function/v1.7/versioning/interact_cartography_table.mcfunction b/datapacks/dataLib/data/player_action/function/v1.7/versioning/interact_cartography_table.mcfunction index 3372cdbe..89031537 100644 --- a/datapacks/dataLib/data/player_action/function/v1.7/versioning/interact_cartography_table.mcfunction +++ b/datapacks/dataLib/data/player_action/function/v1.7/versioning/interact_cartography_table.mcfunction @@ -1,2 +1,2 @@ -execute if predicate player_action:v1.7/is_correct_version run function player_action:v1.7/player/interact/interact_cartography_table +execute if predicate player_action:v1.7/is_correct_version run function player_action:v1.7/player/interact/interact_cartopgraphy_table diff --git a/datapacks/dataLib/data/stringlib/function/zprivate/insert/main.mcfunction b/datapacks/dataLib/data/stringlib/function/zprivate/insert/main.mcfunction new file mode 100644 index 00000000..42221b94 --- /dev/null +++ b/datapacks/dataLib/data/stringlib/function/zprivate/insert/main.mcfunction @@ -0,0 +1,2 @@ +# Combine S1 + I + S2 into the final inserted string +$data modify storage stringlib:output insert set value "$(S1)$(I)$(S2)"