illegalArgumentsException

Discussion in 'Plugin Help/Development/Requests' started by WesJD, Dec 30, 2014.

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

    WesJD

    The problem here is that when it trys to create a scoreboard objective for said board, illegalArgumentsException is called. I have tried changing the objective name multiple times, though it still refuses to work. Is there anything else that could be going wrong?

    Code:
    Code:
    private static ScoreboardManager manager = Bukkit.getScoreboardManager();
        private static Scoreboard bd = manager.getNewScoreboard();
        private Objective obj = bd.registerNewObjective("rb", "dummy");
    
        public void gameScoreboard(Player p) {
           
            obj.setDisplaySlot(DisplaySlot.SIDEBAR);
            obj.setDisplayName(ChatColor.GOLD.toString() + ChatColor.BOLD + "xBomb Attack");
           
            Score score8 = obj.getScore(ChatColor.GRAY + " Time Left:");
            Score score7;
            if(ScoreboardTasks.secTime < 10) {
                score7 = obj.getScore(ChatColor.RED + "    " + minTime + ":0" + secTime);
            } else {
                score7 = obj.getScore(ChatColor.RED + "    " + minTime + ":" + secTime);
            }
           
            Score score6 = obj.getScore(ChatColor.BLUE.toString() + "");
           
            Score score5 = obj.getScore(ChatColor.RED + " Red" + ChatColor.GRAY + " Lives:");
            Score score4 = obj.getScore(ChatColor.RED + "" + "    " + redLives);
           
            Score score3 = obj.getScore(ChatColor.RED.toString() + "");
           
            Score score2 = obj.getScore(ChatColor.BLUE + " Blue" + ChatColor.GRAY + " Lives:");
            Score score1 = obj.getScore(ChatColor.RED + "    " + redLives);
           
            score8.setScore(8);
            score7.setScore(7);
            score6.setScore(6);
            score5.setScore(5);
            score4.setScore(4);
            score3.setScore(3);
            score2.setScore(2);
            score1.setScore(1);
           
            p.setScoreboard(bd);
        }
    
        public static void clearScores() {
            for(OfflinePlayer slots : bd.getPlayers()) {
                bd.resetScores(slots);
            }
        }
    Error:
    Code:
    net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:458) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at net.minecraft.server.v1_7_R4.DedicatedServer.init(DedicatedServer.java:210) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.a(MinecraftServer.java:290) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.g(MinecraftServer.java:334) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.n(MinecraftServer.java:360) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.enablePlugins(CraftServer.java:394) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugin(CraftServer.java:476) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:417) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at me.Wes.bombattack.Main.onEnable(Main.java:24) ~[?:?]
    30.12 16:29:03 [Server] INFO at me.Wes.bombattack.ExternalHandlers.<init>(ExternalHandlers.java:16) ~[?:?]
    30.12 16:29:03 [Server] INFO at me.Wes.bombattack.ScoreboardTasks.<init>(ScoreboardTasks.java:22) ~[?:?]
    30.12 16:29:03 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:20) ~[spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:40) ~[spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[spigot-1.7.10-R0.1-SNAPSHOT-20140905.jar:git-Spigot-1649]
    30.12 16:29:03 [Server] INFO java.lang.IllegalArgumentException: An objective of name 'rb' already exists
     
  2. Offline

    TheMintyMate

    Why are you doing this?
    Code:
    ChatColor.GOLD.toString()
    
    - Minty
     
  3. Offline

    WesJD

  4. Offline

    teej107

    @TheMintyMate Because a ChatColor is not a String.

    @WesJD Why are you using static improperly? Just remove it. Your error is this:
     
  5. Offline

    WesJD

    @teej107 I know what my error is, but some people here are a bit picky about giving the full stacktrace...

    EDIT: Why was this moved to a different section...?
     
  6. Offline

    TheMintyMate

    @WesJD @teej107
    I guess for the same reason I do this:
    Code:
    player.sendMessage(""+ChatColor.BLUE+ChatColor.BOLD+"epic message here");
    
    - Minty

    Edit: It just makes more sense to put "" instead of calling another method: toString(). Guess it doesn't really make a huge difference... just less to type
     
  7. Offline

    teej107

    If you know what the error is, then do you know how to fix it? The exception reason was quite self explanatory. Your thread was moved to a different section because you are using Spigot.
     
  8. Offline

    WesJD

    @teej107 I don't think you read the OP.
     
  9. Offline

    teej107

    @WesJD I did. And the stacktraces don't lie.
     
Thread Status:
Not open for further replies.

Share This Page