SteamWar/BauSystem2.0
Archiviert
12
0

Hotfixed failsafe #243

Zusammengeführt
YoyoNow hat 1 Commits von tracer/hotfix-failsafe nach master 2024-04-28 12:31:07 +02:00 zusammengeführt
Nur Änderungen aus Commit ddb701cbd6 werden angezeigt - Alle Commits anzeigen

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;
} }