diff --git a/lang/en-us.yml b/lang/en-us.yml index 891ae38..2f30792 100644 --- a/lang/en-us.yml +++ b/lang/en-us.yml @@ -202,6 +202,9 @@ actions: p: started flying n: stopped flying enchant: enchanted + entity: + p: placed entity + n: destroyed entity explode: caused explosion of gamemode: switched gamemode to grab: grabbed diff --git a/pom.xml b/pom.xml index 636358b..402f6ca 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 AuxProtect AuxProtect - 1.2.7-pre1 + 1.2.7-pre2 AuxProtect ${project.artifactId}-${project.version} diff --git a/src/main/java/dev/heliosares/auxprotect/database/EntryAction.java b/src/main/java/dev/heliosares/auxprotect/database/EntryAction.java index 69a46b9..7bd5248 100644 --- a/src/main/java/dev/heliosares/auxprotect/database/EntryAction.java +++ b/src/main/java/dev/heliosares/auxprotect/database/EntryAction.java @@ -26,6 +26,7 @@ public class EntryAction { // SKIPPED 10/11 public static final EntryAction MOUNT = new EntryAction("mount", 12, 13); public static final EntryAction PLUGINLOAD = new EntryAction("pluginload", 14, 15); + public static final EntryAction ENTITY = new EntryAction("entity", 16, 17); public static final EntryAction ALERT = new EntryAction("alert", 128); public static final EntryAction RESPAWN = new EntryAction("respawn", 129); diff --git a/src/main/java/dev/heliosares/auxprotect/spigot/listeners/PlayerListener.java b/src/main/java/dev/heliosares/auxprotect/spigot/listeners/PlayerListener.java index f2fc7df..1dd1fe8 100644 --- a/src/main/java/dev/heliosares/auxprotect/spigot/listeners/PlayerListener.java +++ b/src/main/java/dev/heliosares/auxprotect/spigot/listeners/PlayerListener.java @@ -24,9 +24,12 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityPlaceEvent; import org.bukkit.event.entity.EntityToggleGlideEvent; import org.bukkit.event.entity.PlayerLeashEntityEvent; import org.bukkit.event.player.*; +import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; @@ -305,6 +308,20 @@ public class PlayerListener implements Listener { plugin.add(entry); } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onEntityPlaceEvent(EntityPlaceEvent e) { + DbEntry entry = new DbEntry(AuxProtectSpigot.getLabel(e.getPlayer()), EntryAction.ENTITY, true, + e.getEntity().getLocation(), AuxProtectSpigot.getLabel(e.getEntity()), ""); + plugin.add(entry); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onVehicleDestroyEvent(VehicleDestroyEvent e) { + DbEntry entry = new DbEntry(AuxProtectSpigot.getLabel(e.getAttacker()), EntryAction.ENTITY, false, + e.getVehicle().getLocation(), AuxProtectSpigot.getLabel(e.getVehicle()), ""); + plugin.add(entry); + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerUnleashEntityEvent(PlayerUnleashEntityEvent e) { if (!(e.getEntity() instanceof LivingEntity entity)) {