Skip to content

Add command-and-message actions - #278

Closed
kazotaruumc72 wants to merge 2 commits into
Maxlego08:developfrom
MineArena:feature/command-and-message-actions
Closed

kazotaruumc72 wants to merge 2 commits into
Maxlego08:developfrom
MineArena:feature/command-and-message-actions

Conversation

@kazotaruumc72

@kazotaruumc72 kazotaruumc72 commented Nov 8, 2026 •

Copy link
Copy Markdown

Summary

New actions that run commands and send messages to the player in one action.

  • console-command-and-message: runs commands as the console, then sends messages to the player. Options: stop-on-failure, minimessage.
  • player-command-and-message: makes the player run commands, then sends messages. Options: command-in-chat, minimessage.
  • random-console-command-and-message / random-player-command-and-message: each section of the action (1, 2, ...) holds commands and messages. One section is picked at random (equal chance) each time the action runs. The options can be set per section or once on the action for every section. Sections without commands or messages are ignored, and an action with no valid section logs a warning on load.

The actions reuse ConsoleCommandAction, PlayerCommandAction and MessageAction instead of duplicating their logic. They are registered through @AutoActionLoader and support serialization.

actions:
  - type: random-console-command-and-message
    1:
      commands:
        - "give %player% diamond 1"
      messages:
        - "<green>You received a diamond!"
    2:
      commands:
        - "give %player% emerald 1"
      messages:
        - "<green>You received an emerald!"

Notes:

  • Messages are sent right away. On Folia, console commands run on the next tick, and player commands always go through the scheduler, so a message can arrive before its commands run.
  • stop-on-failure only stops the remaining commands. The messages are still sent.

Test plan

  • ./gradlew :compileJava
  • ActionSerializationTest (fixtures added for the 4 new actions: load, serialize, reload)
  • Example added in basic_inventory.yml (myFourthButton)
  • Not tested in game yet

🤖 Generated with Claude Code

kazotaruumc72 and others added 2 commits November 8, 2026 15:42
Add console-command-and-message and player-command-and-message, which run
commands then send messages to the player, and their random variants that
pick one section at random.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a random-console-command-and-message example to basic_inventory.yml,
fixtures for the new actions in the serialization test, and read numeric
section keys (1, 2, 3) without a ClassCastException.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alwyn974 alwyn974 closed this Nov 8, 2026
Repository owner locked and limited conversation to collaborators Nov 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants