Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Getter
- public class Roof {
- private boolean build; //F
- private boolean M;
- private List<Block> two; //g
- private Location location; //f
- private List<Block> fakeSpawn; //D
- private List<Block> three; //b
- private List<Block> one; //allatorixdemo
- public Roof(Location location) {
- this.location = location;
- this.one = new ArrayList<>();
- this.two = new ArrayList<>();
- this.three = new ArrayList<>();
- this.fakeSpawn = new ArrayList<>();
- this.build = true;
- this.M = true;
- }
- private void check(int a, int b) {
- if (this.build) {
- this.build = (a == 5 && b == 2) || (a == 10 && b == 4) || (a == 9 && b == 3) || (a == 13 && b == 4) || (a == 16 && b == 4);
- }
- }
- public void calculate(User user) {
- Player player = Bukkit.getPlayer(user.getUniqueId());
- int n = 0;
- int wood = 0;
- int oak = 0;
- this.location = LocationUtil.getLocationStairs(player.getLocation(), 3, 1);
- int x = (int) this.location.getX() - this.location.getX() < 0 ? 3 : 2;
- while (x <= this.location.getX() + 2) {
- int z = (int) this.location.getZ() - this.location.getX() < 0 ? 3 : 2;
- while (z <= this.location.getZ() + 2) {
- Location loc = new Location(this.location.getWorld(), x, this.location.getY(), z);
- Block block = loc.getBlock();
- Region region = RegionManager.findByLocation(loc);
- if (region != null && !region.check(user)) {
- this.build = false;
- }
- if ((n < 6 || n == 9 || n == 10 || n == 14 || n == 15 || n > 18) && block.getType() == Material.LOG) {
- wood++;
- }
- if (n == 0 || n == 4 || n == 20 || n == 24) {
- if (block.getType() != Material.AIR && block.getType() == Material.LOG && block.getData() != 13) {
- this.build = false;
- }
- this.three.add(block);
- }
- Label_0614:
- {
- if (block.getType() == Material.AIR) {
- if (n < 6 || n == 9 || n == 10 || n == 14 || n == 15 || n > 18) {
- this.one.add(block);
- break Label_0614;
- }
- this.two.add(block);
- if (this.M) {
- this.fakeSpawn.add(block);
- break Label_0614;
- }
- } else {
- if (block.getType() == Material.LOG) {
- if (block.getData() == 13) {
- oak++;
- }
- this.one.add(block);
- break Label_0614;
- }
- if (block.getType() != Material.LADDER) {
- this.build = false;
- }
- }
- }
- n++;
- z++;
- }
- x++;
- }
- this.check(wood, oak);
- if (this.location.getY() < player.getLocation().getY() && !this.build) {
- this.fakeSpawn.clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement