Scoreboard Reload Help!!

Discussion in 'Plugin Development' started by nyanneko0113, Sep 4, 2020.

  1. Offline

    nyanneko0113

  2. Online

    timtower Moderator Moderator

  3. Offline

    nyanneko0113

    Old score? what is old score?

    sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60));

    Is this not good enough?
     
  4. Online

    timtower Moderator Moderator

  5. Offline

    nyanneko0113

    edit code

    Code:
                                String time = String.valueOf(gametime % 60 - 1);
                                sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + time);
                                sc.mob.getScore(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60)).setScore(22);
                                gametime--;
    Is this not good enough..?
     

    Attached Files:

  6. Online

    timtower Moderator Moderator

    @nyanneko0113 That removes the one with the current time.
    Not the one that was previously set.
     
  7. Offline

    nyanneko0113

    Code:
                                gametime--;
                                String time = String.valueOf(gametime % 60 - 1);
                                sc.mob.getScore(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60)).setScore(22);
                                sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + time);

    I don't know... Teach me ;;
     
  8. Online

    timtower Moderator Moderator

    @nyanneko0113 Reset the score before gametime--
    Set it after that.

    Or at least post the entire function so we know what you are doing.
     
  9. Offline

    nyanneko0113

    not work... @timtower

    Code:
                                String time = String.valueOf(gametime % 60 - 1);
                                sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + time);
                                gametime--;
                                sc.mob.getScore(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60)).setScore(22);
                                sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60));

    upload_2020-9-4_19-14-6.png

    Scoreboard reload is success!!! But.. counttime 2 second remove whyy?
     

    Attached Files:

    Last edited by a moderator: Sep 4, 2020
  10. Online

    timtower Moderator Moderator

    Well, can't tell till you post the entire method.
     
  11. Offline

    nyanneko0113

    String time = String.valueOf(gametime % 60 - 1);
    String time2 = String.valueOf(gametime % 60);
    sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + time);
    gametime--;
    sc.mob.getScore(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60)).setScore(22);;
    sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + time2);
    p.setScoreboard(sc.board);

    and Bug

    10:0 stopped

    (task is running)
    Code:
    [22:49:55 INFO]: [Nyanneko0113: Removed objective 'Mob_Attacker' successfully]
    [22:49:56 WARN]: [Mob_Attacker] Task #157 for Mob_Attacker v0.0.1 generated an exception
    java.lang.IllegalStateException: Unregistered scoreboard component
            at org.bukkit.craftbukkit.v1_12_R1.scoreboard.CraftObjective.checkState(CraftObjective.java:112) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at org.bukkit.craftbukkit.v1_12_R1.scoreboard.CraftObjective.getScore(CraftObjective.java:97) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at nyanneko.mob.attacker.commands.StartCommand$2.run(StartCommand.java:68) ~[?:?]
            at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:361) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]

    upload_2020-9-4_22-55-31.png
     
    Last edited by a moderator: Sep 5, 2020
  12. Online

    timtower Moderator Moderator

    @nyanneko0113 You are still only giving parts.
    Full method, full runnable.
     
  13. Offline

    nyanneko0113

  14. Online

    timtower Moderator Moderator

  15. Offline

    nyanneko0113

    not work...

    upload_2020-9-4_23-13-33.png
     
  16. Online

    timtower Moderator Moderator

    @nyanneko0113 What is wrong with it then? Shows the time all right.

    If you want it to do something then please explain what it should be doing step by step. No code.
     
  17. Offline

    nyanneko0113

    (bad english)

    Time Remove

    15:00 → 14: 59 → 14:58 → 14:57
     
  18. Online

    timtower Moderator Moderator

  19. Offline

    nyanneko0113

    why thinking last image..

    I do scoreboard update(reload).
     

Share This Page