SteamWar/BauSystem2.0
Archiviert
12
0

Merge remote-tracking branch 'origin/master'

Dieser Commit ist enthalten in:
Zeanon 2021-05-01 18:31:44 +02:00
Commit 2800c8dc01
2 geänderte Dateien mit 9 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -79,6 +79,9 @@ public class AutostartListener implements Listener {
@EventHandler @EventHandler
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
if (regionStartTime.isEmpty()) {
return;
}
event.blockList().forEach(block -> { event.blockList().forEach(block -> {
Region region = Region.getRegion(block.getLocation()); Region region = Region.getRegion(block.getLocation());
if (!regionStartTime.containsKey(region)) return; if (!regionStartTime.containsKey(region)) return;

Datei anzeigen

@ -37,10 +37,7 @@ import yapion.hierarchy.types.YAPIONValue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
import static de.steamwar.bausystem.region.RegionUtils.paste; import static de.steamwar.bausystem.region.RegionUtils.paste;
@ -51,22 +48,14 @@ 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;
} }
public static void setGlobal(Flag flagType, Flag.Value<?> value) { public static void setGlobal(Flag flagType, Flag.Value<?> value) {
for (Region region : REGION_LIST) { REGION_LIST.forEach(region -> region.set(flagType, value));
region.set(flagType, value);
}
} }
YAPIONObject regionData; YAPIONObject regionData;