Someone can help me. I need help to create a zone from(x: 2033 y: 15 z: 1979) to (x: 948 y: 0 z: 2043) in which a player cant break any blocks.
Code: private Block getFloor() { Block b = null; for (int x = -2000; x < -1975; x++) { for (int z = 2600; z < 2650; z++) { getFloor().setType(Material.AIR); } } }
To check if a number a is within two numbers b and c you need to check if the minimum number between b and c is less or equal than a, and that the maximum number between b and c is greater or equal than a, you can pick minimum and maximum with the Math class like this Code: Math.min(b, c); Math.max(b, c); So the if statement will be Code: if (Math.min(b, c) < a && Math.max(b, c) > a) { ... } For a coordinate you need to check this three times per axis: x, y and z. if all three checks are successful, the coordinate is between the other two