Which packet is used for sneaking

Discussion in 'Plugin Development' started by matejdro, Feb 23, 2012.

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

    matejdro

    Which packet should I send to players that they will see other player sneaking (and no names through walls)?

    I don't want to do it with player.setSneaking(), because then it will trigger plugins like NoCheat and player would have troubles (keep being teleported back for moving too fast for sneaking).
     
  2. http://mc.kev009.com/Protocol#Entity_Metadata_.280x28.29
    0x28, Entity Metadata. In the linked Entity page, you can see that the metadata for crouching is 0x02. I didn't research/test wether the packet involves more magic with byte values, it might be fine by just sending 0x02. If you are unlucky you have to send it combined with all other current metadata effects (there's probably a native way to build such a value).
     
  3. Offline

    matejdro

  4. Oooh, I see, that was the packet which used the DataWatcher. Sorry, I'm no expert at that.
    Consider reading this thread, it's about the same packet (even though for another purpose - potion effects):
    http://forums.bukkit.org/threads/how-to-create-the-swirly-particle-potion-effect.55988/
    You might be able to just set the value of the datawatcher, but I've no idea if that effects the actual entity as well or just the networking. Oh, and about everything there is obfuscated. Maybe ask bergerkiller ;-)
     
  5. Offline

    nisovin

    First, when you try to do stuff like this, you have to understand that you will probably not get much help figuring it out. You need to be willing and able to dig through and understand raw server code. If you can't do this, you probably shouldn't attempt something like this.

    Second, since you're basically trying to enable cheating anyway (you're trying to get some of the advantages of sneaking without sneaking, which is obviously "cheating"), it seems like it'd be much easier to just disable this feature of NoCheat. Then you could do it the easy way.

    Third, that packet (and the data watcher) can be somewhat annoying. Here is some stuff for you to look at:
    http://wiki.vg/Entities
    https://github.com/Bukkit/CraftBukk...n/java/net/minecraft/server/Entity.java#L1295
    https://github.com/Bukkit/CraftBukk...n/java/net/minecraft/server/Entity.java#L1315
     
  6. Offline

    matejdro

    I want to "enable cheating" only for specified players in specified time at specified place, so disabling NoCheat globally is not going to help.

    Also, even vanilla minecraft sometimes throws player moved wrongly and move him back, so even disabling NoCheat would not work

    I will take a look at this packet stuff.

    I give up, this thing is just too complicated.

    I have solved problem by simply giving people nocheat.checks.moving.sneaking permission until they need it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
Thread Status:
Not open for further replies.

Share This Page