Package me.efekos.simpler.items
Class CustomItemRegistry
java.lang.Object
me.efekos.simpler.items.CustomItemRegistry
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 Summary
Modifier and TypeMethodDescriptionload
(org.bukkit.plugin.java.JavaPlugin plugin) Loads custom item data from a JSON file under the data folder of the plugin given.void
registerItem
(org.bukkit.NamespacedKey key, Class<? extends CustomItem> item) Registers a custom item class.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.
-
Method Details
-
save
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 theCustomItem
instances.
-
load
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
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.
-