Tablist not updating

Discussion in 'Spigot Plugin Development' started by DotRar, Jun 1, 2017.

  1. I'm trying to order a tablist. I have it ordered, in a list called newData. However packet.setData(newData); (
    WrapperPlayServerPlayerInfo#setData) does not set the tablist to be in this order, it still stays in login order. Do I need to do anything extra?
     
  2. Made this tutorial about tablists and there is written why your plugin doesn't keep the order.
    The order is defined by the entity name, not the display name. To change the order you need to create custon entities with order names (00, 01, 02) and set there tablistName. There is no other way because ordering is done by the client, not the server!

    The link to the tutorial
    https://www.spigotmc.org/threads/custom-tab-list-icons.244687/
     
  3. How do I set the tablist name
     
  4. Use
    Code (Text):
    player.listName =  = new ChatComponentText(listName);
    The player has to be a EntityPlayer instance!
     
  5. Yeah I saw that a few minutes later. Got everything working, thanks :)
     
  6. Code (Text):
    EntityPlayer[] playersNMS = new EntityPlayer[Bukkit.getOnlinePlayers().size()];
                    Player receiver = e.getPlayer();

                    int current = 0;
                    for (Player player : Bukkit.getOnlinePlayers()) {
                        playersNMS[current] = ((CraftPlayer) player).getHandle();
                        current++;
                    }

                    PacketPlayOutPlayerInfo removePacket = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, playersNMS);

                    ((CraftPlayer) receiver).getHandle().playerConnection.sendPacket(removePacket);
    This code seems to crash the server
     
  7. I think i know what your problem is.... Thr nms and craft classes are in a package that contains the version of spigot. Every release this package is different and the imports are different. You could solve this by using the same jar or maven version for developing as for your server. You could also use reflect and wrappper classes. There are many tutorials about that. If that is not the problem, could you post the error log.
     
  8. The server is running some version of 1.8 (not sure which) and the plugin is compiled with 1.8.8. Does this still matter?
     
  9. If it is NOT the exact same release, yes it matters. The packages of nms look like:
    Code (Text):
    net.minecraft.server.version_release
    for example
    Code (Text):
    net.minecraft.server.v1_11_R1
    That R1 is the problem. If you compiled using release 1 and you run using release 2 is is different. Try running and compiling it with the exact same jar file.

    Could you post your error log? It woul just be usefull.
     
  10. Code (Text):
    [Server thread/ERROR]: [TabListSorter] Unhandled exception occured in onPacketSending(PacketEvent) for TabListSorter
    java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextNode(Unknown Source) ~[?:1.8.0_131]
        at java.util.HashMap$KeyIterator.next(Unknown Source) ~[?:1.8.0_131]
        at com.perkelle.dev.tablistsorter.Core$1.onPacketSending(Core.java:46) ~[TabListSorter.jar:?]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:608) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:584) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.ProtocolInjector.packetQueued(ProtocolInjector.java:309) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.ProtocolInjector.onPacketSending(ProtocolInjector.java:269) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:396) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.ChannelInjector.access$500(ChannelInjector.java:77) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.ChannelInjector$5.handleScheduled(ChannelInjector.java:362) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.ChannelInjector$5.onMessageScheduled(ChannelInjector.java:330) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:127) [ProtocolLib.jar:4.2.1]
        at com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:95) [ProtocolLib.jar:4.2.1]
        at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:192) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.NetworkManager.handle(NetworkManager.java:141) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.PlayerConnection.sendPacket(PlayerConnection.java:907) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.PlayerList.sendAll(PlayerList.java:880) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.PlayerList.tick(PlayerList.java:872) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:818) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-db6de12-18fbb24]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
    [16:11:07] [Server thread/ERROR]: Parameters:
      [email protected][
        a=UPDATE_LATENCY
        b=[PlayerInfoData{latency=4, gameMode=SURVIVAL, [email protected][id=6162b37f-e534-4134-8282-eb5986219845,name=MrGreenJam,properties={textures=[[email protected]]},legacy=false], displayName=null}, PlayerInfoData{latency=3, gameMode=SURVIVAL, [email protected][id=b361d7b5-7f3a-4cfc-a062-0fbe29f00916,name=LMNTS,properties={textures=[[email protected]]},legacy=false], displayName=null}, PlayerInfoData{latency=1, gameMode=SURVIVAL, [email protected][id=9d030c15-9f31-444c-bc41-9a88aa18731d,name=FireFlies,properties={textures=[[email protected]]},legacy=false], displayName=null}]
      ]
     
  11. Same bit of code is giving a stack overflow exception now
     
  12. This is an error from protocol lib. Try it without protocol lib enabled. That might work.

    Also ask the developers of protocol lib if they know what it is.