package cz.jzitnik.game.threads.list;

import cz.jzitnik.game.annotations.ThreadRegistry;
import cz.jzitnik.game.entities.Player;
import lombok.AllArgsConstructor;

/**
 * A thread that periodically reduces the player's hunger level.
 * Runs continuously, sleeping between hunger drain cycles.
 */
@AllArgsConstructor
@ThreadRegistry
public class HungerDrainThread extends Thread {
    private final Player player;

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(30000);
                player.drainHunger();
            } catch (InterruptedException e) {
                break;
            }
        }
    }
}
