Class CustomItemRegistry

java.lang.Object
me.efekos.simpler.items.CustomItemRegistry

public final class CustomItemRegistry extends Object
A registry class used for registering custom items. Loads and saves custom item data. You can't access the instance stored as ItemManager, but you can use it with the methods ItemManager.registerItem(NamespacedKey, Class), ItemManager.loadCustomItems() and ItemManager.saveCustomItems()
  • Method Details

    • save

      public void save(org.bukkit.plugin.java.JavaPlugin plugin, Map<UUID,CustomItem> items)
      Saves the given data to a JSON file under the data folder of the plugin given.
      Parameters:
      plugin - The plugin that is currently using this registry.
      items - A map of all the CustomItem instances.
    • load

      public Map<UUID,CustomItem> load(org.bukkit.plugin.java.JavaPlugin plugin)
      Loads custom item data from a JSON file under the data folder of the plugin given.
      Parameters:
      plugin - The plugin that is currently using this registry.
      Returns:
      A map of all the CustomItem instances loaded.
    • registerItem

      public void registerItem(org.bukkit.NamespacedKey key, Class<? extends CustomItem> item)
      Registers a custom item class.
      Parameters:
      key - Identifier of this custom item type.
      item - Class of the custom item.
      Throws:
      IllegalStateException - if you use the same identifier more than once.