Solved Making Armor Invisible

Discussion in 'Spigot Plugin Development' started by ItsCon, Sep 12, 2019.

Thread Status:
Not open for further replies.
  1. Hello everyone I am trying to make an ability that makes a player invisible with their armor invisible as well. I've looked into hidePlayer but I don't want the hidden player to be invincible and I think that's true when this method is used. I've also looked into packets but I'm still new to them so it's really confusing to me right now. If someone could guide me in this process I would be very grateful!
     
  2. If don't want to publish the plugin and want a low effort method:
    Use another vanish plugin and just hide the player via command or API.

    Packets is the only way to go here.
     
  3. If packets are the only way to go then can you help me understand what to do?
     
  4. Can anyone help me with this?
     
  5. the link I posted shows you
     
  6. It's just code it doesn't explain anything. Can you explain it to me please?
     
  7. I really don't know if make a invisible armor is possible, you search about if is possible?
     
  8. It's definitely possible. I believe I have to send empty packets that make it seem like a player doesn't have armor on and make them invisible as well. I just don't know how to do this exactly.
     
  9. Try something like this:
    Code (Java):

    Player player = ... ; // Get the player wearing the armor here

    PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(
      player.getId(), EnumItemSlot.CHEST, new ItemStack(null)); // Do the same for other parts

    for (Player otherPlayer : player.getWorld().getPlayers()) {
      PlayerConnection conn = ((CraftPlayer) otherPlayer).getHandle().playerConnection;
      conn.sendPacket(packet); // Also send packets for other parts
    }
     
     
    #11 arboriginal, Sep 17, 2019
    Last edited: Sep 17, 2019
  10. Nope: Player#hidePlayer
     
  11. This will not hide the armor, only the player...
     
  12. It had the player and the armor because the server tell there is no Player
     
  13. Thank you! Do you know how I could make the armor visible again?
     
  14. I'm pretty sure this method makes the player invincible and I want the hidden player to be damageable.
     
  15. Resend a PacketPlayOutEntityEquipment packet with an ItemStack corresponding to equipments the player wears.

    Something like that:
    Code (Java):

    new PacketPlayOutEntityEquipment(
      player.getId(),
      EnumItemSlot.CHEST,
      CraftItemStack.asNMSCopy(player.getEquipment().getChestplate()));
     
     
  16. Ok thanks I'll try some things out.
     
Thread Status:
Not open for further replies.