-
-
Notifications
You must be signed in to change notification settings - Fork 7
GH-253 Add configurable placeholder settings and new placeholders #253
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
base: master
Are you sure you want to change the base?
Conversation
Introduces PlaceholderSettings to allow customization of placeholder output, specifically for isInCombat_formatted. Adds new placeholders isInCombat and isInCombat_formatted to FightTagPlaceholder, updates BridgeService and PluginConfig to support the new settings, and adjusts command permission annotation placement. Also updates build scripts and dependencies.
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.
Summary of Changes
Hello @P1otrulla, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces significant enhancements to the plugin's placeholder system, allowing for greater customization and flexibility. It adds new placeholders to display combat status and makes their output configurable through dedicated settings. Additionally, it refines command permission handling and updates build configurations to align with recent changes.
Highlights
- Configurable Placeholder Settings: Introduced a new
PlaceholderSettings
class that allows for the customization of strings returned by certain placeholders, specificallyisInCombat_formatted
. - New Combat Status Placeholders: Added two new placeholders:
isInCombat
, which returns a boolean string ("true" or "false") indicating combat status, andisInCombat_formatted
, which returns user-defined strings based on the combat state. - Configuration Integration for Placeholders: Updated the
BridgeService
to pass the newPlaceholderSettings
to theFightTagPlaceholder
and integrated these settings into thePluginConfig
to enable user configuration. - Refined Command Permissions: The
@Permission
annotation for theEternalCombatReloadCommand
was moved from the class level to the specificexecute
method, providing more precise permission control for the reload command. - Build Script Updates: The project version was updated to
2.2.1-SNAPSHOT
, and the Minecraft version for therunServer
task was adjusted from1.21.4
to1.21
in the build scripts.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces configurable placeholders for combat status, which is a great addition for server owners to customize their messages. The changes are well-structured, touching upon configuration, placeholder logic, and services. The refactoring of the command permission annotation from class-level to method-level is a good improvement for granularity. I have a couple of suggestions to improve the code further, mainly regarding an unused import and optimizing the new placeholder logic for better performance and maintainability.
eternalcombat-plugin/src/main/java/com/eternalcode/combat/CombatPlugin.java
Outdated
Show resolved
Hide resolved
...mbat-plugin/src/main/java/com/eternalcode/combat/bridge/placeholder/FightTagPlaceholder.java
Outdated
Show resolved
Hide resolved
…ring tests Took 10 minutes
new.placeholder.mp4 |
...mbat-plugin/src/main/java/com/eternalcode/combat/bridge/placeholder/FightTagPlaceholder.java
Outdated
Show resolved
Hide resolved
...mbat-plugin/src/main/java/com/eternalcode/combat/bridge/placeholder/FightTagPlaceholder.java
Outdated
Show resolved
Hide resolved
...mbat-plugin/src/main/java/com/eternalcode/combat/bridge/placeholder/FightTagPlaceholder.java
Outdated
Show resolved
Hide resolved
/gemini review |
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.
Code Review
This pull request introduces configurable settings for placeholders and adds new placeholders, which is a great enhancement. The refactoring of FightTagPlaceholder
to use a switch
expression improves readability, and the permission fix for the reload command is an important correction. I've provided a couple of suggestions to further improve the placeholder implementation: one to align with PlaceholderAPI's standard behavior for unknown placeholders, and another to simplify one of the helper methods for better conciseness.
...mbat-plugin/src/main/java/com/eternalcode/combat/bridge/placeholder/FightTagPlaceholder.java
Show resolved
Hide resolved
...mbat-plugin/src/main/java/com/eternalcode/combat/bridge/placeholder/FightTagPlaceholder.java
Show resolved
Hide resolved
… and sends an empty string)
Fully tested it's working |
.orElse(""); | ||
} | ||
private String handleIsInCombat(OfflinePlayer player) { | ||
return String.valueOf(this.isPlayerInCombat(player)); |
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.
Use Boolean#toString
return String.valueOf(this.isPlayerInCombat(player)); | |
return this.isPlayerInCombat(player).toString(); |
downloadPlugins.url("https://www.spigotmc.org/resources/packetevents-api.80279/download?version=599651") | ||
downloadPlugins.url("https://www.spigotmc.org/resources/placeholderapi.6245/download?version=541946") |
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.
Are you sure you can download plugins from SpigotMC? Don't they have some sort of anti-CDN downloader?
Note: the location of the Permission annotation was changed specifically because in the current configuration /combat reload can be used by anyone on the server???
Introduces PlaceholderSettings to allow customization of placeholder output, specifically for isInCombat_formatted. Adds new placeholders isInCombat and isInCombat_formatted to FightTagPlaceholder, updates BridgeService and PluginConfig to support the new settings, and adjusts command permission annotation placement. Also updates build scripts and dependencies.
Please describe the changes made by this PR and why they need to be merged: