From fcba3e32965a95ce8b5eab688a31fa4898bd52ea Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 1 May 2021 18:18:49 +0200 Subject: [PATCH] Optimize Region.getRegion --- .../src/de/steamwar/bausystem/region/Region.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index 7ddb627e..bd74a3b8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -48,17 +48,10 @@ public class Region { private static final List REGION_LIST = new ArrayList<>(); public static Region getRegion(Location location) { - String s = Thread.currentThread().getStackTrace()[2].toString(); - if (!s.contains("sidebar")) { - System.out.println(s + " " + location); - } - /*for (Region region : REGION_LIST) { - if (region.inRegion(location, region.minPoint, region.maxPoint)) { - return region; - } - } - return GlobalRegion.instance;*/ - return REGION_LIST.stream().filter(r -> r.inRegion(location, r.minPoint, r.maxPoint)).findFirst().orElse(GlobalRegion.instance); + return REGION_LIST.stream() + .filter(r -> r.inRegion(location, r.minPoint, r.maxPoint)) + .findFirst() + .orElse(GlobalRegion.instance); } public static void setGlobal(Flag flagType, Flag.Value value) {