Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

public final class MahjongTableManager implements Listener {
Comment on lines 46 to 47

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve fast same-tile discard clicks

With these windows at 150ms, a legitimate quick second click on the same hand tile is treated as a duplicate before it reaches the normal select→discard path in SessionHandSelectionCoordinator.clickHandTile: both clicks have the same table/owner/tileIndex, so clickTile returns as if handled and never calls session.clickHandTile to discard. This only affects players who intentionally double-click the selected tile within 150ms, but that is a plausible way to discard; the proxy follow-up needs to be filtered without debouncing deliberate second physical clicks for this long (and the matching display-action window in TableEventCoordinator has the same effect).

Useful? React with 👍 / 👎.

private static final String ADMIN_PERMISSION = "mahjongpaper.admin";
private static final long DUPLICATE_DISPLAY_ACTION_WINDOW_NANOS = 40_000_000L;
private static final long DUPLICATE_HAND_TILE_CLICK_WINDOW_NANOS = 40_000_000L;
private static final long DUPLICATE_DISPLAY_ACTION_WINDOW_NANOS = 150_000_000L;
private static final long DUPLICATE_HAND_TILE_CLICK_WINDOW_NANOS = 150_000_000L;
Comment on lines +49 to +50

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve fast same-tile discard clicks

With these windows at 150ms, a legitimate quick second click on the same hand tile is treated as a duplicate before it reaches the normal select→discard path in SessionHandSelectionCoordinator.clickHandTile: both clicks have the same table/owner/tileIndex, so clickTile returns as if handled and never calls session.clickHandTile to discard. This only affects players who intentionally double-click the selected tile within 150ms, but that is a plausible way to discard; the proxy follow-up needs to be filtered without debouncing deliberate second physical clicks for this long (and the matching display-action window in TableEventCoordinator has the same effect).

Useful? React with 👍 / 👎.

private static final long RECENT_DISPLAY_ACTION_TTL_SECONDS = 60L;
private static final long RECENT_HAND_TILE_CLICK_TTL_SECONDS = 60L;
private static final double PERSISTED_TABLE_CLEANUP_RADIUS_XZ = 4.5D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
import org.bukkit.util.RayTraceResult;

final class TableEventCoordinator implements Listener {
private static final long DUPLICATE_DISPLAY_ACTION_WINDOW_NANOS = 40_000_000L;
private static final long DUPLICATE_DISPLAY_ACTION_WINDOW_NANOS = 150_000_000L;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Deduplicate by tick/source instead of wall-clock time

If a server tick stalls for more than 150ms, the proxy event and its follow-up PlayerInteractEvent/PlayerAnimationEvent can still land on consecutive ticks but exceed this wall-clock window, so isDuplicateDisplayAction returns false and the same physical click is processed twice. Since the duplicate being fixed is explicitly a cross-tick event pair, this should key off the event source/tick (or another deterministic click marker) rather than assuming three normal 50ms ticks is an upper bound.

Useful? React with 👍 / 👎.

private static final long OVERHEAD_EXIT_GUARD_SECONDS = 2L;
private static final double FLAT_INTERACTION_MAX_DISTANCE = 6.0D;
private static final double FLAT_INTERACTION_BLOCK_EPSILON = 0.05D;
/**
* Bounded TTL on the per-player recent-action cache. The dedup window is
* 40ms (DUPLICATE_DISPLAY_ACTION_WINDOW_NANOS), so anything older than a
* 150ms (DUPLICATE_DISPLAY_ACTION_WINDOW_NANOS), so anything older than a
* few seconds is by definition not a duplicate of a fresh click — but the
* previous bare ConcurrentHashMap only evicted on PlayerQuitEvent, which
* on Folia can occasionally be missed when the player's entity region
Expand Down