1.17.x Tablist | PacketPlayOutScoreboardTeam dont work

Discussion in 'Spigot Plugin Development' started by Onyxzium, Jul 13, 2021.

  1. Hello guys,
    I tried to update my plugins to 1.17 but then I got a problem with the class changes.
    Before the 1.17 I did it like that:


    Code (Text):
    private void update() {
            for (Player all : Bukkit.getOnlinePlayers()) {
                if (!scoreboard.getTeam(teams.get(all.getUniqueId())).getPlayerNameSet().contains(all.getName())) {
                    scoreboard.getTeam(teams.get(all.getUniqueId())).getPlayerNameSet().add(all.getName());
                }

                for (int i = 20; i > -1; i--) {
                    sendPacket(new PacketPlayOutScoreboardTeam(scoreboard.getTeam(teams.get(all.getUniqueId())), i));
                }
            }
        }

        private void sendPacket(Packet<?> packet) {
            for (Player all : Bukkit.getOnlinePlayers()) {
                CraftPlayer player = (CraftPlayer) all;
                player.getHandle().playerConnection.sendPacket(packet);
            }
        }
    But since the 1.17 this doens't work anymore...
    sendPacket(new PacketPlayOutScoreboardTeam(scoreboard.getTeam(teams.get(all.getUniqueId())), i));
     
  2. PacketPlayOutScoreboardTeam 1.17 path. This is net.minecraft.network.protocol.game.PacketPlayOutScoreboardTeam.
     
  3. Sweet cat, But still dont work :/[​IMG]
     
  4. The scoreboard variable import seems to be wrong.
     
  5. Well, that worked in the older versions, but since 1.17 it doesnt work anymore
     
  6. There are some static methods in PacketPlayOutScoreboardTeam to create packets. Maybe these will help you
     
  7. Well, .a could work but[​IMG]
     
  8. Have you found a solution for this?
     
  9. Player connection is no Longer ((CraftPlayer)player).getHandle().playerConnection.sendPacket(). it is now ((CraftPlayer)player).getHandle().b.sendPacket()