Bukkit Door State Bug?

Discussion in 'Plugin Development' started by Goty_Metal, Dec 9, 2012.

Thread Status:
Not open for further replies.
  1. Hi all! i'm trying to check when a door is open / closed with the different 2 blocks if a door, i'm working with a wooder door right? let's see:

    Code:
    public void AbrirPuerta(PlayerInteractEvent e){
        final Block b = e.getClickedBlock();
        final Player jug = e.getPlayer();
        if(b.getType() != Material.WOODEN_DOOR){return;}
        BlockState estado = b.getState();
        Door door = (Door) estado.getData();
            if(door.isOpen() == true){
                jug.sendMessage(" Yea the door is open ");
                return;}
    // i tried this next one also with "else", and i get a NPE so i changed to another comparation
            if(door.isOpen() == false){
                if(door.isTopHalf()){
                    jug.sendMessage(" TOP BLOCK ");
                    }else{
                    jug.sendMessage(" BOTTOM BLOCK ");
                    }
            }
    }    

    So the bottom block give no problems, when is closed it says "BOTTOM BLOCK" but the TOP block always says "TOP BLOCK", so for it, is always CLOSED??? anyone find the problem? thanks!

    Please some supermoderator that can help me with this bug XD
    EDIT: guys? :'(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  2. 85 views and no one can tells me if i've some mistake or if it's a bukkit bug plz XD

    i think i should call some admin...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  3. I made another test, with a broadcast telling the state of the door and the data... as you can see no matter if the door is open or closed always says that top block is CLOSED

    View attachment 11928

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Dec 19, 2020
  4. Offline

    brord

    Try Material.WOOD_DOOR.
    No idea, but I saw it in the materials list
    Also try hitting the bottom door part.
     
  5. Yes the bot part tells when is closed open well, but when i check the same with the top part it always says closed and gives me a npe.
     
  6. Offline

    Hoolean

    If you bump that much, someone will lock your thread, so I'd be careful...
     
  7. Sorry just want a nice programmer that tells me why bukkit tells a top block of a door is closed when it's open, and the same when is closed XD
     
  8. Offline

    nisovin

    Once upon a time, a door's open/closed state was stored in both door blocks. However, in one update, it was changed so that the data for the door is spread across both door blocks instead of being duplicated, thus allowing for more data to be stored. Bukkit's API was never updated when that happened.

    http://www.minecraftwiki.net/wiki/Data_values#Doors
     
  9. If the top gives a wrong result and the bottom a valid, why not use the bottom all the time? If you catch the top just do block.getRelative(BlockFace.DOWN);
     
    gomeow likes this.
  10. That's what i'm doing, thanks guys :)
     
  11. which i said in the post i linked to. you didn't really read it did you? ;)
     
Thread Status:
Not open for further replies.

Share This Page