From 6a60c158445ddffe15776727e8b5b54216621bbd Mon Sep 17 00:00:00 2001 From: xGinko Date: Sun, 18 Aug 2024 22:17:53 +0200 Subject: [PATCH] dismount a few ticks later and make it configurable --- .../me/xginko/aef/modules/dupepreventions/AllayDupe.java | 9 +++++++-- .../me/xginko/aef/modules/dupepreventions/AllayDupe.java | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) 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 18ca8609..f2c31c33 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 @@ -12,11 +12,14 @@ public class AllayDupe extends AEFModule implements Listener { + private final boolean dismount; + public AllayDupe() { super("dupe-preventions.allay-dupe"); config.addComment(configPath, """ Will prevent allays from entering vehicles to prevent a duplication exploit confirmed working in 1.19.4."""); + this.dismount = config.getBoolean(configPath + ".dismount-premounted-allays", true); } @Override @@ -47,7 +50,8 @@ private void onEntityPickupItem(EntityPickupItemEvent event) { if (event.getEntity().isInsideVehicle()) { event.setCancelled(true); - event.getEntity().leaveVehicle(); + if (dismount) + event.getEntity().getScheduler().execute(plugin, event.getEntity()::leaveVehicle, null, 10); } } @@ -57,7 +61,8 @@ private void onEntityDropItem(EntityDropItemEvent event) { if (event.getEntity().isInsideVehicle()) { event.setCancelled(true); - event.getEntity().leaveVehicle(); + if (dismount) + event.getEntity().getScheduler().execute(plugin, event.getEntity()::leaveVehicle, null, 10); } } } 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 d5743317..b7e86979 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 @@ -11,11 +11,14 @@ public class AllayDupe extends AEFModule implements Listener { + private final boolean dismount; + public AllayDupe() { super("dupe-preventions.allay-dupe"); config.addComment(configPath, "Will prevent allays from entering vehicles to prevent a duplication exploit\n" + "confirmed working in 1.19.4."); + this.dismount = config.getBoolean(configPath + ".dismount-premounted-allays", true); } @Override @@ -46,7 +49,8 @@ private void onEntityPickupItem(EntityPickupItemEvent event) { if (event.getEntity().isInsideVehicle()) { event.setCancelled(true); - event.getEntity().leaveVehicle(); + if (dismount) plugin.getServer().getScheduler() + .scheduleSyncDelayedTask(plugin, () -> event.getEntity().leaveVehicle(), 10L); } } }