do not log explosions that do not remove blocks

This commit is contained in:
Brokkonaut
2024-08-19 05:58:47 +02:00
parent d9a4d31509
commit 10b5bc8913

View File

@@ -7,6 +7,7 @@ import de.diddiz.LogBlock.config.Config;
import de.diddiz.LogBlock.config.WorldConfig; import de.diddiz.LogBlock.config.WorldConfig;
import de.diddiz.LogBlock.util.BukkitUtils; import de.diddiz.LogBlock.util.BukkitUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ExplosionResult;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@@ -41,6 +42,9 @@ public class ExplosionLogging extends LoggingListener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
if (event.getExplosionResult() == ExplosionResult.KEEP || event.getExplosionResult() == ExplosionResult.TRIGGER_BLOCK) {
return;
}
final WorldConfig wcfg = getWorldConfig(event.getLocation().getWorld()); final WorldConfig wcfg = getWorldConfig(event.getLocation().getWorld());
if (wcfg != null) { if (wcfg != null) {
Actor actor = new Actor("Explosion"); Actor actor = new Actor("Explosion");
@@ -49,8 +53,6 @@ public class ExplosionLogging extends LoggingListener {
if (!wcfg.isLogging(Logging.MISCEXPLOSION)) { if (!wcfg.isLogging(Logging.MISCEXPLOSION)) {
return; return;
} }
} else if (source instanceof WindCharge) {
return;
} else if (source instanceof TNTPrimed) { } else if (source instanceof TNTPrimed) {
if (!wcfg.isLogging(Logging.TNTEXPLOSION)) { if (!wcfg.isLogging(Logging.TNTEXPLOSION)) {
return; return;
@@ -176,6 +178,9 @@ public class ExplosionLogging extends LoggingListener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockExplode(BlockExplodeEvent event) { public void onBlockExplode(BlockExplodeEvent event) {
if (event.getExplosionResult() == ExplosionResult.KEEP || event.getExplosionResult() == ExplosionResult.TRIGGER_BLOCK) {
return;
}
Player bedCause = null; Player bedCause = null;
if (lastBedInteractionPlayer != null && lastBedInteractionLocation != null) { if (lastBedInteractionPlayer != null && lastBedInteractionLocation != null) {
Location block = event.getBlock().getLocation(); Location block = event.getBlock().getLocation();