Skip to content
Aithor Dev

Scheduled Tasks

On this page

Scheduled Tasks

NationCore runs a set of repeating tasks. This page lists all of them, what they do, and how expensive they are.

The task table

Interval Task Notes
1 minute Election phase checks All Republic nations plus the legacy global election
1 minute Recall petition status Phase transitions and deadlines
1 minute Communist party elections, tax phases and free-food distributions The loop is cheap: each manager knows its own interval and skips when it has not elapsed
1 minute Monarchy royal tax phases and alms distributions Same pattern
1 minute Caliphate Jizya phases and Zakat distributions Same pattern
1 minute Executive order expiry Deactivates and announces expired orders
1 minute Office decision expiry Removes expired decision effects
1 minute Land-permit sweep Lapses stale applications, prunes settled ones. Runs on the main thread because expiring a request can message the applicant
1 minute Playtime accumulation Adds one minute to every online player. A crash-safe fallback in addition to quit-time tracking
1 minute Tax tick Escalates invoice statuses, seizes national debt, checks whether a billing cycle is due
5 minutes Campaign message broadcasts Only during the Campaign phase
30 seconds Research tick Completes any project whose duration has elapsed
1 hour Politburo salaries Pays a member once 7 real days have passed since their last stipend
1 hour High Council salaries Same
5 minutes Save all data Runs asynchronously
10 ticks (~0.5 s) Border particle rendering Only for nations with borders toggled on, and only near online players
1 second Live-map heartbeat Checks two flags and returns almost immediately when idle
refresh.interval-seconds Live-map scan Fingerprints nations; only changed nations are re-rendered, and rendering happens off-thread
24 hours Tax billing cycle Issues one invoice to every active nation member, then bills NPCs

Cost profile

Most of these are cheap "is it time yet?" checks that return immediately. The ones worth knowing about:

Task Cost Mitigation
Tax billing cycle Scales with player count Runs once a day; long-offline players are skipped
Border rendering Scales with toggled-on nations near players Culled by distance, throttled, never touches unloaded chunks
Live-map scan Scales with nation count Main thread only fingerprints; all heavy work is off-thread, and a new scan never starts while a render runs
Data saving Scales with total data Runs asynchronously

What runs where

Thread Tasks
Main server thread Everything that touches world or player state: elections, taxes, orders, decisions, research, permits, border particles, live-map scanning
Async Data saving
Live-map worker Border tracing into polygons, popup HTML building, marker construction

Startup and shutdown

On enable, in order:

  1. Configuration and language are loaded.
  2. Vault is hooked (the plugin disables itself if this fails).
  3. All managers are constructed.
  4. Integration bridges are created.
  5. Data is loaded from disk.
  6. Commands and listeners are registered.
  7. Scheduled tasks are started.
  8. The squaremap integration is enabled β€” after data loading, so the first render is complete.
  9. PlaceholderAPI is hooked if present.
  10. The splash screen is printed.

On disable:

  1. The squaremap integration is disabled β€” its layers and icons are removed from the map.
  2. The border visualiser is stopped.
  3. All data is saved.

Tuning

The only interval exposed in configuration is the live map:

YAML
integration:
  squaremap:
    refresh:
      interval-seconds: 10      # min 2, max 600
      instant-territory-updates: true

Everything else is fixed. See Performance and Tuning for what to do if a task is costing you.

Search documentation

    Type to start searching.