Force a player to get in a bed.

Discussion in 'Plugin Development' started by vasil7112, Mar 1, 2013.

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

    vasil7112

    So, what i want actually is to force a player to get into a bed.
    Ways to use it, i am looking to make a sleep in the morning option for my plugin, but i can't do it if i can't force my players to sleep on morning
     
  2. Offline

    Tirelessly

    I was trying to do this before, I couldn't get it working before I got arrested though..
     
  3. Offline

    vasil7112

    What you mean by saying you got arrested?
    Is it illegal to modify the direct mc gameplay?:D
     
  4. Offline

    Tirelessly

    "Forcing someone into bed" is frowned upon by the law.

    Its a rape joke
     
    microgeek likes this.
  5. Offline

    vasil7112

    Oh lol:D, i now got ya:p
     
  6. Offline

    Technius

    vasil7112
    I don't think you can do this without client mods..
     
  7. Offline

    RealDope

    You can do it with packets and such. There's plugins that have done it.
     
  8. Offline

    iWareWolf

    NoCheat I believe uses Bed Packets to cancel out flying hacks.
     
  9. Offline

    vasil7112

    May i know which plugins?

    Can you explain please how packets work? Or even give a tutorial?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  10. Offline

    stirante

    Send new Packet17Sleep(((CraftPlayer)player).getHandle(), 0, bedX, bedY, bedZ)

    http://i.imgur.com/4E3nm.gif xD
     
    Alex5657 and iWareWolf like this.
  11. Offline

    vasil7112

    Can you please explain how do i use it?
    An example would be great.
     
  12. Offline

    stirante

    ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet17Sleep(((CraftPlayer)player).getHandle(), 0, location.getBlockX(), location.getBlockY(), location.getBlockZ()));
     
  13. Offline

    vasil7112

    Do i need to include any extra lib? Because i have problems with the CraftPlayer and Packet17Sleep
     
  14. Offline

    stirante

    CraftBukkit instead of bukkit
     
  15. Offline

    Tomskied

    Buy a gun
     
  16. Offline

    Lolmewn

    How is this relevant again?
     
  17. Offline

    Tirelessly

    Rape jokes wooh
     
  18. Offline

    vasil7112

    Still the same problem:(
    CraftPlayer cannot be resolved to a type

    Hey there, because you are bukkit stuff, you might know about packet sending. May you help me with this problem?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  19. Offline

    Lolmewn

    I have close to no knowledge of that. Sorry.
     
  20. Offline

    vasil7112

    Alright, thanks though:)

    bump

    Packet17Sleep doesn't exist on import net.minecraft.server.v1_4_R1.....

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  21. Offline

    stirante

    Sorry, It's class name from MCP code. In craftbukkit code it's Packet17EntityLocationAction.
     
  22. Offline

    vasil7112

    Oh ok
    thanks alot, i will try it when i have time. I was trying Packet70Bed :D

    May you add me on skype incase i need help? (vasil7112)

    Yeah, i have a small problem:(, the player when types leave bed, he is still inside it:(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  23. Offline

    Cybermaxke

    Maybe try this packet to leave:
    Ah, nvm its from client to server :/
     
  24. Offline

    vasil7112

    Thanks, i will have a look. Btw, when you say .id, you mean EntityId right?
     
  25. Offline

    Cybermaxke

    @visil7112
    The packet is send from the client to server. :/
    Maybe you can find something else on the wiki:
    http://www.wiki.vg/Protocol
     
  26. Offline

    vasil7112

    I've already searched that website many times :/
    I didn't find something to wake my players up.

    I tried for hours, anyone have any idea how to wake a player up? Thanks

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  27. Why do you even need to fiddle around with packets? NMS already provides methods for putting a player in and out of bed. For putting them to in a bed:
    Code:
    ((EntityHuman)player.getHandle()).a((int)inLocation.getX(), (int)inLocation.getY(), (int)inLocation.getZ())
    (reference here)
    For getting them out:
    Code:
    ((EntityHuman)player.getHandle()).a(true, true, false);
    (reference here)
     
  28. Offline

    vasil7112

    We want to get the player sleep on the morning. Thanks for the code. Unfurtunatly the first one doesn't work. I am now trying for the second.

    No, also the second one doesn't work. Just to let you know, The method getHandle() is undefined for the type HumanEntity.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  29. Ohh, I'm sorry. My bad. should be
    Code:
    ((CraftPlayer)player).getHandle().a((int)inLocation.getX(), (int)inLocation.getY(), (int)inLocation.getZ())
    and
    Code:
    ((CraftPlayer)player).getHandle().a(true, true, false);
     
  30. Offline

    vasil7112

    Yeah, i thought of that before, so i tried it. Still though, i couldn't get the player sleep on morning, or when clicks the leave bed to leave.

    I got a really big error message(3.000+ lines).
    Are you sure these codes work correctly?

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

Share This Page