-
Notifications
You must be signed in to change notification settings - Fork 6
Add Conditional Inventory Items, Player-Specific Menus, and Expanded Formatting Options #9
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
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 pull request introduces a comprehensive conditional inventory system that enables player-specific menu item visibility based on permissions, placeholders, and various comparison operators. The changes add significant customization capabilities for server administrators.
Key changes:
- Added a flexible condition parsing system with support for permissions, numeric comparisons, string operations, regex matching, and logical operators (AND, OR, NOT) with grouping
- Implemented player-specific inventory generation that filters items based on conditions and replaces placeholders dynamically
- Enhanced tablist functionality with customizable player name formatting using PlaceholderAPI
Reviewed changes
Copilot reviewed 18 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/java/net/zithium/deluxehub/inventory/condition/Condition.java |
New functional interface for defining player-based conditions |
src/main/java/net/zithium/deluxehub/inventory/condition/ConditionParser.java |
New parser for evaluating complex condition expressions with multiple operators |
src/main/java/net/zithium/deluxehub/inventory/InventoryItem.java |
Added condition support and player-specific placeholder replacement for items |
src/main/java/net/zithium/deluxehub/inventory/InventoryBuilder.java |
Added player-specific inventory generation method respecting conditions |
src/main/java/net/zithium/deluxehub/inventory/AbstractInventory.java |
Modified to use player-specific inventories and changed refresh logic |
src/main/java/net/zithium/deluxehub/inventory/inventories/CustomGUI.java |
Integrated condition parsing from configuration files |
src/main/java/net/zithium/deluxehub/inventory/InventoryManager.java |
Added automatic copying of conditional menu example template |
src/main/java/net/zithium/deluxehub/module/modules/visual/tablist/TablistManager.java |
Added player name formatting configuration and update all players method |
src/main/java/net/zithium/deluxehub/module/modules/visual/tablist/TablistHelper.java |
Added setPlayerListName method for custom tablist names |
src/main/java/net/zithium/deluxehub/module/modules/hotbar/HotbarManager.java |
Added support for auto-selecting item slots on player join |
src/main/java/net/zithium/deluxehub/module/modules/hotbar/HotbarItem.java |
Implemented auto-select on join functionality for hotbar items |
src/main/resources/config.yml |
Added player name format configuration for tablist and auto_select_on_join option |
src/main/resources/serverselector.yml |
Added MiniMessage formatting documentation and examples |
src/main/resources/conditional-menu-example.yml |
New comprehensive example file demonstrating all condition operators |
build/resources/main/plugin.yml |
Updated plugin version to 3.7.1 |
| Various Gradle files | Build artifacts and cache files (generated, not reviewed in detail) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - "&7For players under level 5" | ||
| - "" | ||
| - "&aYour level: &e%player_level%" | ||
| conditions: "NOT %player_level% ATLEAST 5" |
Copilot
AI
Dec 14, 2025
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 condition uses "NOT %player_level% ATLEAST 5" which is semantically equivalent to "%player_level% LESSTHAN 5". While functionally correct, using the more direct LESSTHAN operator would be clearer and more consistent with the examples demonstrating each operator type.
| conditions: "NOT %player_level% ATLEAST 5" | |
| conditions: "%player_level% LESSTHAN 5" |
| * @return true if the item should be visible, false otherwise | ||
| */ | ||
| public boolean isVisibleFor(final Player player) { | ||
| return this.condition == null || this.condition.evaluate(player); |
Copilot
AI
Dec 14, 2025
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 condition null check is redundant since a non-null default condition is set in the constructor. The condition field is initialized to player -> true in the constructor (line 23), so it can never be null. The null check in this method is unnecessary.
| return this.condition == null || this.condition.evaluate(player); | |
| return this.condition.evaluate(player); |
| while (condition.contains("(")) { | ||
| Matcher matcher = BRACKET_PATTERN.matcher(condition); | ||
| if (!matcher.find()) { | ||
| break; // No valid brackets found | ||
| } | ||
|
|
||
| String bracketContent = matcher.group(1); | ||
| boolean bracketResult = evaluate(bracketContent, player); | ||
| condition = condition.replace("(" + bracketContent + ")", String.valueOf(bracketResult)); | ||
| } |
Copilot
AI
Dec 14, 2025
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.
Recursive bracket evaluation can cause issues when placeholders are replaced. If a placeholder value contains parentheses (e.g., a player name like "Test(123)"), the bracket pattern will incorrectly interpret these as grouping operators. Consider evaluating placeholders after bracket resolution, or use a more robust parsing approach that distinguishes between literal parentheses in placeholder values and grouping parentheses.
src/main/java/net/zithium/deluxehub/inventory/condition/ConditionParser.java
Show resolved
Hide resolved
| // Reset to default (player's display name) | ||
| player.setPlayerListName(player.getName()); |
Copilot
AI
Dec 14, 2025
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 method resets the player list name to player.getName() when the name parameter is null or empty, but this doesn't restore the original display name. If a player had a custom display name before this plugin modified it, that original display name will be lost. Consider using player.setPlayerListName(null) to reset to the Bukkit default, which properly restores the original display name.
| // Reset to default (player's display name) | |
| player.setPlayerListName(player.getName()); | |
| // Reset to Bukkit default (may restore custom display name) | |
| player.setPlayerListName(null); |
- Add debug logging for unresolved placeholders in numeric conditions - Improve bracket parsing to handle literal parentheses in values - Add warnings for potential operator typos - Remove redundant null checks and improve code clarity - Fix TablistHelper to properly reset player names - Simplify condition examples (use LESSTHAN instead of NOT ATLEAST) Addresses all GitHub Copilot review feedback.
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
Copilot reviewed 18 out of 28 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces several new features and improvements focused on enhancing inventory customization, player-specific item visibility, and formatting options. The most significant updates are the addition of conditional inventory items, player-specific inventory generation, and expanded formatting support for menus.
Inventory customization and conditional visibility:
Conditioninterface (src/main/java/net/zithium/deluxehub/inventory/condition/Condition.java) to allow defining conditions for item visibility based on player properties. Inventory items can now be shown or hidden per player. [1] [2] [3]InventoryItemto support player-specific placeholder replacement in item names and lore, and to respect the new condition system for visibility. [1] [2]getInventory(Player player)method inInventoryBuilderandAbstractInventoryto generate inventories tailored to each player, filtering items based on their conditions. [1] [2]AbstractInventoryand related logic to use the player-specific inventory when opening menus, ensuring all item conditions are respected.Menu and formatting enhancements:
serverselector.yml, allowing for advanced gradients, rainbow text, and hover effects in menu items. [1] [2] [3]player_name_formatconfiguration option inconfig.ymlto customize player names in the tablist using placeholders.auto_select_on_joinoption for custom join items inconfig.ymlto control slot selection behavior.Quality of life and maintenance:
conditional-menu-example.ymltemplate to help users get started with conditional menus.3.7.1inplugin.yml.These changes collectively make the plugin more flexible and user-friendly, especially for server owners who want to create dynamic, player-aware menus and visually rich interfaces.