Почему при значениях x и z неправильно ставятся арморстенды? (1.16.5)
@EventHandler
public void onPlace(BlockPlaceEvent e) {
Player p = e.getPlayer();
Block b = e.getBlockPlaced();
Location pl = p.getLocation();
Location l = b.getLocation();
if(b.getType().equals(Material.FURNACE)) {
String s = "x";
if(pl.getBlockZ() > l.getBlockZ()) {
s = "z";
} else if(pl.getBlockZ() < l.getBlockZ()) {
s = "-z";
} else if(pl.getBlockX() < l.getBlockX()) {
s = "-x";
} p.sendMessage(s);
for(int i = 0; i < 5; i++) {
FallingBlock fb = Objects.requireNonNull(l.getWorld()).spawnFallingBlock(l.clone().add(0.5, -1.47, 0.5), Material.IRON_BLOCK.createBlockData());
fb.setInvulnerable(true);
fb.setGravity(false);
fb.setDropItem(false);
if(i == 1 && !s.equals("-x")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.45, -1.5, 0.55), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
} else if(i == 2 && !s.equals("-z")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.55, -1.5, 0.45), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
} else if(i == 3 && !s.equals("x")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.55, -1.5, 0.51), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
} else if(i == 4 && !s.equals("z")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.51, -1.5, 0.55), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
}
}
}
}

@EventHandler
public void onPlace(BlockPlaceEvent e) {
Player p = e.getPlayer();
Block b = e.getBlockPlaced();
Location pl = p.getLocation();
Location l = b.getLocation();
if(b.getType().equals(Material.FURNACE)) {
String s = "x";
if(pl.getBlockZ() > l.getBlockZ()) {
s = "z";
} else if(pl.getBlockZ() < l.getBlockZ()) {
s = "-z";
} else if(pl.getBlockX() < l.getBlockX()) {
s = "-x";
} p.sendMessage(s);
for(int i = 0; i < 5; i++) {
FallingBlock fb = Objects.requireNonNull(l.getWorld()).spawnFallingBlock(l.clone().add(0.5, -1.47, 0.5), Material.IRON_BLOCK.createBlockData());
fb.setInvulnerable(true);
fb.setGravity(false);
fb.setDropItem(false);
if(i == 1 && !s.equals("-x")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.45, -1.5, 0.55), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
} else if(i == 2 && !s.equals("-z")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.55, -1.5, 0.45), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
} else if(i == 3 && !s.equals("x")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.55, -1.5, 0.51), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
} else if(i == 4 && !s.equals("z")) {
ArmorStand a = (ArmorStand) l.getWorld().spawnEntity(l.clone().add(0.51, -1.5, 0.55), EntityType.ARMOR_STAND);
a.setGravity(false);
a.setInvulnerable(true);
a.setCollidable(false);
a.setVisible(false);
a.addPassenger(fb);
}
}
}
}
