Changing block to repeater with delay

Discussion in 'Plugin Development' started by fish_boss, Oct 7, 2013.

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

    fish_boss

    I was wondering if there was a way to get the data in order to change a block to a repeater with delay in a platform I'm building for a spawning area. Right now I am using:
    Material REPEATER = Material.DIODE_BLOCK_OFF;
    but I was wondering if there was a way to specify the delay of the repeater.
    Thanks for any help.
     
  2. Offline

    chasechocolate

  3. Offline

    fish_boss

    Found this post:
    https://forums.bukkit.org/threads/getting-the-direction-of-a-diode-repeater.13575/
    and was able to update my work a bit, but my goal of having the repeater being set to the second delay is still not working.

    Code:java
    1. Material REPEATER= Material.DIODE_BLOCK_OFF;
    2. player.getLocation().getBlock().setType(REPEATER);
    3. Diode repeater = (Diode) player.getLocation().getBlock().getState().getData();
    4. repeater.setDelay(2);
    5. player.getLocation().getBlock().getState().update();


    I did some testing to see what was not working, and I added a line of code to read out the result of repeater.getDelay() after this piece of code, and the delay read out was 2, but the repeater in game was not moved to the second delay, and the clock I had it hooked up to was burning out because the repeater was delaying the pulse by only one delay, so it isn't a visual bug either.

    Any help is appreciated.
     
Thread Status:
Not open for further replies.

Share This Page