How do I make a player appear to be sleeping to other players?

Discussion in 'Plugin Development' started by pie_flavor, Apr 27, 2015.

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

    pie_flavor

    Title says it all.
     
  2. Offline

    Totom3

    You have to send the packet manually. First of all you'll need to build against CraftBukkit or Spigot Server, depending on which one you are using.

    - How to send a Packet:
    Code:
    Packet packet = [....];
    Player player = [...];
    
    ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
    - The packet you will need to send to make clients think a player is sleeping is the Use Bed packet. Send it to all nearby players EXCEPT the one supposed to be sleeping (if I read correctly it will put him in sleep mode for real).
     
  3. Offline

    rbrick

    @Totom3 He could always use reflection to remove the dependency on CraftBukkit/Spigot :p
     
  4. Offline

    RawCode

    version barrier for a reason.
    if you think that removing safety measures is good plan, start from replacing fuses in your house with steel nails.
     
    rbrick and Avygeil like this.
  5. Offline

    pie_flavor

  6. Offline

    nverdier

     
    Totom3 likes this.
  7. Offline

    pie_flavor

    @nverdier Yes, but where is that in ProtocolLib? When I try it crashed the player D:
     
  8. Offline

    Totom3

    @pie_flavor What do you mean in ProtocolLib? You don't even need ProtocolLib for this but if you still want to use it, create a PacketContainer, edit it to your needs (check out the wiki), and then send it with PacketContained#send(Player). You just said you knew about packets?
     
  9. Offline

    Koobaczech

    lol. pie_flavor said All your packets are belong to ProtocolLib
     
  10. Offline

    Sabersek

    @pie_flavor
    Sounds like you're doing something interesting ;)
     
Thread Status:
Not open for further replies.

Share This Page