Trace Refactor #233
@ -68,6 +68,11 @@ public class Recorder implements Listener {
|
||||
*/
|
||||
private final Map<TNTPrimed, List<TNTRecord>> historyMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Maps Traces to their next open unique TNTRecord id
|
||||
*/
|
||||
private final Map<Trace, Integer> nextOpenTNTRecordIdMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Regions where auto-trace is enabled
|
||||
*/
|
||||
@ -111,6 +116,7 @@ public class Recorder implements Listener {
|
||||
Trace trace = new Trace(region);
|
||||
noExplosionRecorded.add(trace);
|
||||
activeTraces.put(region, trace);
|
||||
nextOpenTNTRecordIdMap.put(trace, 0);
|
||||
return manager.add(trace);
|
||||
}
|
||||
|
||||
@ -152,11 +158,12 @@ public class Recorder implements Listener {
|
||||
*/
|
||||
private void record(TNTPrimed tntPrimed, Trace trace, List<Block> destroyedBlocks){
|
||||
List<TNTRecord> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
|
||||
UUID tntID;
|
||||
int tntID;
|
||||
|
||||
if(history.size() == 0){
|
||||
historyMap.put(tntPrimed, history);
|
||||
tntID = UUID.randomUUID();
|
||||
tntID = nextOpenTNTRecordIdMap.get(trace);
|
||||
nextOpenTNTRecordIdMap.put(trace, tntID + 1);
|
||||
}
|
||||
else
|
||||
tntID = history.get(0).getTntId();
|
||||
|
@ -38,7 +38,7 @@ public class TNTRecord {
|
||||
/**
|
||||
* Unique number to identify records being of the same tnt
|
||||
*/
|
||||
private final UUID tntId;
|
||||
private final int tntId;
|
||||
|
||||
/**
|
||||
* Whether this is a record of a tnt explosion or an entity
|
||||
@ -90,7 +90,7 @@ public class TNTRecord {
|
||||
*/
|
||||
private final List<TNTRecord> history;
|
||||
|
||||
public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List<TNTRecord> history, List<Block> destroyedBlocks){
|
||||
public TNTRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List<TNTRecord> history, List<Block> destroyedBlocks){
|
||||
this.tntId = tntId;
|
||||
this.explosion = explosion;
|
||||
this.inWater = tnt.isInWater();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren