diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java index b97f7a3e..18ca8609 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java @@ -6,6 +6,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDropItemEvent; +import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; public class AllayDupe extends AEFModule implements Listener { @@ -38,4 +40,24 @@ private void onVehicleEnter(VehicleEnterEvent event) { event.setCancelled(true); } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + private void onEntityPickupItem(EntityPickupItemEvent event) { + if (event.getEntityType() != XEntityType.ALLAY.get()) return; + + if (event.getEntity().isInsideVehicle()) { + event.setCancelled(true); + event.getEntity().leaveVehicle(); + } + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + private void onEntityDropItem(EntityDropItemEvent event) { + if (event.getEntityType() != XEntityType.ALLAY.get()) return; + + if (event.getEntity().isInsideVehicle()) { + event.setCancelled(true); + event.getEntity().leaveVehicle(); + } + } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java index ebcfbfa4..881fde59 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/dupepreventions/AllayDupe.java @@ -6,6 +6,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; public class AllayDupe extends AEFModule implements Listener { @@ -38,4 +39,15 @@ private void onVehicleEnter(VehicleEnterEvent event) { event.setCancelled(true); } } + + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + private void onEntityPickupItem(EntityPickupItemEvent event) { + if (event.getEntityType() != XEntityType.ALLAY.get()) return; + + if (event.getEntity().isInsideVehicle()) { + event.setCancelled(true); + event.getEntity().leaveVehicle(); + } + } }