SteamWar/BauSystem2.0
Archiviert
12
0

tracer/bug-354-Fix-smaller-trace-issues #242

Zusammengeführt
YoyoNow hat 9 Commits von tracer/bug-354-Fix-smaller-trace-issues nach master 2024-04-28 12:15:18 +02:00 zusammengeführt
Nur Änderungen aus Commit 0c91261d55 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -150,7 +150,12 @@ 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 (history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) { if (history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) {
removeFromRecording(tntPrimed); 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;
} }
@ -249,20 +254,6 @@ public class TraceRecorder implements Listener {
tntSpawnRegion.remove((TNTPrimed) event.getEntity()); tntSpawnRegion.remove((TNTPrimed) event.getEntity());
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList())); activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
} tntSpawnRegion.remove((TNTPrimed) event.getEntity());
/**
* Methode to be used if a tnt should be removed for internal or technical reasons
*
* @param tnt tnt to remove
* @return whether the tnt was tracked beforehand or not
*/
public boolean removeFromRecording(TNTPrimed tnt) {
Region region = tntSpawnRegion.getOrDefault(tnt, null);
if (region == null) return false;
trackedTNT.get(region).remove(tnt);
tntSpawnRegion.remove(tnt);
historyMap.remove(tnt);
return true;
} }
} }