Skip to content

Conversation

@nelihdev
Copy link

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:

  • Introduced the Condition interface (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]
  • Updated InventoryItem to support player-specific placeholder replacement in item names and lore, and to respect the new condition system for visibility. [1] [2]
  • Added a getInventory(Player player) method in InventoryBuilder and AbstractInventory to generate inventories tailored to each player, filtering items based on their conditions. [1] [2]
  • Modified AbstractInventory and related logic to use the player-specific inventory when opening menus, ensuring all item conditions are respected.

Menu and formatting enhancements:

  • Added documentation and examples for MiniMessage formatting in serverselector.yml, allowing for advanced gradients, rainbow text, and hover effects in menu items. [1] [2] [3]
  • Added a player_name_format configuration option in config.yml to customize player names in the tablist using placeholders.
  • Added an auto_select_on_join option for custom join items in config.yml to control slot selection behavior.

Quality of life and maintenance:

  • Improved default menu creation: now also copies a conditional-menu-example.yml template to help users get started with conditional menus.
  • Updated the plugin version to 3.7.1 in plugin.yml.
  • Updated the Gradle problems report to reflect new compilation notes and advice regarding deprecated API usage, replacing previous warnings.

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.

Copilot AI review requested due to automatic review settings December 14, 2025 00:46
Copy link

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 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"
Copy link

Copilot AI Dec 14, 2025

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.

Suggested change
conditions: "NOT %player_level% ATLEAST 5"
conditions: "%player_level% LESSTHAN 5"

Copilot uses AI. Check for mistakes.
* @return true if the item should be visible, false otherwise
*/
public boolean isVisibleFor(final Player player) {
return this.condition == null || this.condition.evaluate(player);
Copy link

Copilot AI Dec 14, 2025

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.

Suggested change
return this.condition == null || this.condition.evaluate(player);
return this.condition.evaluate(player);

Copilot uses AI. Check for mistakes.
Comment on lines 62 to 71
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));
}
Copy link

Copilot AI Dec 14, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 70 to 71
// Reset to default (player's display name)
player.setPlayerListName(player.getName());
Copy link

Copilot AI Dec 14, 2025

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.

Suggested change
// Reset to default (player's display name)
player.setPlayerListName(player.getName());
// Reset to Bukkit default (may restore custom display name)
player.setPlayerListName(null);

Copilot uses AI. Check for mistakes.
- 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.
Copy link

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant