Making A Player Sleep With Packets

Discussion in 'Plugin Development' started by thok13, Nov 3, 2013.

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

    thok13

    So I'm making a vampire plugin and I want to let the vampires sleep during the day. I found you can do this with packets:
    Code:java
    1. ((CraftPlayer) p).getHandle().playerConnection.sendPacket(new Packet17EntityLocationAction(((CraftPlayer) p).getHandle(), b.getX(), b.getY(),b.getZ()));

    This works fine, however the player cannot exit the bed. I almost never work with packets, so some help would be appreciated :3

    Could I get some help?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  2. Offline

    _Filip

    Get them out of the bed when they right click.
     
  3. Offline

    thok13

    How?

    Like teleport them? or is there a different packet or something?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  4. thok13 You need to send a Packet18ArmAnimation, set the 'a' field to the player entity id and set the 'b' field to 3.
     
  5. Offline

    thok13

    I did the following in the PlayerLeaveBedEvent:
    Packet18ArmAnimation pa = new Packet18ArmAnimation();
    pa.a = p.getEntityId();
    pa.b = 3;
    ((CraftPlayer) p).getHandle().playerConnection.sendPacket(pa);
    however it doesn't seem to work.
     
  6. thok13 Hmm weird... I use that in my AnimationLib and it works tho :/ . (I am currently rewritting the lib so if you are interested in using it, just tell me so I can ping you when it is done :p)
     
Thread Status:
Not open for further replies.

Share This Page