decreases more than once when it should decrease one by one

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

Thread Status:
Not open for further replies.
  1. Offline

    Konyalimmm

    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 =
    at org.bukkit.configuration.file.FileConfiguration.save(FileConfiguration.java:65)
    [16:13:39] [Timer-130/WARN]: at org.bukkit.plugin.java.JavaPlugin.saveConfig(JavaPlugin.java:170)
    [16:13:39] [Timer-130/WARN]: at kitpvp.tabela.Tabelalar$1.run(Tabelalar.java:58)
    [16:13:39] [Timer-130/WARN]: at java.util.TimerThread.mainLoop(Unknown Source)
    [16:13:39] [Timer-130/WARN]: at java.util.TimerThread.run(Unknown 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(Serializer.java:121)
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.serializer.Serializer.serialize(Serializer.java:110)
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:276)
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.Yaml.dumpAll(Yaml.java:243)
    [16:13:58] [Timer-115/WARN]: at org.yaml.snakeyaml.Yaml.dump(Yaml.java:220)
    [16:13:58] [Timer-115/WARN]: at org.bukkit.configuration.file.YamlConfiguration.saveToString(YamlConfiguration.java:41)
     
    Last edited by a moderator: Apr 3, 2022
  2. Offline

    Strahan

    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

    Dai_Kunai

    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?
     
Thread Status:
Not open for further replies.

Share This Page