# Internal Systems


#

Config Updater

The ConfigUpdater runs on every plugin startup to ensure configuration files are up-to-date.

Version tracking: A .config-version file stores the last applied config version. When the plugin version changes, the updater runs.

Update process:

  1. Create a timestamped backup of the old file in backups/
  2. Delete the old file
  3. Copy a fresh version from plugin resources
  4. Merge user's custom values back onto the fresh file

Backup cleanup: Only the 10 most recent backups are kept.


#

Update Checker

The update checker runs asynchronously on startup, checking GitHub for new releases.

  • Source: XPaladiumyX/PremiumAdvancements-Releases
  • Version comparison: Normalized semantic versioning (strips v prefix, compares numerically)
  • Notification: If a newer version is found, a colorful banner is displayed in the console with the current and latest version numbers and a download link.

#

Trigger Service Internals

The TriggerService class processes all advancement triggers and manages completion logic.

# Processing Pipeline

Event received
  -> Check permission (skip if not met)
  -> Check world restriction (skip if wrong world)
  -> Check prerequisites (skip if not met)
  -> Check DB for existing completion (skip if done)
  -> If amount <= 1: complete immediately
  -> Else: increment progress in-memory
    -> Sync progress with UltimateAdvancementAPI
    -> Show action bar on update
    -> When progress >= required: complete

# Completion Pipeline

Complete advancement
  -> Grant via UltimateAdvancementAPI
  -> Increment database asynchronously
  -> Play completion sound
  -> Broadcast if enabled
  -> Give all reward types (commands, items, money, permissions, points, pools)
  -> Send Discord webhook asynchronously
  -> Re-check dependent/hidden advancements
  -> Notify player of new hidden advancement unlocks

# Cooldown System

A 2-second location-based cooldown prevents duplicate triggers from the same player at the same location. This is used for triggers that can fire multiple times per second (e.g., BREAK_BLOCK, DAMAGE_DEALT).

# Hidden Advancement Unlock

When any advancement is completed, the service re-checks all advancements that depend on it. If a hidden advancement's prerequisites are now fully met, the player receives an unlock notification and the advancement becomes visible.


#

PLACEHOLDER Trigger Checker

A repeating task runs every 30 seconds (600 ticks) checking all PLACEHOLDER-triggered advancements for all online players. For each player, it resolves the placeholder via PlaceholderAPI and compares the result using the configured operator and value. If the condition matches and the player hasn't already completed it, the advancement is granted immediately via forceComplete.

# MANUAL Trigger

The MANUAL trigger has no event listener and no periodic checker. It can only be completed via /padv give <player> <advancement>. This makes it ideal for server-controlled rewards (rankups, events, shop purchases).