Search code examples
javaserverminecraftbukkitspigot

Customizing the TabList with Bukkit 1.8


I'm working on a UHC Minecraft plugin with Bukkit API 1.8

I'm looking to modify the TabList (Player List) to display the Plugin name and credits (and potentially the player's kill count if possible)

Searching on the internet I found this fill : https://bukkit.org/threads/custom-player-lists-create-your-own-tab-list-display.429333/

Unfortunately, this method regularly crashes my server when players open the TabList.

I get this Error :

[22:53:51 WARN]: java.lang.NoSuchMethodException: com.mojang.authlib.properties.PropertyMap.removeAll(java.lang.String)
[22:53:51 WARN]:        at java.lang.Class.getDeclaredMethod(Unknown Source)
[22:53:51 WARN]:        at fr.av.codelyokouhc.ReflectionUtil.getMethod(PlayerList.java:934)
[22:53:51 WARN]:        at fr.av.codelyokouhc.ReflectionUtil.invokeMethod(PlayerList.java:804)
[22:53:51 WARN]:        at fr.av.codelyokouhc.ReflectionUtil.invokeMethod(PlayerList.java:781)
[22:53:51 WARN]:        at fr.av.codelyokouhc.PlayerList$1.callBack(PlayerList.java:513)
[22:53:51 WARN]:        at fr.av.codelyokouhc.Skin$3$1.run(PlayerList.java:1129)
[22:53:51 WARN]:        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
[22:53:51 WARN]:        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350)
[22:53:51 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723)
[22:53:51 WARN]:        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
[22:53:51 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654)
[22:53:51 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557)
[22:53:51 WARN]:        at java.lang.Thread.run(Unknown Source)

With this code :

PlayerList list = new PlayerList(p, PlayerList.SIZE_FOUR);
list.initTable();

list.setHeaderFooter("§bPlugin UHC", "§ePlugin by Av32000\n   With the help of  \n RedFly32   ");

Here is the content of the Player List : Playerlist.java


Solution

  • You need to add NMS and Mojang Authlib to the dependcy

    Here is a simple solution for you: Typing this instead of spigot-api adds both

    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot</artifactId>
        <version>VERSION</version>
        <scope>provided</scope>
    </dependency>