Doors Time Lock?

Discussion in 'Archived: Plugin Requests' started by Sparmerlin, Nov 1, 2011.

  1. Offline

    Sparmerlin

    Hey plugins developers! For a while i have been thinking how cool a time locking door would be. For example the doors stay open in day and lock at night. Maybe you could set the times it locks and unlocks with a command?
     
  2. Offline

    TopGear93

    :D this is very interesting! hmm ill take a look into how doors open/close * method wise *

    EDIT: sure ill attempt this.

    i wasnt able to get this to work. if i was you, maybe try and ask Hidendra for this.

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

    user_43347

    Did you try BlockState?
     
  4. Offline

    DirtyStarfish

    It looks like you can set doors to open or closed using setOpen(true) / setOpen(false)

    Code:
    onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        Block block;
        long time = player.getWorld().getTime();
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            time = player.getWorld().getTime();
            if (time > 38000 && time < 46500) {
                //Is night.
                block = event.getBlock(); //Might not be correct way to get the block.
                if (block.getType() == Material.DOOR) {
                    Door door = (Block) block;
                    if (door.isOpen) {
                        door.setOpen(false);
                    } else {
                    //Door already closed
                }
            }
        }
    }
     
  5. Offline

    Sparmerlin

    Thanks For Trying Mate :D

    Iron doors would probably work the best! Thanks For Trying Guys!

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

    TopGear93

    you should try and make this plugin then lol. i couldnt figure it out...
     
  7. UHHH we need this for the shop area on the server! please do this or if you got a link to somewhere!
     

Share This Page