SteamWar/BauSystem2.0
Archiviert
12
0

Optimize Region.getRegion

Dieser Commit ist enthalten in:
yoyosource 2021-05-01 18:18:49 +02:00
Ursprung 9fb66faa20
Commit fcba3e3296

Datei anzeigen

@ -48,17 +48,10 @@ public class Region {
private static final List<Region> REGION_LIST = new ArrayList<>(); private static final List<Region> REGION_LIST = new ArrayList<>();
public static Region getRegion(Location location) { public static Region getRegion(Location location) {
String s = Thread.currentThread().getStackTrace()[2].toString(); return REGION_LIST.stream()
if (!s.contains("sidebar")) { .filter(r -> r.inRegion(location, r.minPoint, r.maxPoint))
System.out.println(s + " " + location); .findFirst()
} .orElse(GlobalRegion.instance);
/*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);
} }
public static void setGlobal(Flag flagType, Flag.Value<?> value) { public static void setGlobal(Flag flagType, Flag.Value<?> value) {