mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
28 lines
798 B
Java
28 lines
798 B
Java
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();
|
|
|
|
if (originalBlock.getType() == Material.AIR && mcMMO.placeStore.isTrue(originalBlock)) {
|
|
Block newBlock = originalBlock.getRelative(event.getDirection().getOppositeFace());
|
|
|
|
mcMMO.placeStore.setFalse(originalBlock);
|
|
mcMMO.placeStore.setTrue(newBlock);
|
|
}
|
|
}
|
|
}
|