26148740ef59e195297b37038649f162c05ab0d5
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bc711a48c2 |
Add chat notes: /save and /nota, public and private
Players had nowhere to write anything down. Coordinates got pasted into
Discord, or lost. This adds notes to chat, with two scopes.
A private note is visible only to its author and everyone may write one
(canalhandia.nota, default true). A public note is broadcast and readable by
all, and writing one needs canalhandia.nota.publica (default op) — public
notes are a curated board, not a graffiti wall. Both permissions are declared
in plugin.yml: an undeclared Bukkit permission silently falls back to op-only,
which would have stopped normal players writing anything.
Every note stores where it was written. On a Minecraft server a note is nearly
always about a place — where the base is, where the spawner was found — so
coordinates are part of the model rather than optional metadata. Java players
get click-to-copy on them, the same affordance the death-coords message uses;
Bedrock renders no click event and gets the plain text. No teleport: the
plugin does not touch gameplay.
/save is the quick path. /save and /save coords pin the spot; /save <texto>
pins it with a note. Private on purpose — it is the command someone types
without reading help first, and the safe default there is the one that cannot
surprise anyone by broadcasting. /nota publica <texto> is the explicit way to
share.
Private notes are never sent to the AI, at any setting. The AI call leaves
this server for a third-party API, so a private note reaching it would be a
disclosure the author never agreed to. The filter lives inside
Notes.publicSummary — the only method the AI path calls — rather than at the
call site, so a future caller cannot get it wrong by accident. Public notes
are sent (ia.contexto-notas, default 10), which is what lets the AI answer
"onde fica a base?" from what players actually wrote down.
A note the viewer cannot see is reported as missing rather than as forbidden:
saying "that one is private" would confirm it exists, which is itself a leak.
Search runs through the same visibility filter, so it cannot become a way to
probe for someone else's text. Ids are never reused after a deletion, or
"/nota ver 2" would point at a different note than the one someone wrote down
a minute ago. Text is stripped of the section sign and control characters,
because a note is echoed into chat and could otherwise forge a line that looks
like it came from the server.
Scope parsing accepts the masculine and plural forms ("publico", "publicas")
alongside the canonical ones. Spelled out rather than derived: a blanket a-to-o
rewrite turns "privada" into "privodo", and the plural is exactly what tab
completion suggests, so it has to parse or the suggested command fails.
preflight.sh now checks all 18 commands and both new permissions.
218 tests, up from 176.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016pEyCmrAYHBFgpYjwFxKxh
|
||
|
|
0726ce3794 |
Give the AI a personality, chat awareness and live server state
The AI could only see three static facts about the server, so it answered "quem tá online?" and "tá chovendo?" by insisting it had no access — true of the model, but not of the plugin, which has all of it on hand. It also had no tone: correct answers delivered like a manual, on a server whose whole point is people ribbing each other. Persona: five tones (zoeiro, amigao, seco, aldeao, neutro), switchable live with /ia personalidade <nome>. Personality is expressed only as extra system instructions and changes how the model talks, never what it may do. Every persona — including the blank one — carries Persona.GUARD, which restates the no-commands/no-server-access limits inside the persona's own frame, so a roleplay instruction cannot read as licence to claim powers the plugin does not grant it. The guard also forbids inventing stats, which matters now that real numbers are being fed in. The teasing personas each state where the line is; a test asserts every one of them does. ChatLog: a 50-line in-memory ring of public chat, the last few lines handed to the model so a follow-up like "quem tá reclamando aí?" has a referent. Written from the chat event (off the main thread) and read from /ia, so it is synchronised; a concurrency test hammers it from eight threads, because an unsynchronised deque here would throw ConcurrentModification into a player's answer. Recorded at MONITOR priority so what is stored is what the room saw — a zoacao swap included — and cancelled messages are never stored. Nothing touches disk. ServerState: who is online with their platform, dimension, time of day, weather, and the asker's coordinates, health, hunger and XP. Captured on the main thread before the async call — every field reads the Bukkit world API, which is not safe off it — and only the formatted string crosses the thread boundary. Formatting is pure and tested, including the negative-tick case a raw modulo would drop through every band. Styling: Java players get a hover card with the original question and the active persona, plus a click that pre-fills "/ia " for a follow-up. suggestCommand, not runCommand: nothing executes without the player pressing enter. Bedrock renders neither hover nor click, so it keeps the plain line, built through broadcastPerPlatform like every other interactive message here. preflight.sh: a read-only pre-restart harness. It verifies the jar opens, that plugin.yml declares all 16 commands, that the staged jar's hash matches the local build and is owned 1000:0, that the live config parses as YAML and carries the keys this deploy depends on, and that a rollback jar and config backup both exist. It never restarts anything. A missing YAML parser reports as "not checked" rather than "invalid" — a harness that cries wolf gets ignored. 176 tests, up from 101. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016pEyCmrAYHBFgpYjwFxKxh |