How to SHOW the player name when he is sneaking?

Discussion in 'Plugin Development' started by ArthurMaker, Dec 2, 2013.

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

    ArthurMaker

    I want to show the player's name when he is sneaking for a minigame.
    Is there any way to do it?
     
  2. Offline

    ISHLCMinecraft

    In the chat or above his head?
    If you want to show it above his head, its impossible.
    For the chat, listen to PlayerToggleSneakEvent and check if the event.isSneaking()
     
  3. Offline

    SourceForums

    ISHLCMinecraft
    He's meaning the above head quite obviously and I'm pretty sure that this is possible.
     
  4. ArthurMaker Instead of looking at how you can make the name be showing you better look at how to capture the sneak packet (PacketPlayOutEntityMetadata I guess) and than check if the datawatcher etc. contains the sneaking part, if so, stop it from being send.(The player will still go slow and will not fall of edges but other players will just see him standing there)
     
  5. Offline

    maxben34

    Packetman to the rescue!
     
    CaptainBern likes this.
  6. Offline

    Garris0n

    Can't you accomplish the same thing by canceling the PlayerSneakEvent?
     
  7. Garris0n Yes but no. Cancelling the sneak event will cause the player itself no longer be able to sneak, and players won't be able to sneak. If you do my way you will still be able to sneak and have the deiserd effect (not falling off blocks) but without others to see you're sneaking.
     
  8. Offline

    Garris0n

    Ah I thought canceling it only prevented other people from seeing the player sneaking.
     
  9. Garris0n Well I've never used the event tho, I'm only assuming that cancelling it will result in no longer being able to sneak :/ (well at the client side you will still see yourself sneaking but I guess the "level of protection" is gone. Wouldn't know though since I've never used it)

    EDIT: Hmm, You may be right, there's a chance the sneaking is client side so the server actually doesn't have to bother about protecting the player, if this is the case then yes, indeed, you're right :)
     
  10. Offline

    Garris0n

    I think the reason it happens is the server can't actually force the client to stop sneaking, so it just stops it server-side, making everybody else see them as standing. I'm not positive either, though.
     
    CaptainBern likes this.
  11. Garris0n Added edit, that's also a possibility :p (reload your page and look at my post)
     
    Garris0n likes this.
  12. Offline

    sgavster

    I know shotbow made it so when you shift it displays to everyone else like you are standing, so probably packets like CaptainBern said
     
  13. Offline

    ArthurMaker

  14. ArthurMaker Wait untill protocollib is updated. Then ping me up.
     
  15. Offline

    ArthurMaker

Thread Status:
Not open for further replies.

Share This Page