SteamWar/BauSystem2.0
Archiviert
12
0

Fix -builddestroyonly Trace option

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-03-12 21:04:56 +01:00
Ursprung 106a1a8fb0
Commit 69b31483f4
2 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -35,6 +35,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
@ -83,7 +84,7 @@ public class TNTListener implements Listener {
explode(event.blockList(), event.getBlock().getLocation(), null, null);
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onExplode(EntityExplodeEvent event) {
explode(event.blockList(), event.getLocation(), EventType.TNTExplodeInBuild, event);
}

Datei anzeigen

@ -32,6 +32,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
@ -180,7 +181,7 @@ public class Recorder implements Listener {
});
}
@EventHandler
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (!(entity instanceof TNTPrimed)) {
@ -188,7 +189,9 @@ public class Recorder implements Listener {
}
TraceRecorder traceRecorder = get((TNTPrimed) entity);
Region region = tntTraceRecorderMap.get((TNTPrimed) entity);
traceRecorder.explode((TNTPrimed) entity, !event.blockList().isEmpty() && region.inRegion(event.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
boolean inBuildRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
System.out.println(event.blockList() + " " + inBuildRegion);
traceRecorder.explode((TNTPrimed) entity, inBuildRegion);
tntTraceRecorderMap.remove(entity);
tick();
}