Items
This page is valid for all plugins using the template developed by maxlego08 and using the loader system for itemstacks.

Example:

Here is an example of an item in a yml file:
1
item:
2
material: 3
3
data: 0
4
durability: 0
5
amount: 1
6
glow: true
7
lore:
8
- "line"
9
- "&cred line"
10
- "&fwhite line"
11
name: "&eMy awesome name"
12
enchants:
13
- PROTECTION_ENVIRONMENTAL,4
14
flags:
15
- HIDE_ENCHANTS
Copied!

Example potion:

1
test2:
2
item:
3
material: POTION
4
potion: "SPEED"
5
splash: true
6
extended: true
7
level: 1
8
type: NONE
9
slot: 33
Copied!

Example player head:

1
test3:
2
item:
3
material: PLAYER_HEAD
4
url: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTM2ZTk0ZjZjMzRhMzU0NjVmY2U0YTkwZjJlMjU5NzYzODllYjk3MDlhMTIyNzM1NzRmZjcwZmQ0ZGFhNjg1MiJ9fX0="
5
type: NONE
6
slot: 34
Copied!

Add player HEAD

You have to add HEAD in the item name to be able to display the head of the player who opened the GUI.
Example:
1
item:
2
material: PLAYER_HEAD
3
name: "HEAD&a%player_name%"
Copied!
If you are below version 1.13 you have to do
1
item:
2
material: SKULL_ITEM
3
data: 3
4
name: "HEAD&a%player_name%"
Copied!

Head Database

1
item:
2
material: hdb:<head id>
3
type: NONE
4
slot: 0
Copied!

EpicHead

1
item:
2
material: eh:<head id>
3
type: NONE
4
slot: 0
Copied!

Now let's move on to the explanation of each element

​
  • material
You can put the item ID for versions lower than 1.13 and you can put the material name for higher versions. List of materials: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html​
  • data
The item data works only for versions lower than 1.13, the default value is 0.
  • amount
The number of items (from 1 to 64), the default value is 1.
  • durability
Allows you to change the durability of items, works only for armor and other items that use durability, the default value is 0.
  • name
Allows you to change the name of the item, by default the name is null.
  • glow
Allows to add an enchantment to the item and to add the HIDE_ENCHANTS flag
  • lore
Allows to change a lore of the item, by default the lore is null.
  • enchants
Allows you to add enchantments, you have to put the name of the enchantment then the level of the enchantment, like this: ENCHANT,ENCHANT_LEVEL List of enchantments available: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html​
  • flags
This option is available for servers greater than or equal to the 1.8. List of flags: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemFlag.html​
  • modelID
Allows you to put a custom model data on an item

Developer - Loading and saving an itemtack

To save and load an item you will have to use the ItemStackLoader class
1
//Create class
2
ItemStackLoader loader = new ItemStackLoader();
3
​
4
//Load your confirguration
5
YamlConfiguration configuration = plugin.getConfig();
6
​
7
//You have to put a . at the end of your path to load the item.
8
String path = "item.";
9
​
10
//Load ItemStack
11
ItemStack itemStack = loader.load(configuration, path);
12
​
13
//Save ItemStack
14
loader.save(itemStack, configuration, path);
Copied!
Last modified 2mo ago