All work

Open source

Compendium: the plugin library under Avicus

The shared Bukkit and BungeeCord library under Avicus, which I worked on from 2016 to 2024: countdowns, boss bars, matchers and translated errors.

Open source · Avicus · 2016 – 2024

The problem

Every Avicus plugin needed the same building blocks: countdowns, boss bars, settings, commands and translated messages. Writing them per plugin meant writing them badly several times.

What I built

Close to 100 commits over eight years, including:

  1. Pluginsubclasses Countdown
  2. Managerstarts a 1 s task
  3. Tickper-player boss bars
  4. Commandscancel or change time
  5. Endmay start the next one

The countdown lifecycle

A sketch of the idea, not the production code.

manager.start(countdown):
    task = CountdownTask(countdown)
    running[countdown] = task
    countdown.on_start()
    task.run_every(20 ticks)              # once a second
    fire(CountdownStartEvent(countdown))

task.tick():
    elapsed += 1
    if remaining() <= 0:
        countdown.on_end(); manager.remove(countdown)
    else:
        countdown.on_tick(elapsed, remaining())

countdown.boss_bar(player) =
    bars.compute_if_absent(player.id, bossBarManager.create(player))   # legacy or modern by protocol

task.set_new_duration(d): elapsed = 0; countdown.duration = d

Why it matters

Atlas’s phases, match start timers and a lot of the network’s other plugins were built on this, so fixing something once fixed it everywhere.

Stack

Links