Trying to figure out this file. Help appreciated. http://javadoc.lukegb.com/Bukkit/df...minecraft_2server_2BlockBed_8java_source.html btw, what I've figured out so far: In most cases, int i, int j, int k refer to the location of a block.
Though it doesn't seem like I can access it, I want to get whoever is in a bed. Also, whatever event or method is called when a player leaves a bed.
EntityHuman.E() is a function that returns whether a player is sleeping. Whether a bed is being slept in is stored in the data property for the block. The bit corresponding to 4 is set to 1 when the bed is occupied (from what I can tell). EntityHumans have a property for storing the coordinates of the bed they're sleeping in but its a private property and there seems to be no way to retrieve it. (EntityHuman.b) The method called when a player gets out of a bed is not within the bed class. Its within the EntityHuman class. its: public void a(boolean flag, boolean flag1) { and is called from half a dozen different places a BlockRightClick event is triggered when getting into a bed but I cant see one being triggered when they leave. Hopefully that helps
THANK YOU !!! just one question... Where did you get all this? I've been searching for a long time but no dice! Is it all from the docs? How do you understand! EDIT: Seems I didn't go deep enough... Anyway, all I need to use is if the player is sleeping! Thanks!
Well, you seem to know a lot so I have another question: Where should I use the E method? In what listener or event?
Imagine you have a player event: Code: CraftPlayer cPlayer = (CraftPlayer)event.getPlayer(); EntityHuman entityHuman = (EntityHuman)cPlayer.getHandle(); if(entityHuman.E()) { //etc etc (and no doubt you can work out how to adapt that for other circumstances)
Yes though that wouldn't be constant updating? Should I use onBlockInteract and check the block type, then check if the player is sleeping, and finally call the thread that should be performed for a specific time using scheduler?
For seeing when they go to sleep use onBlockRightClick. When they're sleeping they're probably not going to be moving, so you could trigger on playerMove events to see when they've woken up again.
So any change in location is a PlayerMove event? Is moving the cursor on the screen a PlayerMove event (most likely not)?
So it doesn't happen ONLY when a player actually moves, it happens every time his location changes? Like would teleporting call that event too?