Skip to content

Fix/bugs#5

Merged
tickwarden merged 2 commits into
mainfrom
fix/bugs
May 17, 2026
Merged

Fix/bugs#5
tickwarden merged 2 commits into
mainfrom
fix/bugs

Conversation

@tickwarden
Copy link
Copy Markdown
Collaborator

No description provided.

Claude added 2 commits May 17, 2026 08:01
…e packs

Toggle actions_on/off:
- Tag is flipped via Java API BEFORE actions run (no race condition)
- actions_on fires when the toggle WAS on (turning OFF)
- actions_off fires when the toggle WAS off (turning ON)
- Default tag add/remove no longer injected as run_command — handled in Java
- Custom actions (sound, message, run_command…) execute normally after the flip
- GUI reopens automatically unless an action closes/navigates away

Sound action:
- New 'sound' action type in ActionType enum and executeAction
- value format: 'namespace:sound.id' or 'namespace:sound.id:volume:pitch'
- Uses player.playSoundToPlayer() — only the clicking player hears it
- Logs WARN for unknown sound IDs; does not stop action chain
- Does not return true (does not break chain)

Example datapack:
- admin_panel.json: sound on open, toggle with actions_on/off + sound/message,
  placeholder in toggle lore ({player}), sound on close button
- showcase.json: sound on every button, toggle actions_on/off with lever click
  sounds at different pitches, {player} in all lore/messages, {page1}/{pages}
  in all nav buttons, {score:coins} in on_open message

README:
- sound added to action types table with format docs
- Toggle table: clarified actions_on/off execution order and tag flip timing
GuiVarStore:
- New singleton: Map<UUID, Map<String, String>> in memory
- set / add / remove / clear / get / getInt / getAll / getOrDefault
- ConcurrentHashMap at top level; cleared automatically on GUI close

GuiDefinition:
- New ActionType: SET_VAR, ADD_VAR, SUB_VAR, RESET_VAR, CLEAR_VARS
- New ConditionType: VAR_EQ, VAR_GT, VAR_LT, VAR_SET
- ButtonAction gains 'var' field (variable key for var actions)

BarrelGuiHandler:
- Placeholder {var:key} resolved in resolve()
- evaluateCondition handles var_eq/gt/lt/set
- executeAction handles all 5 var action types
- onClose(ServerPlayerEntity) calls GuiVarStore.INSTANCE.clear()

GuiCommand:
- /guiapi var get <player> <key>
- /guiapi var set <player> <key> <value>
- /guiapi var clear <player>
- Help text updated

Example datapack:
- counter.json: full counter demo — set_var on_open, add/sub/reset_var,
  var_gt and var_set conditions, {var:count} in title and lore
- README: var placeholder table, var action table, var condition table,
  counter example, /guiapi var commands
@tickwarden tickwarden merged commit 38f839e into main May 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant