### Access the MMOInventory Plugin Instance Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Retrieve the plugin instance via the Bukkit plugin manager. Ensure the plugin is installed before access. ```java MMOInventory plugin = (MMOInventory) Bukkit.getPluginManager().getPlugin("MMOInventory"); ``` -------------------------------- ### Get Equipped Items Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Retrieve a list of equipped items using a specified InventoryLookupMode to control slot validation. ```java List items = playerData.getItems(InventoryLookupMode.NORMAL); ``` -------------------------------- ### Configure MySQL settings Source: https://docs.phoenixdevt.fr/mmoinventory/faq Enable and configure MySQL database connection settings in the main plugin configuration file. ```yaml mysql: enabled: false host: localhost port: 3306 database: minecraft user: mmolover pass: ILoveAria .... ``` -------------------------------- ### Configure Vanilla Inventory Settings Source: https://docs.phoenixdevt.fr/mmoinventory/features/vanilla-inventory Define the inventory ID and type as vanilla to enable custom slots within the player's inventory grid. ```yaml # For the vanilla inventory, this option is not very important, # it only has to be different from other inventories id: vanilla_inventory # Will place items in the player's vanilla 3x9 inventory grid # Either 'vanilla' or 'custom' type: vanilla # Toggle on/off for temporary disabling this inventory. # Vanilla inventory is disabled by default. enabled: false ``` -------------------------------- ### Configure MMOInventory settings Source: https://docs.phoenixdevt.fr/mmoinventory/general/default-config The primary configuration file for managing plugin behavior, database connectivity, and inventory features. ```yaml # Update notification on login # Can be disabled when no internet connection is available update-notify: true # Automatically saves player data at a set interval. # Reload required when edited auto-save: enabled: true interval: 1800 # In seconds (1800 = 30 minutes) log: true # Will verbose to the console whenever # data is saved/loaded from the SQL database. debug: false # MySQL Support mysql: enabled: false host: localhost port: 3306 database: minecraft user: root pass: '' maxPoolSize: 10 maxLifeTime: 300000 connectionTimeOut: 10000 leakDetectionThreshold: 150000 properties: cachePrepStmts: true prepStmtCacheSize: 250 prepStmtCacheSqlLimit: 2048 # Amount of slots in the inventory - has to be a multiple of 9. # Remember to update the slot numbers in items.yml after changing this option. inventory-slots: 36 # Enable this option to move the accessory slots to the player # inventory. A tutorial is available on the resource page. # Requires a server reload when changed. no-custom-inventory: false # This prevents a known dupe bug so it is strongly # recommended to keep this set to true. disable-equiping-stacked-items: true # Items will drop (when keep-inventory is disabled) on death. # Requires a server reload when changed. drop-on-death: true # Available modules: # - aureliumskills (level only) # - battlelevels (level only) # - default (uses player's exp bar, level only) # - heroes # - mcmmo (level only) # - mcrpg (level only) # - mmocore # - proskillapi # - racesandclasses # - rpgplayerleveling (level only) # - skillapi # - fabled # - skills # - skillspro level-module: default class-module: default # When enabled, MMOInventory with automatically generate the # necessary files for Oraxen inside of the following file: # ~/plugins/Oraxen/items/mmoinventory-hook.yml # # Files are generated on server startup, so make sure you # restart your server when editing this option. generate-oraxen-files: false # Adds a static to the player's inventory. # Opens up the custom inventory when clicked. # Requires a server reload when changed. inventory-button: enabled: false slot: 9 item: material: CHEST name: '&6Custom Inventory' lore: - '' - '&eClick to open.' # custom-model-data: 1 # skull-texture: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjg5Yjk4ZjA0YzMyMjdkMzdkMzE5YmJjZmZjNTFmNTJlNzhkOTZhMDViMTI4NTJkMWI0NjRiYjc0MDhhNzgxMCJ9fX0= # Enable/disable auto resource pack download. Requires a server reload when changed. # Default RP: https://www.dropbox.com/s/1lftxmzh0q4b5yu/mmoinv_rp_4.zip?dl=1 resource-pack: enabled: true url: resource_pack_url delay: 20 # Kick player if he does not accept the server resource pack or # if the download failed. Requires a server reload when changed. kick: enabled: false message: 'Please accept server resource pack!' ``` -------------------------------- ### Open Command Configuration Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory Configures the command used by players to open the custom inventory, including permissions, aliases, and error messages. ```yaml # Command to be used in order to open the custom inventory. # This option is only for custom inventories. open_command: enabled: true name: 'custominv' permission: 'custom_inv.open.mmoinventory_default' aliases: [ mmoinv, rpginv, rpginventory ] output: player-command: '&cThis command is only for players.' specify-player: '&cPlease specify a player.' wrong-player: '&cCould not find the player called {arg}.' not-enough-perms: '&cYou don''t have enough permissions.' ``` -------------------------------- ### Define Inventory Items with Click Actions Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory Configuration for static inventory items that display information or trigger actions like closing the inventory. ```yaml items: INFO: material: SPRUCE_HANGING_SIGN name: "&6Information" slot: 5 lore: - '' - '&f ⌛ &7Level &f%mmocore_level%' - '&f %mythiclib_space_1%❣%mythiclib_space_1% &7Class: &f%mmocore_class%' - '&f ☄ &7Gold: &f%vault_eco_balance%' - '' - '&7Health: &f%mythiclib_stat_max_health%' - '&7Defense: &f%mythiclib_stat_defense%' - '&7Attack: &f%mythiclib_stat_attack_damage%' on_click: - 'command{format="p";from_console=false}' CLOSE: item: BARRIER name: "&cClose" slot: 35 lore: - "&7Click to close this inventory." on_click: - 'close_inventory{}' ``` -------------------------------- ### Accessing MMOInventory Plugin Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview How to retrieve the MMOInventory plugin instance from the Bukkit plugin manager. ```APIDOC ## Accessing MMOInventory Plugin ### Description Retrieve the MMOInventory plugin instance using the Bukkit plugin manager. ### Code ```java MMOInventory plugin = (MMOInventory) Bukkit.getPluginManager().getPlugin("MMOInventory"); ``` ``` -------------------------------- ### Configure Player Information Item Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory Static item configuration that displays player stats and executes a sudo command to open the player info page. ```yaml # Static items, not slots. Players can click # on them but not move them around. items: INFO: #item: GOLD_NUGGET #custom_model_data_string: "info" material: SPRUCE_HANGING_SIGN name: "&6Information" slot: 5 lore: - '' - '&f ⌛ &7Level &f%mmocore_level%' - '&f %mythiclib_space_1%❣%mythiclib_space_1% &7Class: &f%mmocore_class%' - '&f ☄ &7Coins: &f%vault_eco_balance%' - '' - '&7Health: &f%mythiclib_stat_max_health%' - '&7Defense: &f%mythiclib_stat_defense%' - '&7Attack: &f%mythiclib_stat_attack_damage%' on_click: - 'sudo{format="p"}' ``` -------------------------------- ### Configure Inventory UI Layout Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory-texture Defines the inventory name and font character in the configuration file to apply custom textures. ```yaml ui_layout: # ..... name: self: "&f%mythiclib_space_-17%\u40E0%mythiclib_space_-169%<#3F3F3F>Equipment" other: "&f%mythiclib_space_-17%\u40E0%mythiclib_space_-169%<#3F3F3F>Equipment of {name}" ``` -------------------------------- ### Configure Inventory Name with Oraxen Glyphs Source: https://docs.phoenixdevt.fr/mmoinventory/compatibility/oraxen Use PAPI placeholders in the language.yml file to apply custom GUI textures via Oraxen glyphs. ```yaml inventory-name: self: '&f%oraxen_shift_16%%oraxen_shift_2%%oraxen_mmoinv_default%' ``` -------------------------------- ### Add Maven Repository Source: https://docs.phoenixdevt.fr/mmoinventory/api/maven Include this repository configuration in your project's pom.xml to access MMO plugin API builds. ```xml phoenix https://nexus.phoenixdevt.fr/repository/maven-public/ ``` -------------------------------- ### Configure Elytra Deployment Settings Source: https://docs.phoenixdevt.fr/mmoinventory/features/elytra-slot Adjust the fall distance threshold and slow falling behavior in the main configuration file. ```yaml elytra_deployment: # If "Slow falling" is detected on the player, fall time # is reset, temporarily preventing elytras from deploying # until the player hits the ground, or the effect wears off. skip_if_slow_falling: true # Fall distance threshold (in blocks) after which # elytras automatically deploy. fall_distance_threshold: 4 ``` -------------------------------- ### Configure inventory button Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory Defines the static item used to open the custom inventory. Requires a server reload after modification. ```yaml inventory_button: enabled: false slot: 9 item: material: CHEST name: '&6Custom Inventory' lore: - '' - '&eClick to open.' # custom_model_data: 1 # skull_texture: eyJ0ZXh0dXJlcyI6e... ``` -------------------------------- ### Add MMOInventory Dependency Source: https://docs.phoenixdevt.fr/mmoinventory/api/maven Add this dependency to your pom.xml to use the MMOInventory API, ensuring the scope is set to provided. ```xml net.Indyuce MMOInventory-API 2.0-SNAPSHOT provided ``` -------------------------------- ### Basic Inventory Configuration Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory Defines the core settings for a custom inventory, including its ID, enabled status, type, and death drop behavior. ```yaml # Do NOT change this! Choose one and stick to it. #......... id: mmoinventory1_legacy # Toggle on/off for temporary disabling this inventory. enabled: true # Either 'custom' for custom inventories or 'vanilla' for the vanilla inventory. # There can be only one vanilla inventory at a time! type: custom # Should items from this custom inventory be dropped on death. # This option is only for custom inventories, as vanilla inventory # is already supported by the keepInventory world flag. drop_on_death: false #........ ``` -------------------------------- ### PlayerData.getItems(InventoryLookupMode) Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Retrieves a list of equipped items for the player based on the lookup mode. ```APIDOC ## PlayerData.getItems(InventoryLookupMode) ### Description Returns the current list of equipped items for the player. ### Parameters - **mode** (InventoryLookupMode) - Required - The lookup mode (NORMAL or IGNORE_RESTRICTIONS). ``` -------------------------------- ### Configure Close Inventory Item Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory Static item configuration that triggers the close_inventory action when clicked. ```yaml items: CLOSE: item: BARRIER name: "&cClose" slot: 35 lore: - "&7Click to close this inventory." on_click: - 'close_inventory{}' ``` -------------------------------- ### Registering Custom Slot Restrictions Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview How to implement a custom SlotRestriction and register it with the MMOInventory slot manager. ```APIDOC ## Registering Custom Slot Restrictions ### Description Implement the `SlotRestriction` abstract class to define custom logic for slot accessibility and register it for use in inventory configurations. ### Implementation ```java public class MyRestriction extends SlotRestriction { public MyRestriction(MMOLineConfig config) {} @Override public boolean isVerified(InventoryData player, CustomSlot ignore2, ItemStack ignore1) { SomePlayerData yourPlayerData = SomePlayerData.get(player.getPlayer()); return yourPlayerData.canUseThisSlot(); } } ``` ``` -------------------------------- ### Retrieve Inventory Instances Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Access specific custom or vanilla inventories, or retrieve collections of all registered inventories. ```java CustomInventory someCustomInv = inventories.getCustom("custom_inventory_id"); VanillaInventory theVanillaInv = inventories.getVanilla(); Collection all = inventories.getAll(); Collection customInvs = inventories.getAllCustom(); ``` -------------------------------- ### Managing Inventories Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Methods to access the InventoryManager and retrieve specific inventory instances. ```APIDOC ## Managing Inventories ### Description Access the InventoryManager to retrieve custom or vanilla inventory instances. ### Methods - `inventories.getCustom(String id)`: Retrieves a CustomInventory by its ID. - `inventories.getVanilla()`: Retrieves the registered VanillaInventory. - `inventories.getAll()`: Returns a collection of all registered inventories. - `inventories.getAllCustom()`: Returns a collection of all custom inventories. ### Code ```java InventoryManager inventories = plugin.getInventoryManager(); CustomInventory someCustomInv = inventories.getCustom("custom_inventory_id"); VanillaInventory theVanillaInv = inventories.getVanilla(); Collection all = inventories.getAll(); ``` ``` -------------------------------- ### Define inventory slots Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory Configures various slot types including vanilla off-hand and custom accessory slots like rings and amulets. ```yaml slots: # Vanilla slot type OFF_HAND: type: off_hand material: GOLD_NUGGET custom_model_data_string: 'off_hand' name: "&6Off Hand Slot" slot: 12 lore: - Drag & drop an item to equip it. # Ring slot (custom slot) LEFT_RING: type: accessory material: GOLD_NUGGET custom_model_data_string: "ring1" name: "&6Left Ring Slot" slot: 34 restrictions: - "mmoitemstype{type=RING}" lore: - Drag & drop an item to equip it. # Amulet slot (custom slot) AMULET: type: accessory material: DIAMOND_HOE durability: 5 name: '&6Amulet Slot' slot: 10 restrictions: - 'mmoitemstype{type=AMULET}' lore: - Drag & drop an item to equip it. # Artifact slot (custom slot) ARTIFACT: type: accessory material: DIAMOND_HOE durability: 10 name: '&6Artifact Slot' slot: 11 restrictions: - 'mmoitemstype{type=ARTIFACT}' - 'unique{enabled=true}' lore: - Drag & drop an item to equip it. ``` -------------------------------- ### Obtain InventoryData Instances Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Retrieve specific inventory data implementations or the generic InventoryData interface from a PlayerData object. ```java PlayerData playerData = /* see above */ CustomInventory customInv = /* see above */ Inventory someInv = /* see above */ VanillaInventoryData vanillaInvData = playerData.getVanilla(); CustomInventoryData customInvData = playerData.getCustom(customInv); InventoryData invData = playerData.get(someInv); // either custom or vanilla ``` -------------------------------- ### Configure MMOInventory Accessory Slots Source: https://docs.phoenixdevt.fr/mmoinventory/compatibility/mmoitems Defines custom inventory slots restricted to accept only items of the RING type from MMOItems. ```yaml # Ring slots RIGHT_RING: type: accessory material: DIAMOND_HOE durability: 7 name: '&6Right Ring Slot' slot: 25 restrictions: - 'mmoitemstype{type=RING}' lore: - Drag & drop an item to equip it. LEFT_RING: type: accessory material: DIAMOND_HOE durability: 8 name: '&6Left Ring Slot' slot: 34 restrictions: - 'mmoitemstype{type=RING}' lore: - Drag & drop an item to equip it. ``` -------------------------------- ### Legacy Filler Texture Model Source: https://docs.phoenixdevt.fr/mmoinventory/features/custom-inventory-texture Model configuration used in Minecraft 1.20.x and below to hide the vanilla inventory grid via texture scaling. ```json { "parent": "item/handheld", "textures": { "layer0": "mmoinventory:item/fill" }, "display":{ "gui": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 1.1, 1.1, 1.1 ] } } } ``` -------------------------------- ### Implement a Custom Slot Restriction Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Create a custom restriction by extending SlotRestriction and implementing the isVerified method. ```java public class MyRestriction extends SlotRestriction { public MyRestriction(MMOLineConfig config) { // No config options needed? } @Override public boolean isVerified(InventoryData player, CustomSlot ignore2, ItemStack ignore1) { // does not depend on the custom slot in which item is placed. // does not depend on the item placed either. SomePlayerData yourPlayerData = SomePlayerData.get(player.getPlayer()); return yourPlayerData.canUseThisSlot(); } } ``` -------------------------------- ### Adjust GUI filler item scale Source: https://docs.phoenixdevt.fr/mmoinventory/faq Modify the scale parameter in the resource pack model file to hide the default Minecraft inventory grid pattern. ```json { "parent": "item/handheld", "textures": { "layer0": "items/slots/fill" }, "display": { "gui": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 1.1, 1.1, 1.1 ] } } } ``` -------------------------------- ### Access the Inventory Manager Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Retrieve the InventoryManager from the plugin instance to manage inventory objects. ```java MMOInventory plugin = /* see above */ InventoryManager inventories = plugin.getInventoryManager(); ``` -------------------------------- ### PlayerData Inventory Access Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Methods to retrieve inventory data instances from a PlayerData object. ```APIDOC ## PlayerData Inventory Access Methods ### Description Methods to obtain specific inventory data instances for a player. ### Methods - `VanillaInventoryData getVanilla()` - `CustomInventoryData getCustom(CustomInventory customInv)` - `InventoryData get(Inventory someInv)` ``` -------------------------------- ### Define an Elytra Slot in YAML Source: https://docs.phoenixdevt.fr/mmoinventory/features/elytra-slot Use this syntax in your inventory configuration file to create a slot restricted to elytra items. ```yaml slots: #..... ELYTRA: type: elytra material: GOLD_NUGGET custom_model_data_string: "elytra" name: "&6Elytra Slot" restrictions: - 'material{materials="ELYTRA"}' slot: 14 lore: - 'Only &bElytras&7 are allowed here.' - '&bDeploy automatically&7 when falling.' - 'Drag & drop an item to equip it.' ``` -------------------------------- ### InventoryData Content Management Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Methods to update or retrieve items within an inventory. ```APIDOC ## InventoryData Content Management ### Description Methods for modifying inventory slots and retrieving current inventory content. ### Methods - `void setItem(CustomSlot slot, ItemStack item)`: Sets an item in a slot. Passing null removes the item. Triggers InventoryUpdateEvent. - `Collection retrieveItems()`: Returns the collection of items currently in the inventory. ``` -------------------------------- ### Retrieve PlayerData Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Access the PlayerDataManager from the plugin instance to retrieve a PlayerData object for a specific player. ```java Player yourPlayer = /* see above */ MMOInventory plugin = /* see above */ PlayerDataManager manager = plugin.getDataManager(); PlayerData playerData = manager.get(yourPlayer); ``` -------------------------------- ### Update and Retrieve Inventory Content Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Modify inventory slots using setItem or retrieve the full collection of items. Note that setItem triggers an InventoryUpdateEvent. ```java InventoryData invData = /* see above */ CustomSlot someSlot = /* ... */ invData.setItem(someSlot, new ItemStack(Material.DIAMOND_SWORD)); invData.setItem(someSlot, null); // remove item Collection content = invData.retrieveItems(); ``` -------------------------------- ### Configure Lore Tag Slot Restrictions Source: https://docs.phoenixdevt.fr/mmoinventory/compatibility/other Use loretag to restrict slots based on exact matches, partial matches, or string positioning within item lore. ```text loretag{tag="&cRing"} ``` ```text loretag{tag="&cSword";check=EQUALS} ``` ```text loretag{tag="&cRing";check=CONTAINS} ``` -------------------------------- ### Apply Custom Restriction in Configuration Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Use the registered restriction identifier within the inventory configuration YAML file. ```yml slots: ... SPECIAL_RING_SLOT: type: accessory material: GOLD_NUGGET custom_model_data_string: "ring1" name: "&6Special Ring Slot" slot: 34 restrictions: - "mmoitemstype{type=RING}" - "my_restriction{}" # <<==== HERE! lore: - 'Drag & drop an item to equip it.' - '' - 'This slot is only available after' - 'completing the quest XXXXX.' ``` -------------------------------- ### PlayerDataManager.get(Player) Source: https://docs.phoenixdevt.fr/mmoinventory/api/overview Retrieves the PlayerData object associated with a specific player. ```APIDOC ## PlayerDataManager.get(Player) ### Description Retrieves the PlayerData object for the specified player from the manager. ### Method `PlayerData get(Player player)` ### Parameters - **player** (Player) - Required - The player whose data is being retrieved. ``` -------------------------------- ### Register MMOItems Accessory Type Source: https://docs.phoenixdevt.fr/mmoinventory/compatibility/mmoitems Registers the RING item type in MMOItems, ensuring the parent type is set to ACCESSORY for proper stat registration. ```yaml RING: display: EMERALD name: 'Artifact' parent: 'ACCESSORY' # Parent type set to ACCESSORY unident-item: name: '&f#prefix#Unidentified Ring' lore: - '&7This item is unidentified. I must' - '&7find a way to identify it!' - '{tier}' - '{tier}&8Item Info:' - '{range}&8- &7Lvl Range: &e#range#' - '{tier}&8- &7Item Tier: #prefix##tier#' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.