-
Notifications
You must be signed in to change notification settings - Fork 10
Feature/player selectors #19
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
Conversation
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.
Pull Request Overview
This PR introduces new player selector functionality for command blocks by adding support for the selectors @p, @r, and @A, as well as updates some build configurations and project metadata.
- Added logic in SubcommandStartOther to resolve player selectors via the new getPlayersFromSelector method
- Updated donation URL reference and bumped dependency versions in pom.xml, along with an updated GitHub Actions build workflow
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/main/java/nl/svenar/powercamera/commands/subcommand/SubcommandStartOther.java | Added player selector logic and helper method to support @p, @r, and @A selectors |
src/main/java/nl/svenar/powercamera/PowerCamera.java | Updated donation URL logging and removed deprecated commented code |
pom.xml | Bumped revision version and updated dependency versions along with adding a repository |
.github/workflows/build.yml | Replaced external workflow with explicit steps to set up JDK 21 and build using Maven |
.github/pull_request_template.md | Modified checklist items for improved clarity |
+ "' on player: " + targetPlayer.getName()); | ||
} else { | ||
sendMessage(sender, ChatColor.RED + "Camera '" + cameraName + "' not found!"); | ||
break; |
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.
The use of 'break' in the loop when a camera is not found might prematurely end processing of other valid target players. Consider using 'continue' to ensure all players are evaluated.
break; | |
continue; |
Copilot uses AI. Check for mistakes.
// Random online player | ||
List<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers()); | ||
if (!players.isEmpty()) { | ||
return List.of(players.get(new Random().nextInt(players.size()))); |
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.
Creating a new Random instance each time this method is called might be less efficient; consider caching a Random instance at the class level.
return List.of(players.get(new Random().nextInt(players.size()))); | |
return List.of(players.get(RANDOM.nextInt(players.size()))); |
Copilot uses AI. Check for mistakes.
The PR focuses on added the
@p
,@r
and@a
selectors for use in command blocks using/pr startother ...
.@p
targets the closest player to the command block, or the sender in case it is used from the chat.@r
targets a random online player.@a
targets all online players.Bumped version to
v0.9.1
@Deprecated