Packets and TabList

Discussion in 'Plugin Development' started by TerroDoor, Dec 7, 2019.

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

    TerroDoor

    Hi! I’m executing my /vanish command but nothing is happening. I’m not getting errors but I know it has something to do with my

    packetplayoutplayerinfo

    I’ve just started studying into NMS so I’m by no means experienced in this topic, any tips to help me understand will be much appreciated! Thank you




    Sent from my iPhone using Tapatalk

    Code:
    
     Player p = (Player)s;
     PacketPlayOutPlayerInfo sendpacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER); 
     PacketPlayOutPlayerInfo removepacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER); 
     if (cmd.getName().equalsIgnoreCase("vanish")) {
     if (p.hasPermission("jkits.admin")) {
     p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999, 1, false, false)); 
     ((CraftPlayer) p).getHandle().playerConnection.sendPacket(sendpacket);
     p.sendMessage(ChatColor.GREEN + "you have vanished");
     } else {
     p.sendMessage(ChatColor.RED + "You do not have permission!");
     }
    
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 8, 2019
  2. Offline

    KarimAKL

  3. Offline

    TerroDoor

  4. Offline

    KarimAKL

    @TerroDoor I've never tried this so i don't have any idea about how it's done, hopefully someone else can help.
     
  5. Offline

    TerroDoor

    If I just use hidePlayer, are they also invisible?


    Sent from my iPhone using Tapatalk
     
  6. Offline

    timtower Administrator Administrator Moderator

    Yes, yes they are invisible then.
     
  7. Offline

    TerroDoor

    I resolved this using PacketPlayOutPlayerInfo using the .REMOVE_PLAYER method and casting it to all the online players and it’s working great.

    Although when the player dissapears on tab, it has a small black line imprinted on the tablist, is that because it’s “empty” being that I’m the only player on the server?


    Sent from my iPhone using Tapatalk
     
  8. Offline

    KarimAKL

    @TerroDoor Probably; you can test it if you have another account, or some friends that can test it with you.
     
    TerroDoor likes this.
Thread Status:
Not open for further replies.

Share This Page