Skip to content

Item For Developers

Fulminazzo edited this page Apr 5, 2024 · 25 revisions

This section is dedicated to developers. If you are looking for the server admins page, click here

Many of the fields referenced on this page might be or require platform specific values. Check the glossary

The item module aims to ease and improve the QOL of both server admins and developers by providing common, intuitive methods of creating and customizing objects.

It does so by providing a comprehensive API with method chaining and basic constructors that reduces the overhead introduced by ItemMeta.

All the objects described in this section are part of the base module, which is totally independent of any platform. If you want to store or load data on files, you will need to import the serializer module and use ItemYAGLParser#addAllParsers() JUST ONCE before starting any IO operation (it also includes calls to WrappersYAGLParser#addAllParsers() so you are not needed to specify that). Any reference to bukkit requires the bukkit module imported.

Items

The core class of this module is Item. This interface introduces various methods to add, edit or remove attributes in the current item.

In this section, we will go over every implementation of Item, how they can be used and what are their capabilities. Before proceeding, the reader must know the two most important functions:

  • Item#newItem(): allows to create a new empty implementation of Item. This will create an empty item ready to be used;
  • Item#copy(Class): allows to copy the current Item to another implementation of it. This is extremely useful for converting items, but be aware that in some cases it may cause information loss. For example, converting a RecipeItem to an Item will discard every previous configured recipe.
Item implementations
Item
RecipeItem
PersistentItem
MovablePersistentItem