Guest User

Untitled

a guest
Jan 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. // Redstone fence gates
  2. Block bl = event.getBlock();
  3. for(BlockFace bf: BlockFace.values()) {
  4. Block isfencegate = bl.getRelative(bf);
  5. if(isfencegate.getType() == Material.FENCE_GATE) {
  6. if(bl.isBlockPowered() || bl.isBlockIndirectlyPowered()) {
  7. if(!ra.contains(bl.getLocation())) {
  8. if(isfencegate.getData() <= 3) {
  9. byte fb = isfencegate.getData();
  10. fb += 4;
  11. isfencegate.setData(fb);
  12. }
  13. ra.add(bl.getLocation());
  14. }
  15. } else {
  16. if(ra.contains(bl.getLocation())) {
  17. if(isfencegate.getData() >= 4) {
  18. byte fb = isfencegate.getData();
  19. fb -= 4;
  20. isfencegate.setData(fb);
  21. }
  22. ra.remove(bl.getLocation());
  23. }
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment