debugged and fixed EntityDeathEvent

This commit is contained in:
urtypicalblahajlunatic
2026-06-27 16:21:36 +02:00
parent 4e65e1bcb2
commit 1329b616f5

View File

@@ -274,8 +274,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
@EventHandler(ignoreCancelled = true)
public void onArmorStandBreak(EntityDeathEvent event) {
if (!(event.getEntity() instanceof ArmorStand armorStand)) return;
Player player = armorStand.getKiller();
if(player == null) return;
if(!(event.getDamageSource().getCausingEntity() instanceof Player player)) return;
int x = armorStand.getLocation().getBlockX();
int y = armorStand.getLocation().getBlockY();
int z = armorStand.getLocation().getBlockZ();
@@ -289,6 +288,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
String message = ChatColor.GRAY + playerName + " broke an armor stand placed by " + target + " at " + x + " " + y + " " + z + getHumanWorldName(worldName);
alert(message, playerName, "[Map Link](" + MAP_LINK + "/?worldname=" + worldName + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, worldName);
}
}
// Armor Stand item interaction alerts