diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SelectAdjacent.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SelectAdjacent.java index c51238ee..76ffc749 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SelectAdjacent.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/worldedit/SelectAdjacent.java @@ -29,7 +29,6 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -37,6 +36,7 @@ import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scheduler.BukkitTask; +import org.bukkit.util.Vector; import java.util.HashMap; import java.util.HashSet; @@ -47,13 +47,26 @@ import java.util.Set; @MinVersion(20) public class SelectAdjacent implements Listener { - private BlockFace[] FACES = { - BlockFace.NORTH, - BlockFace.EAST, - BlockFace.SOUTH, - BlockFace.WEST, - BlockFace.UP, - BlockFace.DOWN + private Vector[] FACES = { + new Vector(1, 0, 0), + new Vector(-1, 0, 0), + new Vector(0, 1, 0), + new Vector(0, -1, 0), + new Vector(0, 0, 1), + new Vector(0, 0, -1), + + new Vector(1, 1, 0), + new Vector(1, -1, 0), + new Vector(1, 0, 1), + new Vector(1, 0, -1), + new Vector(-1, 1, 0), + new Vector(-1, -1, 0), + new Vector(-1, 0, 1), + new Vector(-1, 0, -1), + new Vector(0, 1, 1), + new Vector(0, 1, -1), + new Vector(0, -1, 1), + new Vector(0, -1, -1), }; private Map selectors = new HashMap<>(); @@ -144,8 +157,8 @@ public class SelectAdjacent implements Listener { minZ = Math.min(minZ, location.getBlockZ()); maxZ = Math.max(maxZ, location.getBlockZ()); - for (BlockFace face : FACES) { - Block next = block.getRelative(face); + for (Vector face : FACES) { + Block next = block.getRelative(face.getBlockX(), face.getBlockY(), face.getBlockZ()); if (next.isEmpty() || next.isLiquid()) continue; Location loc = next.getLocation(); if (seen.contains(loc)) continue; diff --git a/Teamserver/src/de/steamwar/teamserver/listener/SelectAdjacent.java b/Teamserver/src/de/steamwar/teamserver/listener/SelectAdjacent.java index 02f67136..003703dd 100644 --- a/Teamserver/src/de/steamwar/teamserver/listener/SelectAdjacent.java +++ b/Teamserver/src/de/steamwar/teamserver/listener/SelectAdjacent.java @@ -38,18 +38,32 @@ import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scheduler.BukkitTask; +import org.bukkit.util.Vector; import java.util.*; public class SelectAdjacent implements Listener { - private BlockFace[] FACES = { - BlockFace.NORTH, - BlockFace.EAST, - BlockFace.SOUTH, - BlockFace.WEST, - BlockFace.UP, - BlockFace.DOWN + private Vector[] FACES = { + new Vector(1, 0, 0), + new Vector(-1, 0, 0), + new Vector(0, 1, 0), + new Vector(0, -1, 0), + new Vector(0, 0, 1), + new Vector(0, 0, -1), + + new Vector(1, 1, 0), + new Vector(1, -1, 0), + new Vector(1, 0, 1), + new Vector(1, 0, -1), + new Vector(-1, 1, 0), + new Vector(-1, -1, 0), + new Vector(-1, 0, 1), + new Vector(-1, 0, -1), + new Vector(0, 1, 1), + new Vector(0, 1, -1), + new Vector(0, -1, 1), + new Vector(0, -1, -1), }; private Map selectors = new HashMap<>(); @@ -140,8 +154,8 @@ public class SelectAdjacent implements Listener { minZ = Math.min(minZ, location.getBlockZ()); maxZ = Math.max(maxZ, location.getBlockZ()); - for (BlockFace face : FACES) { - Block next = block.getRelative(face); + for (Vector face : FACES) { + Block next = block.getRelative(face.getBlockX(), face.getBlockY(), face.getBlockZ()); if (next.isEmpty() || next.isLiquid()) continue; Location loc = next.getLocation(); if (seen.contains(loc)) continue;