GH-1369 Add minimum Y check for TPA accept#1369
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a minimum Y-level requirement for accepting teleport requests (/tpa). It adds a configuration option minimumTpaAcceptY, updates the command execution logic in TpaAcceptCommand to enforce this limit, adds localized messages for both English and Polish, and includes unit tests. The review feedback suggests updating a unit test to correctly align with the order of checks in the executeAll method.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
I am having trouble creating individual review comments. Click here to see my feedback.
eternalcore-core/src/test/java/com/eternalcode/core/feature/teleportrequest/TpaAcceptCommandTest.java (55-66)
Update the test to reflect the changed order of checks in executeAll. Since we now check if there are requests before checking the Y-level, we need to mock findRequests to return a non-empty list so that the Y-level check is reached.
@Test
void shouldNotAcceptAllTeleportRequestsBelowMinimumYLevel() {
Player acceptingPlayer = player("AcceptingPlayer", -31.0);
TeleportRequestService requestService = mock(TeleportRequestService.class);
when(requestService.findRequests(acceptingPlayer.getUniqueId())).thenReturn(java.util.List.of(UUID.randomUUID()));
TeleportTaskService teleportTaskService = mock(TeleportTaskService.class);
TpaAcceptCommand command = newCommand(requestService, teleportTaskService);
command.executeAll(acceptingPlayer);
verify(requestService).findRequests(acceptingPlayer.getUniqueId());
verify(teleportTaskService, never()).createTeleport(any(), any(), any(), any());
}
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6941825549
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @Execute | ||
| @DescriptionDocs(description = "Accept teleport request", arguments = "<player>") | ||
| void executeTarget(@Sender Player player, @Arg(RequesterArgument.KEY) Player target) { | ||
| if (!this.canAcceptTeleportRequest(player)) { |
There was a problem hiding this comment.
Apply the low-Y guard to tpahereaccept too
When players also have eternalcore.tpahere, this guard can be bypassed: /tpahereaccept is handled by self/TpaHereActionCommand.accept at lines 37-44, where the accepter is teleported to the requester's target.getLocation() without checking minimumTpaAcceptY(). A player below the configured minimum can still send /tpahere and have the recipient accept, pulling them to that low Y despite the new protection.
Useful? React with 👍 / 👎.
No description provided.