Solved Scoreboard Error

Discussion in 'Plugin Development' started by MiniDigger, Oct 16, 2013.

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

    MiniDigger

    Hey guys,
    I am playing around a bit with scoreboards and I get this error, while trying to change the displayname of a objective:
    Code:
    21:10:10 [WARNUNG] [TestPlug] Task #62 for TestPlug v1.0.83 generated an exception
    java.lang.IllegalStateException: Unregistered scoreboard component
            at org.bukkit.craftbukkit.v1_6_R3.scoreboard.CraftScoreboardComponent.checkState(CraftScoreb
    oardComponent.java:13)
            at org.bukkit.craftbukkit.v1_6_R3.scoreboard.CraftObjective.setDisplayName(CraftObjective.ja
    va:43)
            at de.MiniDigger.TestPlug.API.ScrollingScoreBoard$1.run(ScrollingScoreBoard.java:92)
            at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftTask.run(CraftTask.java:53)
            at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftSchedule
    r.java:345)
            at net.minecraft.server.v1_6_R3.MinecraftServer.t(MinecraftServer.java:524)
            at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:227)
            at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:488)
            at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:421)
            at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    
    here are the interesting snippets of my code:
    Code:
    public Scoreboardboard;
    board = Bukkit.getScoreboardManager().getNewScoreboard();
    final Objective obj = board.registerNewObjective("obj", "dummy");
    obj.setDisplayName("TEST");
    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    taskid = Bukkit.getScheduler().scheduleSyncRepeatingTask(
           Main.getInstance(), new Runnable() {
     
           @Override
           public void run() {
           String msg = color + next(this.msg, -1);
           if (msg.length() <= tcolor.length()) {
           obj.setDisplayName(color + idle);
           cancelTask(-1);
           } else {
           index += length;
     
           obj.setDisplayName(msg);//line with the error
           }
           }
           }, 20L * 3, delay);
    
    Thanks for your reply
     
  2. Offline

    thecrystalflame

    If i was you i would make a class that implements Runnable and remove the final modifier of the objective this could be the cause of your problem
     
  3. Offline

    MiniDigger

    thecrystalflame this wasnt the cause. I messed something up in my code. I dont get any errors now but the player dont get the scoreboard displayed now. I am using p.setScoreboard(board);
    EDIT: I think i sloved that too :D
     
  4. Offline

    thecrystalflame

    make sure there is at least one score in the board with a set value.
     
  5. Offline

    MiniDigger

Thread Status:
Not open for further replies.

Share This Page