Beds

Discussion in 'Plugin Development' started by retsrif, Mar 1, 2011.

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

    retsrif

    Questions about beds:
    1. Can you detect who's sleeping in a bed? If so, how?
    2. Can you detect if someone stops using the bed? Again, how?
    3. Is there a method to check if a player is sleeping or not?
    Thanks! :)
     
  2. Offline

    lonelydime

    I saw:
    [CraftBukkit] http://bit.ly/hPnnkk Tanel Suurhans - - add BedBlock - implement BLOCK_INTERACT for beds

    Don't know if it's fully implemented as I can't find it in the javadoc
     
  3. Offline

    retsrif

    Yeah I've seen this file in the javadocs. It shows an event that takes a parameter of an EntityHuman, but not a way to access it. Do you think I should just check for whoever interacted with a bed to get the person in it? Should work right? How do you think I should check who leaves a bed?
     
  4. Offline

    lonelydime

    Yea, I'd check for the player who interacted with the bed. As for who leaves the bed, I'm not entirely sure.
     
  5. Offline

    retsrif

    I thought of using the onPlayerMove event to check if the player's location has changed? Though I don't know if the player leaving the bed counts as a movement. Also, is there a way to constantly check for a specific thing? Like keep checking if the player's location is not the bed's location anymore.
     
  6. Offline

    fullwall

    Well... the event added is just BLOCK_INTERACT (right click) but working for beds. You'd probably have to go to craftbukkit code for anything deeper (there are a couple of entityhuman variables for sleep).
     
  7. Offline

    retsrif

    But how can I access those variables? They just seem to be passed into methods and are never returned from another method.
     
  8. Offline

    fullwall

    ((CraftPlayer)getPlayer()).getHandle().[bed variable].
     
  9. Offline

    retsrif

    What do you mean by bed variable? Do you mean BedBlock? Also, where are the CraftBukkit javadocs?
    --- merged: Mar 2, 2011 4:46 PM ---
    getHandle() returns an EntityPlayer. Currently looking at EntityPlayer docs, though as expected, they're obfuscated, and don't even give a clue as to what does what.
    EDIT: Would a person in a bed be considered a passenger? Most likely not right?
     
Thread Status:
Not open for further replies.

Share This Page