Making custom scoreboard objective on player list

Discussion in 'Plugin Development' started by ToldiIII, Nov 25, 2018.

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


    I started creating a custom scoreboard objective that displays the health level, ping or a customized interval on the tab. Instead, I do not want to use a scoreboard team or a simple scoreboard, because it has a problem, for example, if I give the placeholder the level of the player's experience (interval markup), but this throws IllegalArgumentException to the server console. This is inappropriate, so I would like to use the custom scoreboard object.
    I've looked at each page what it should, but it did not help. Here is the code I started:
    try {
        Object newPacketObj = Class.forName("net.minecraft.server." + version + ".PacketPlayOutScoreboardObjective").getConstructor().newInstance();
        Class<?> newPacketScore = Class.forName("net.minecraft.server." + version + ".PacketPlayOutScoreboardObjective");
    } catch (Exception e) {
    Example images what I want:

    Last edited: Nov 26, 2018
  2. What's the IllegalArgumentException? Also, I do not see what you are trying to do with your code. It would be much simpler if you just wrote using the Bukkit scoreboard system, made a new objective, that assigned values to those objectives. Please, post the IllegalArgumentException
  3. Offline


    As I said, the Bukkit objects are not correct because not work the way they should. For example: if I set the health object with Bukkit and update it in the game then I get the result:

    With the custom packets, I get the opposite of that. That is, it works normally.

    This error:
    Show Spoiler

    [09:08:21 WARN]: [MyPlugin] Task #54906 for MyPlugin v3.7 generated an exception
    java.lang.IllegalArgumentException: Entry cannot be longer than 40 characters!
    at org.bukkit.craftbukkit.v1_13_R2.scoreboard.CraftObjective.getScore( ~[patched_1.13.2.jar:git-Paper-461]
    at ~[patched_1.13.2.jar:git-Paper-461]
    at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftScheduler.mainThreadHeartbeat( ~[patched_1.13.2.jar:git-Paper-461]
    at net.minecraft.server.v1_13_R2.MinecraftServer.b( ~[patched_1.13.2.jar:git-Paper-461]
    at net.minecraft.server.v1_13_R2.DedicatedServer.b( ~[patched_1.13.2.jar:git-Paper-461]
    at net.minecraft.server.v1_13_R2.MinecraftServer.a( ~[patched_1.13.2.jar:git-Paper-461]
    at ~[patched_1.13.2.jar:git-Paper-461]
    at Source) [?:1.8.0_192]

    The code is visible in the post above because it is the path of the error.
    TheEnderCrafter9 likes this.
Thread Status:
Not open for further replies.

Share This Page