-
Notifications
You must be signed in to change notification settings - Fork 5
fix(interact): widen click dedup window to stop cross-tick double-firing #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,8 +46,8 @@ | |
|
|
||
| public final class MahjongTableManager implements Listener { | ||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 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; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If a server tick stalls for more than 150ms, the proxy event and its follow-up 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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, soclickTilereturns as if handled and never callssession.clickHandTileto 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 inTableEventCoordinatorhas the same effect).Useful? React with 👍 / 👎.