From 0ae334ea66fe020a58108be0eea8a18eea9dc59b Mon Sep 17 00:00:00 2001 From: Sneyzi <30902875+Sneyzi@users.noreply.github.com> Date: Sat, 23 Nov 2024 10:41:06 +0200 Subject: [PATCH] Update TradeListeners.java Fix trade cancellation bug by adding a delay check to prevent immediate trade abort when the sender moves during trade acceptance. --- .../com/artillexstudios/axtrade/listeners/TradeListeners.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/artillexstudios/axtrade/listeners/TradeListeners.java b/src/main/java/com/artillexstudios/axtrade/listeners/TradeListeners.java index f1419a4..0d6b9a6 100644 --- a/src/main/java/com/artillexstudios/axtrade/listeners/TradeListeners.java +++ b/src/main/java/com/artillexstudios/axtrade/listeners/TradeListeners.java @@ -74,6 +74,7 @@ public class TradeListeners implements Listener { final Player player = event.getPlayer(); final Trade trade = Trades.getTrade(player); if (trade == null) return; + if (System.currentTimeMillis() - trade.getPrepTime() < 1_000L) return; if (event.getFrom().distanceSquared(event.getTo()) == 0) return; trade.abort(); }