Skip to content

feat: run configured console commands on alert - #1

Open
clawd131662[bot] wants to merge 2 commits into
masterfrom
feat/alert-commands
Open

feat: run configured console commands on alert#1
clawd131662[bot] wants to merge 2 commits into
masterfrom
feat/alert-commands

Conversation

@clawd131662

@clawd131662 clawd131662 Bot commented Jun 22, 2026

Copy link
Copy Markdown

What

Adds an alert-commands config key so the honeypot can react, not just report. Whenever an alert fires, each listed command is dispatched as the console sender, in order.

alert-commands:
- jail ${Player}
- tell ${Player} 你踩到陷阱了

Details

  • Reuses the same placeholders as alert-message: ${Player}, ${Block}, ${onClicked}, ${x}, ${y}, ${z}, ${world}.
  • Placeholder substitution is extracted into a shared format(...) helper used by both the console message and the commands.
  • Commands run after the console message, in list order, via dispatchCommand as the console sender (no leading /). The listeners are synchronous, so dispatch is on the main thread.
  • Held as a List<String> (not a Set like the other list keys) to preserve execution order and allow duplicates.
  • Empty by default → existing behavior is unchanged. The filter chain is untouched: commands only fire under the exact same conditions that produce an alert.
  • Color codes (&) are not translated for commands (only for the console message).

Notes

  • No color translation for commands — flag if tell-style commands should support & codes.
  • chore: bump version to 1.4-beta.1 is included so the beta release jar names correctly.

Test plan

  • ./gradlew build passes (JDK 21); jar builds as ResidenceAlert-1.4-beta.1.jar and plugin.yml renders version: 1.4-beta.1.
  • No automated tests in this repo (detector logic is unchanged; only an additive side effect on the existing alert path).

🤖 Generated with Claude Code

claude added 2 commits June 23, 2026 01:36
Add an `alert-commands` config key: a list of console commands dispatched
(in order, as the console sender) whenever an alert fires, sharing the same
placeholders as `alert-message` (${Player}, ${Block}, ${onClicked}, ${x},
${y}, ${z}, ${world}). Empty by default, so existing behavior is unchanged.

Placeholder substitution is extracted into a shared `format(...)` helper used
by both the console message and the commands. Held as a List<String> (not a
Set like the other list keys) to preserve execution order and allow dupes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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