decreases more than once when it should decrease one by one

Discussion in 'Plugin Development' started by Konyalimmm, Apr 3, 2022.

  1. Offline


    Ekran Görüntüsü (44).png

    saniye = seconds, I used playerinteractevent, it worked, but I want "saniye" (second) to decrease one by one, it decreases very quickly.
    my main goal is to make a countdown timer

    error =
    [16:13:39] [Timer-130/WARN]: at
    [16:13:39] [Timer-130/WARN]: at kitpvp.tabela.Tabelalar$
    [16:13:39] [Timer-130/WARN]: at java.util.TimerThread.mainLoop(Unknown Source)
    [16:13:39] [Timer-130/WARN]: at Source)
    [16:13:58] [Timer-115/WARN]: Exception in thread "Timer-115" java.lang.NullPointerException
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.serializer.Serializer.anchorNode(
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.serializer.Serializer.serialize(
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.Yaml.dumpAll(
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.Yaml.dumpAll(
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.Yaml.dump(
    [16:13:58] [Timer-115/WARN]: at org.bukkit.configuration.file.YamlConfiguration.saveToString(
    Last edited by a moderator: Apr 3, 2022
  2. Offline


    Is there some specific reason you are using the config to track your timer? Constantly writing to disk is resource expensive. You should be using an in memory counter. Also I'd be using a BukkitRunnable, not TaskTimer.
  3. Offline


    Yeah it should be okay to save it to the YamlConfiguration, but don't save that to the file until later if you even need that timer to stay between server restarts.

    So does your timer require you to save that timer even when the server shuts off, or does it reset?

Share This Page