Skip to content

Commit

Permalink
Update TradeListeners.java
Browse files Browse the repository at this point in the history
Fix trade cancellation bug by adding a delay check to prevent immediate trade abort when the sender moves during trade acceptance.
  • Loading branch information
Sneyzi authored Nov 23, 2024
1 parent 993b9a0 commit 0ae334e
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void onMove(@NotNull PlayerMoveEvent event) {
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();
}
Expand Down

0 comments on commit 0ae334e

Please sign in to comment.