Update Door after changing state of lever

Discussion in 'Plugin Development' started by milli727, Feb 11, 2019.

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


    I am currently working on a roleplay plugin. There are doors, that can be bought. If you press on your door, a lever behind it will be activated. The lever actually updates but the door won't.
    My code:
    Location b1 = block.getLocation(); // block is door
    Location Switch = getSwitch(b1);  // gets the lever position (succesfully)
    Block targetSwitch = Switch.getBlock();
    BlockState state = targetSwitch.getState();
    Lever lever = (Lever) state.getData();

    I've tried following so far:
    1. Door update
    2. Update the block under the upper door block
    3. Get the Door as door and set it to "open(true)" and then update it
    Sadly, none of these tries open the door and keep it open.
    (The lever opens the door if you press it ingame)

    Thank you for any help
  2. Offline


    Take a look at this thread.
  3. Offline


    This does not work. No errors appear, door still does not open.
  4. Offline


    with block.setData((byte) someDigitHere);
    you can modify the door. But there are many possible states so doing it this way works but you have to find a good way to do it. (Try it you'll see what I mean)
  5. Offline


    If now tried 4 days fixing this. When I try setting data nothing changes as well. Is there any other option to do this??? Or is it maybe a bug because it doesn't update with block.getState().update(true);

    Nevertheless thank you very much for trying to help me :)
  6. Offline


    Take a look at this post I've made on the SpigotMC form.
  7. Offline


Thread Status:
Not open for further replies.

Share This Page