AlexioTTV

create a simple timer mod about the minecraft hotbar. You should toggle it with typing /timer start/pause/stop in the chat

Kodari AI
KodariJun 10 at 12:02 pm 4
HotbarTimer
A lightweight Minecraft plugin that displays a live timer on the action bar (hotbar area). Players can control the timer using /timer start, /timer pause, and /timer stop commands. The timer counts upward in HH:MM:SS format and updates every second. Pausing freezes the current time, resuming continues from where it left off, and stopping resets it entirely.

Plan:

  • HotbarTimer.java — main plugin, registers command + starts tick task

  • TimerManager.java — holds state (running/paused/stopped), tracks elapsed ticks, sends action bar

  • plugin.yml — registers /timer command


How it works:

Command
Action
/timer start
Starts (or resumes) the timer, displays
⏱ 00:00:00
on the action bar
/timer pause
Freezes the timer at its current time with a pause icon
/timer stop
Stops and resets the timer back to zero
  • The timer counts upward in HH:MM:SS format

  • Updates every second via a Bukkit repeating task

  • The action bar message is broadcast to all online players

  • Pausing and re-starting resumes from where it left off

Kodari can make mistakes. Review important code before using.
Files
src
Code
4 181
src/main/java/com/kodari/hotbartimer/HotbarTimer.java
package com.kodari.hotbartimer;

import org.bukkit.plugin.java.JavaPlugin;

public class HotbarTimer extends JavaPlugin {

    private TimerManager timerManager;

    @Override
    public void onEnable() {
        timerManager = new TimerManager(this);
        getCommand("timer").setExecutor(new TimerCommand(timerManager));
    }

    @Override
    public void onDisable() {
        timerManager.stop();
    }

    public TimerManager getTimerManager() {
        return timerManager;
    }
}