diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java index 9718af01..1dbea107 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java @@ -31,10 +31,10 @@ import java.util.stream.Stream; public interface RegionSystem { - RegionSystem INSTANCE = init(); - UUID GLOBAL_REGION_ID = new UUID(0, 0); + RegionSystem INSTANCE = init(); + /** * Loads and initializes the Regions and anything that should be loaded on startup. */ diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java index 55203dc8..3cb9fce3 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java @@ -28,6 +28,7 @@ import org.bukkit.entity.Player; import java.util.function.Consumer; import java.util.function.Function; +import java.util.stream.Stream; @UtilityClass public class RegionUtils { @@ -58,10 +59,12 @@ public class RegionUtils { } public void forEachInRegion(Region region, Consumer consumer) { - Bukkit.getOnlinePlayers() - .stream() - .filter(player -> region.getArea().inRegion(player.getLocation(), false)) - .filter(player -> !region.getType().isGlobal() || Region.getRegion(player.getLocation()).getType().isGlobal()) - .forEach(consumer); + Stream players = Bukkit.getOnlinePlayers().stream(); + if (region.getType().isGlobal()) { + players = players.filter(player -> Region.getRegion(player.getLocation()).getType().isGlobal()); + } else { + players = players.filter(player -> region.getArea().inRegion(player.getLocation(), false)); + } + players.forEach(consumer); } }