Solved Open a Door?

Discussion in 'Plugin Development' started by WiseHollow, Apr 5, 2014.

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

    WiseHollow

    In my plugin, zombies are needing to be able to open doors. So I have a method that runs at the appropriate time... but it doesn't work. The method is being run (I've tested), is there something I'm doing wrong?

    Code:java
    1. public static void openDoor(Location l)
    2. {
    3. BlockState bs = l.getBlock().getState();
    4. MaterialData md = bs.getData();
    5. if (md instanceof Openable)
    6. {
    7. ((Openable)md).setOpen(true);
    8. }
    9. }
     
  2. Offline

    Serializator

    Code:java
    1. Door door = (Door) l.getBlock().getState().getData();
    2. door.setOpen(true);
     
  3. Offline

    WiseHollow

    Serializator

    I tried that :( Doesn't work.

    Code:java
    1. public static void openDoor(Location l)
    2. {
    3. Door door = (Door) l.getBlock().getState().getData();
    4. logOutputInformation(l.getBlock().getType().name());
    5. door.setOpen(true);
    6. }


    This spits out that it is working with a "WOODEN_DOOR" though. So its definitely getting the right block.
    EDIT: And the "Door" class is deprecated.
     
  4. Offline

    Serializator

    Is there an update method for the door?
     
  5. Offline

    WiseHollow

  6. WiseHollow likes this.
  7. Offline

    Serializator

  8. Offline

    WiseHollow

    Hartorn I can't believe I didn't see that xD It works perfectly! Thanks so much :)
     
Thread Status:
Not open for further replies.

Share This Page