SteamWar/BauSystem2.0
Archiviert
12
0

Merge pull request 'Hotfixed failsafe' (#243) from tracer/hotfix-failsafe into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #243
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2024-04-28 12:31:06 +02:00
Commit c815cd52fb

Datei anzeigen

@ -129,11 +129,19 @@ public class TraceRecorder implements Listener {
private void record() { private void record() {
for (Region region : activeTraces.keySet()) { for (Region region : activeTraces.keySet()) {
TraceRecordingWrapper wrappedTrace = activeTraces.get(region); TraceRecordingWrapper wrappedTrace = activeTraces.get(region);
for (TNTPrimed tnt : trackedTNT.getOrDefault(region, Collections.emptyList())) { Iterator<TNTPrimed> iter = trackedTNT.getOrDefault(region, Collections.emptyList()).iterator();
while (iter.hasNext()) {
TNTPrimed tnt = iter.next();
TNTPoint record = record(tnt, wrappedTrace, Collections.emptyList()); TNTPoint record = record(tnt, wrappedTrace, Collections.emptyList());
if (record == null) continue; if (record == null) {
iter.remove();
tntSpawnRegion.remove(tnt);
historyMap.remove(tnt);
tntSpawnRegion.remove(tnt);
} else {
wrappedTrace.addRecord(record); wrappedTrace.addRecord(record);
} }
}
wrappedTrace.commitRecorded(); wrappedTrace.commitRecorded();
} }
} }
@ -150,12 +158,6 @@ public class TraceRecorder implements Listener {
List<TNTPoint> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); List<TNTPoint> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
// Failsave for tnt entering unloaded chunks // Failsave for tnt entering unloaded chunks
if (tntPrimed.isDead() || history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) { if (tntPrimed.isDead() || history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) {
Region region = tntSpawnRegion.get(tntPrimed);
if (region == null) return null;
trackedTNT.get(region).remove(tntPrimed);
tntSpawnRegion.remove(tntPrimed);
historyMap.remove(tntPrimed);
tntSpawnRegion.remove(tntPrimed);
return null; return null;
} }