Custom Item Management System#200
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a comprehensive custom item management system that enables the creation, loading, and handling of custom items with support for item mechanics and listeners. The system includes an ItemJoin mechanic that allows items to be automatically given to players on first join and prevents certain inventory modifications.
- Adds a complete custom item management infrastructure with ItemManager interface and implementation
- Introduces the ItemJoin mechanic system for managing item behavior and protection
- Integrates new command functionality for giving custom items to players
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/items/default-items.yml | Configuration template for custom items with example structure |
| src/main/java/fr/maxlego08/menu/zcore/enums/Permission.java | Adds permission for the give item command |
| src/main/java/fr/maxlego08/menu/mechanics/itemjoin/ItemJoinMechanicListener.java | Event handler for ItemJoin mechanic functionality and item protection |
| src/main/java/fr/maxlego08/menu/mechanics/itemjoin/ItemJoinMechanicFactory.java | Factory class for creating and managing ItemJoin mechanics |
| src/main/java/fr/maxlego08/menu/mechanics/itemjoin/ItemJoinMechanic.java | Core ItemJoin mechanic implementation with configuration options |
| src/main/java/fr/maxlego08/menu/listener/ItemUpdaterListener.java | Listener for updating items in player inventories on join |
| src/main/java/fr/maxlego08/menu/item/CustomItemData.java | Data record for storing custom item information and mechanic associations |
| src/main/java/fr/maxlego08/menu/command/commands/reload/CommandMenuReload.java | Updates reload command to include item manager reloading |
| src/main/java/fr/maxlego08/menu/command/commands/CommandMenuGiveItem.java | New command for giving custom items to players |
| src/main/java/fr/maxlego08/menu/command/commands/CommandMenu.java | Registers the new give item command |
| src/main/java/fr/maxlego08/menu/ZMenuPlugin.java | Integrates ItemManager into the main plugin lifecycle |
| src/main/java/fr/maxlego08/menu/ZItemManager.java | Core implementation of the item management system |
| API/src/main/java/fr/maxlego08/menu/api/utils/Message.java | Adds messages for item giving functionality |
| API/src/main/java/fr/maxlego08/menu/api/mechanic/MechanicListener.java | Base class for mechanic event listeners |
| API/src/main/java/fr/maxlego08/menu/api/mechanic/MechanicFactory.java | Factory base class for creating and managing mechanics |
| API/src/main/java/fr/maxlego08/menu/api/mechanic/Mechanic.java | Base class for item mechanics |
| API/src/main/java/fr/maxlego08/menu/api/MenuPlugin.java | Adds ItemManager to the plugin interface |
| API/src/main/java/fr/maxlego08/menu/api/ItemManager.java | Interface defining item management operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import org.bukkit.entity.Player; | ||
| import org.bukkit.event.player.PlayerJoinEvent; | ||
|
|
||
| public class ItemUpdaterListener extends ListenerAdapter{ |
There was a problem hiding this comment.
Missing space before opening brace. Should be ListenerAdapter { for consistent formatting.
| public class ItemUpdaterListener extends ListenerAdapter{ | |
| public class ItemUpdaterListener extends ListenerAdapter { |
| if (itemData == null) continue; | ||
|
|
||
| MenuItemStack menuItemStack = itemData.menuItemStack(); | ||
| Player owner = this.menuPlugin.getServer().getPlayer(player.getUniqueId()); |
There was a problem hiding this comment.
This line is redundant and potentially confusing. The owner variable is set to the same player that was passed as parameter, making the lookup unnecessary. Use the player parameter directly instead of looking up by UUID.
| @@ -254,4 +260,3 @@ public void setItemStack(ItemStack itemStack) { | |||
| } | |||
|
|
|||
| } | |||
There was a problem hiding this comment.
Trailing empty line should be removed from the end of the file for cleaner formatting.
- Add OpGrantMethod enum with ATTACHMENT and SET_OP strategies - Add enable-player-commands-as-op-action config (disabled by default) - Add op-grant-method config to choose elevation strategy - Add BreweryX material format: "breweryx:<recipe>:<quality>"
This pull request introduces a new custom item management system to the project, enabling the creation, loading, and handling of custom items with support for item mechanics and listeners.