solarteamassistant

make a server hud

Kodari AI
KodariJun 29 at 6:05 am 1

I’ll build a fully configurable ServerHUD plugin that displays real-time server info on players’ action bars or boss bars.

ServerHUD
A customizable heads-up display plugin that shows server information like online players, TPS, ping, and world time on the action bar or boss bar. Features per-player toggle, full configurable format with placeholders, and adjustable update interval. Supports both ACTIONBAR and BOSSBAR display types with configurable colors and overlay styles.

All 8 files created. The plugin structure:

  • ServerHUD.java — Main class, initializes managers and registers command/listener

  • ConfigManager.java — Loads and caches config values (interval, format, boss bar settings)

  • HUDManager.java — Core tick loop that formats placeholders and pushes to action bar or boss bar per player. TPS uses Bukkit.getTPS()[0] (1-min average, clamped to 20.0), world time converts to HH:MM format (dawn=06:00, noon=12:00, dusk=18:00, midnight=00:00).

  • HUDCommand.java — /hud toggle (per-player on/off) and /hud reload (op-only config reload)

  • PlayerListener.java — Tracks join/quit to manage per-player state and cleanup boss bars

  • plugin.yml — Command serverhud aliased to hud, permission serverhud.reload

  • config.yml — 20-tick interval, action bar mode with 5 placeholders, boss bar color/overlay/progress options

  • build.gradle — Paper 1.21.1 API, Lombok 8.6, Java 21

Build with gradlew build (requires Paper/Adventure server runtime).

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 368
src/main/java/com/serverhud/ServerHUD.java
package com.serverhud;

import com.serverhud.command.HUDCommand;
import com.serverhud.listener.PlayerListener;
import com.serverhud.manager.ConfigManager;
import com.serverhud.manager.HUDManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class ServerHUD extends JavaPlugin {

    @Getter
    private ConfigManager configManager;

    @Getter
    private HUDManager hudManager;

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.hudManager = new HUDManager(this);

        getCommand("serverhud").setExecutor(new HUDCommand(this));
        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);

        hudManager.start();
        getLogger().info("ServerHUD enabled!");
    }

    @Override
    public void onDisable() {
        if (hudManager != null) {
            hudManager.stop();
        }
        getLogger().info("ServerHUD disabled!");
    }
}