SteamWar/BauSystem2.0
Archiviert
12
0

Fixed killall-tracer interaction
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
D4rkr34lm 2024-04-28 10:23:25 +02:00
Ursprung 5ab6b8832b
Commit 20bd566440
2 geänderte Dateien mit 21 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -249,4 +249,21 @@ public class TraceRecorder implements Listener {
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
}
//TODO Refactor to use EntityRemoveEvent when its not experimental anymore
/**
* 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;
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.util;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.features.tracer.TraceRecorder;
import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
@ -32,6 +33,7 @@ import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import java.util.concurrent.atomic.AtomicLong;
@ -60,6 +62,7 @@ public class KillAllCommand extends SWCommand {
.forEach(entity -> {
entity.remove();
count.incrementAndGet();
if (entity instanceof TNTPrimed) TraceRecorder.instance.removeFromRecording((TNTPrimed) entity);
});
SWUtils.actionBar(current -> BauSystem.MESSAGE.parse("OTHER_KILLALL_GLOBAL", current, count.get()));
} else {
@ -70,6 +73,7 @@ public class KillAllCommand extends SWCommand {
.forEach(entity -> {
entity.remove();
count.incrementAndGet();
if (entity instanceof TNTPrimed) TraceRecorder.instance.removeFromRecording((TNTPrimed) entity);
});
RegionUtils.actionBar(region, "OTHER_KILLALL_REGION", count.get());
}