mcMMO/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java

28 lines
798 B
Java
Raw Normal View History

package com.gmail.nossr50.runnables;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.block.BlockPistonRetractEvent;
import com.gmail.nossr50.mcMMO;
public class StickyPistonTracker implements Runnable {
BlockPistonRetractEvent event;
public StickyPistonTracker(BlockPistonRetractEvent event) {
this.event = event;
}
@Override
public void run() {
Block originalBlock = event.getRetractLocation().getBlock();
2012-12-24 22:17:19 +01:00
if (originalBlock.getType() == Material.AIR && mcMMO.placeStore.isTrue(originalBlock)) {
Block newBlock = originalBlock.getRelative(event.getDirection().getOppositeFace());
2012-12-24 22:17:19 +01:00
mcMMO.placeStore.setFalse(originalBlock);
mcMMO.placeStore.setTrue(newBlock);
}
}
}