Skip to content

Conversation

Jakubk15
Copy link
Member

No description provided.

@Jakubk15 Jakubk15 requested a review from a team as a code owner August 17, 2025 15:09
@Jakubk15 Jakubk15 added the 💾 code-only This is just a code problem, it doesn't affect the plugin functionality itself label Aug 17, 2025
@Jakubk15 Jakubk15 requested a review from Copilot August 17, 2025 15:10
@Jakubk15
Copy link
Member Author

/gemini review

@Jakubk15 Jakubk15 changed the title Replace @Context annotation with @Sender where possible GH-1129 Replace @Context annotation with @Sender where possible Aug 17, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the @Context annotation with @Sender annotation in command method parameters where the parameter represents the command sender. This is a refactoring effort to use more semantically appropriate annotations for command sender parameters in the LiteCommands framework.

  • Systematically replaces @Context Player and @Context CommandSender with @Sender where the parameter represents the command executor
  • Updates import statements to include @Sender and remove unused @Context imports where applicable
  • Maintains existing @Context usage for other parameters like Viewer, User, and Invocation which represent different contextual data

Reviewed Changes

Copilot reviewed 72 out of 72 changed files in this pull request and generated 3 comments.

File Description
Command classes (65+ files) Replace @Context with @Sender for Player/CommandSender parameters representing command executors
Import statements Add @Sender imports and clean up unused @Context imports where appropriate

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly refactors the codebase to use the @Sender annotation instead of @Context for injecting the command sender. The changes are consistent across most of the project. However, I've identified a couple of issues. One is a functional regression in TeleportToPositionCommand where a refactoring removed functionality. Another is a minor code clarity issue in SudoCommand. Please see the detailed comments for suggestions.

…do/SudoCommand.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly replaces the @Context annotation with the more specific @Sender annotation across multiple command classes, which improves code clarity and adheres to the litecommands library's best practices. The changes are consistent and well-executed. However, I've identified a functional regression in TeleportToPositionCommand where a change in method call removes the feedback message to the player after teleportation, and an unused parameter in SudoCommand. I've provided suggestions to fix these issues.

Jakubk15 and others added 3 commits August 17, 2025 17:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Jakubk15 Jakubk15 added the 🚀 EternalCore 2.0 Major rework and refactor for the upcoming EternalCore 2.0 release label Aug 17, 2025
@Jakubk15 Jakubk15 self-assigned this Aug 17, 2025
Copy link
Member

@CitralFlo CitralFlo left a comment

Choose a reason for hiding this comment

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

Why not in every command? IS it not possible elsewhere? ex. Heal command?
image
More accurate screen:
image

@vLuckyyy
Copy link
Member

If I’m being honest, I really don’t like this change. In my opinion, @Context was a better solution. As I found out, @Sender is just an alias for @Context, but I still don’t really like the idea of these changes. @Context carried more meaning for me, while @Sender feels more like some kind of validator.

@vLuckyyy vLuckyyy removed their request for review August 17, 2025 21:45
@Jakubk15
Copy link
Member Author

Why not in every command? IS it not possible elsewhere? ex. Heal command?

image

More accurate screen:

image

I did not implement everywhere in Viewer type as it would cause confusion, for example in method execute(@sender Viewer viewer, @sender CommandSender sender) it just looks bad

I can search for use cases where I can indeed use this annotation for Viewer

Copy link
Contributor

@igoyek igoyek left a comment

Choose a reason for hiding this comment

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

If these are all the cases, it looks ok :)

@Jakubk15 Jakubk15 requested a review from CitralFlo August 19, 2025 10:37
@vLuckyyy vLuckyyy removed the request for review from Rollczi August 22, 2025 13:10
@Rollczi Rollczi merged commit 316f0f8 into master Aug 26, 2025
2 checks passed
@Rollczi Rollczi deleted the change-context-to-sender branch August 26, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💾 code-only This is just a code problem, it doesn't affect the plugin functionality itself 🚀 EternalCore 2.0 Major rework and refactor for the upcoming EternalCore 2.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants