Hiding Player's Item Hand Packet?

Discussion in 'Spigot Plugin Development' started by Nosmakos, Apr 14, 2017.

  1. Hello guys i was wondering if there is a packet to hide the players item hand and then un-hide the hand. I am having a sniper with a target and i can see the sniper on players item hand that's why i want to hide it. So when player is zooming, the weapon will be in his hands but it will be hidden for him by the packet and when he unzoom, he will be able to see the sniper again.

    #1 Nosmakos, Apr 14, 2017
    Last edited: Apr 14, 2017
  2. Client side invisibility when you want to hide the hand? Oh nvm, you want to hide the item.

    Maybe get rid of the item in the hand then invisibility the hand (with HideParticles as a true boolean)
    Then when you get out of scope, you get it back to normal
  3. You mean hideParticles will hide the player item in the hand? I actually don't want to hide the hand but only the weapon. But i don't want to remove it from players hand because if he is shooting, other players will say "how is he shooting without a weapon"
  4. Maybe this would help...

    On enter scope:
    - Remove item from hand
    - Send packet of invisibility with hideparticles true (so there are no particles and you can't see the empty hand)

    On exit scope:
    - Give player sniper item.
    - Send a packet to remove the invisibility.

    Hideparticles does not remove the item in hand. I just added that so that it would not show any particles.
    You remove the item from the hand and give them invisibility.

    If you don't know what item a player has when a player gets out of a scope and needs the item, add them to a hashmap with a <UUID,GunTheyHad>
    or an array list if only 1 gun has a scope.

    Apparently the packet "PacketPlayOutEntityEffect" sends a potion effect to the entity.
  5. Ι know what do you mean but by removing the item in the hand the other player can see that he is not having a weapon on his hands right? i mean if it does that, it's not worth to use this weapon because, you can't shoot without having a weapon on your hands and it won't look so good. So i want in a few ways to hide the item on the hand like hiding a player.
  6. That's why you use the hashmap to keep track of which gun they are scoping with. Like @MCGamer00000 mentioned.
  7. Yeah i know how to do that with the hashmap but since you are removing it from players hand the sniper, his hands won't have anything since he unzoom again right?
  8. Once he unzooms you'll remove him from the hashmap, make him visible, and give him the item back
  9. Although this way may mean that others won't be able to tell if he's holding a sniper while he's scoped in.
  10. Possibly a client side setslot packet? So only he thinks he doesn't have a gun while scoping. As for the hashmap you could test on the shoot interact if he is in the hashmap, then get the gun that is in the hashmap if he is in it
  11. The only other thing I could think of is a gamemode packet making it seem like the player is in spectator mode (while scoping). This would hide the item, but the only possible downside is that it would also hide the hotbar I believe.
  12. Uhh, you could try out a trick with the attack speed attribute; setting the value to less than -5 should make the item disappear in first person mode, but will show up normally to everyone else - and the player, too, if he/she happens to be in third person mode.
    EDIT: 1.9+.
    • Informative Informative x 2
  13. Those "flaws" seem perfect to me. Would be odd if the sniper vanished from space and time when the player is simply scoping.
  14. Well what you can do is make so you cant see your self when scoping that way people will see you but you wont see you which will also make your gun invis..


    p = Whoscoped;


    p = whoexist scope;

    This should work
  15. The hiding works using a "hacky" (though stable) way by sending player despawn packets. It works for other players but could cause problems when sending it to the player themself.
  16. I mean your probably right .. Is there a way for me to read about all the packages ive been serching around and almost everyone tells me that i have to decomplie minecraft.. Isnt there a list of all the packages etc?=
  17. There's a list of actual packets here:
    Note that this page contains actual packet data, which differs from the Minecraft source. The latter often has custom classes or enums that are serialized into and deserialized from the target data.
  18. So the best way to doing it is by:
    I guess third person mode is adventure? and also what he meant by saying setting the value of attack speed less than -5? how i can set that?
  19. First person shooter, third person other things? It's when you're able to look at yourself.
    Using the bukkit attributes API added in 1.9 you can set the player's attack speed (or a little more advanced to apply it to the item)
  20. Hmmm so this could work? but i have a question. I have a texturepack by a server, they uploaded this texturepack on their server website a half year ago and i went to their server and i scoped with their sniper. The gun wasn't there like my picture but when i did 3rd person and i could look at my self, the weapon was there and also other people could see it too. So my question is, how he did that?