Add a:entity

This commit is contained in:
Heliosares
2023-08-11 13:31:40 -04:00
parent bfc7664ec8
commit 08ba03d6a7
4 changed files with 22 additions and 1 deletions

View File

@@ -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

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>AuxProtect</groupId>
<artifactId>AuxProtect</artifactId>
<version>1.2.7-pre1</version>
<version>1.2.7-pre2</version>
<name>AuxProtect</name>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>

View File

@@ -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);

View File

@@ -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)) {