Skip to content

Storage & Lifecycle ​

This page explains what happens behind the GUI after an announcement is created, updated, deleted, or reloaded.

Storage File ​

AnnouncementGUI stores announcement data in a YAML file. By default:

text
plugins/AnnouncementGUI/announcements.yml

The repository layer reads from and writes to that file synchronously.

Stored Fields ​

Each record contains these fields:

  • name
  • title
  • description-lines
  • message-lines
  • interval-seconds
  • target-type
  • targets
  • enabled
  • created-by
  • owner-server-id
  • created-at
  • updated-at
  • version

Example YAML Entry ​

yml
announcements:
  01234567-89ab-cdef-0123-456789abcdef:
    name: "welcome"
    title: "&6Welcome to %server%"
    description-lines:
      - "&7Network announcement panel"
    message-lines:
      - "<center>&eStore: store.example.com</center>"
      - "&bDiscord: discord.example.com"
    interval-seconds: 300
    target-type: "GROUP"
    targets:
      - "lobby"
    enabled: true
    created-by: "Admin"
    owner-server-id: "lobby-1"
    created-at: 1713500000000
    updated-at: 1713500000000
    version: 1

Versioning ​

Every update increments the announcement version. Deletion also uses a higher version number internally.

Why that matters:

  • remote upserts do not overwrite newer local data
  • remote deletes do not remove newer local versions
  • the plugin can reject stale sync events

This is one of the safeguards against cross-server races.

In-Memory Cache ​

The plugin keeps announcements in memory after loading them from YAML.

The cache is used for:

  • list ordering
  • lookup by UUID or token
  • editor actions
  • scheduler iteration

When you save through the GUI:

  1. the plugin validates the draft
  2. it writes the announcement to storage
  3. it updates the in-memory cache
  4. it publishes a sync event if sync is enabled

Scheduler Behavior ​

The scheduler checks announcements every scheduler.check-interval-ticks.

Important behavior from the source:

  • disabled announcements are skipped
  • a new or edited version resets its next run time
  • the first automatic run happens after the configured interval, not instantly

That means if an announcement interval is 300, the scheduler waits roughly five minutes after create or update before the next automatic broadcast.

Force Broadcast ​

Force broadcasting bypasses the wait for the next scheduled run.

Use:

text
/announcement broadcast <id>

If sync is enabled, other servers receive a force-broadcast event as well.

Reload Lifecycle ​

/announcement reload does more than refresh one file. It:

  • reloads config
  • reloads announcement data from storage
  • refreshes target matching settings
  • refreshes panel formatting settings
  • reconnects or disables sync
  • restarts the scheduler

Because the scheduler restarts, timing expectations should be recalculated after reload.

Lifecycle Summary ​

Create ​

  • stored in YAML
  • cached in memory
  • version starts at 1
  • sync upsert published if enabled

Update ​

  • overwrites stored record
  • version increases
  • cache updates
  • sync upsert published if enabled

Delete ​

  • removed from YAML
  • removed from cache
  • tombstone version stored in memory
  • sync delete published if enabled

This is the operational core of the plugin.

Built with Vue.js and VitePress