Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. @Getter
  2. public class Roof {
  3.  
  4. private boolean build; //F
  5. private boolean M;
  6.  
  7. private List<Block> two; //g
  8. private Location location; //f
  9. private List<Block> fakeSpawn; //D
  10. private List<Block> three; //b
  11. private List<Block> one; //allatorixdemo
  12.  
  13. public Roof(Location location) {
  14. this.location = location;
  15. this.one = new ArrayList<>();
  16. this.two = new ArrayList<>();
  17. this.three = new ArrayList<>();
  18. this.fakeSpawn = new ArrayList<>();
  19. this.build = true;
  20. this.M = true;
  21. }
  22.  
  23. private void check(int a, int b) {
  24. if (this.build) {
  25. this.build = (a == 5 && b == 2) || (a == 10 && b == 4) || (a == 9 && b == 3) || (a == 13 && b == 4) || (a == 16 && b == 4);
  26. }
  27. }
  28.  
  29. public void calculate(User user) {
  30. Player player = Bukkit.getPlayer(user.getUniqueId());
  31.  
  32. int n = 0;
  33. int wood = 0;
  34. int oak = 0;
  35.  
  36. this.location = LocationUtil.getLocationStairs(player.getLocation(), 3, 1);
  37.  
  38. int x = (int) this.location.getX() - this.location.getX() < 0 ? 3 : 2;
  39. while (x <= this.location.getX() + 2) {
  40. int z = (int) this.location.getZ() - this.location.getX() < 0 ? 3 : 2;
  41.  
  42. while (z <= this.location.getZ() + 2) {
  43. Location loc = new Location(this.location.getWorld(), x, this.location.getY(), z);
  44. Block block = loc.getBlock();
  45.  
  46. Region region = RegionManager.findByLocation(loc);
  47. if (region != null && !region.check(user)) {
  48. this.build = false;
  49. }
  50.  
  51. if ((n < 6 || n == 9 || n == 10 || n == 14 || n == 15 || n > 18) && block.getType() == Material.LOG) {
  52. wood++;
  53. }
  54.  
  55. if (n == 0 || n == 4 || n == 20 || n == 24) {
  56. if (block.getType() != Material.AIR && block.getType() == Material.LOG && block.getData() != 13) {
  57. this.build = false;
  58. }
  59.  
  60. this.three.add(block);
  61. }
  62.  
  63. Label_0614:
  64. {
  65. if (block.getType() == Material.AIR) {
  66. if (n < 6 || n == 9 || n == 10 || n == 14 || n == 15 || n > 18) {
  67. this.one.add(block);
  68. break Label_0614;
  69. }
  70.  
  71. this.two.add(block);
  72.  
  73. if (this.M) {
  74. this.fakeSpawn.add(block);
  75. break Label_0614;
  76. }
  77. } else {
  78. if (block.getType() == Material.LOG) {
  79. if (block.getData() == 13) {
  80. oak++;
  81. }
  82.  
  83. this.one.add(block);
  84. break Label_0614;
  85. }
  86.  
  87. if (block.getType() != Material.LADDER) {
  88. this.build = false;
  89. }
  90. }
  91. }
  92. n++;
  93. z++;
  94. }
  95.  
  96. x++;
  97. }
  98.  
  99. this.check(wood, oak);
  100. if (this.location.getY() < player.getLocation().getY() && !this.build) {
  101. this.fakeSpawn.clear();
  102. }
  103. }
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement