Configuration - ValeraShimchuck/SimpleItemGenerator GitHub Wiki
To define the item`s appearance you should insert item
property in yours item configuration like this:
items:
your-custom-item:
item:
... # yours item appearance properties
If you have ItemsAdder, you can grab the appearance from it like this:
items:
your-custom-item-with-ia-look:
item: '[itemsadder] examplenamespace:itemkey'
If you have Oraxen, you can grab the appearance from it like this:
items:
your-custom-item-with-oraxen-look:
item: '[oraxen] examplenamespace:itemkey'
If you have Nexo, you can grab the appearance from it like this:
items:
your-custom-item-with-nexo-look:
item: '[nexo] examplenamespace:itemkey'
Material of the item is only required property in item
, possible values as for 1.21.4 can be found here.
Example material:
items:
material-example:
item:
material: BLAZE_ROD
Optional property. Sets the item's durability to a specific number:
items:
your-item:
item:
material: DIAMOND_SWORD
durability: 10 # will set the items durability to 10
Supports MiniMessage and PlaceholderAPI placeholders within themself. Example usage of those properties:
items:
item-with-display-text:
item:
name: "<gold>Really cool item"
lore:
- "<white>Your name is <yellow>%player_name%" # to use this example, you should install Player PAPI expansion
- "<white>Next line"
Custom model data supported since 1.14.
items:
cmd-item:
item:
material: DIAMOND
cmd: 1
Also new 1.21.4 modern custom model data is supported. Some examples:
items:
example-item2:
item:
material: DIAMOND
cmd: 5.3 # modern 1.21.4+
example-item3:
item:
material: DIAMOND
cmd: # modern 1.21.4+
- 5.3
- 5.4
example-item4:
item:
material: DIAMOND
cmd: # modern 1.21.4+
floats: 5.0 # optional
flags: true #optional
strings: "test" #optional
colors: 0x000000 #optional. Can be also an integer
example-item5:
item:
material: DIAMOND
cmd: # modern 1.21.4+
floats:
- 5.0
- 5.1
flags:
- true
- false
strings:
- "test"
- "test2"
colors:
- 0xff0000 # rgb color representation
- 0x0000ff
Can't give much information on modern one, because there is still not that much information about it right now. But if know what is that you can use it.
Simple option that set to false by default. If set to true then the item will be unbreakable.
items:
unbreakable-item:
item:
material: GOLDEN_PICKAXE
unbreakable: true
Enchantments property is a map where key is an enchantment and value is the enchantment`s level. Level restrictions are not being applied to the item, that means you can make a sword with sharpness 50 for instance. Also there is 2 type of enchantments notation. Pre and post 1.13.
1.8-1.12. Values for 1.12 can be found here
items:
18enchanted-item:
item:
material: GOLDEN_SWORD
enchantments:
DAMAGE_ALL: 50 # it is sharpness
1.13-1.21.4 example:
1214enchanted-item:
item:
material: GOLDEN_SWORD
enchantments:
minecraft:sharpness: 50
minecraft:aqua_affinity
minecraft:bane_of_arthropods
minecraft:binding_curse
minecraft:blast_protection
minecraft:breach
minecraft:channeling
minecraft:density
minecraft:depth_strider
minecraft:efficiency
minecraft:feather_falling
minecraft:fire_aspect
minecraft:fire_protection
minecraft:flame
minecraft:fortune
minecraft:frost_walker
minecraft:impaling
minecraft:infinity
minecraft:knockback
minecraft:looting
minecraft:loyalty
minecraft:luck_of_the_sea
minecraft:lure
minecraft:mending
minecraft:multishot
minecraft:piercing
minecraft:power
minecraft:projectile_protection
minecraft:protection
minecraft:punch
minecraft:quick_charge
minecraft:respiration
minecraft:riptide
minecraft:sharpness
minecraft:silk_touch
minecraft:smite
minecraft:soul_speed
minecraft:sweeping_edge // for 1.20.4 and below it is minecraft:sweeping
minecraft:swift_sneak
minecraft:thorns
minecraft:unbreaking
minecraft:vanishing_curse
minecraft:wind_burst
Property to remove some information in lore, like enchantments, unbreakable, attributes, etc. Example:
items:
flag-item:
item:
material: DIAMOND
enchantments:
minecraft:luck_of_the_sea: 1 # 1.13+
item-flags:
- HIDE_ENCHANTS
Possible values:
HIDE_ENCHANTS
HIDE_ATTRIBUTES
HIDE_UNBREAKABLE
HIDE_DESTROYS
HIDE_PLACED_ON
HIDE_POTION_EFFECTS
// Since 1.16.2
HIDE_DYE
// Since 1.20
HIDE_ARMOR_TRIM
A list of attributes. Example:
items:
attribute-item:
item:
material: BLAZE_ROD
attributes:
- attribute: MAX_HEALTH
operation: ADD_VALUE
name: 'attribute name' # optional
amount: 6
slot: MAINHAND # Optional. Available since 1.9
Defines name for attribute. If not defined then a generated attribute name will appear.
Value of attribute. Can be a floating point number.
1.8+
ATTACK_DAMAGE
MAX_HEALTH
FOLLOW_RANGE
KNOCKBACK_RESISTANCE
MOVEMENT_SPEED
JUMP_STRENGTH
ZOMBIE_SPAWN_REINFORCEMENTS
1.9+
ATTACK_SPEED
ARMOR
ARMOR_TOUGHNESS
LUCK
1.12+
FLYING_SPEED
1.14+
ATTACK_KNOCKBACK
1.20.2+
MAX_ABSORPTION
1.20.5+
SCALE
STEP_HEIGHT
ENTITY_INTERACTION_RANGE
BLOCK_INTERACTION_RANGE
GRAVITY
SAFE_FALL_DISTANCE
BLOCK_BREAK_SPEED
1.21+
BURNING_TIME
EXPLOSION_KNOCKBACK_RESISTANCE
MINING_EFFICIENCY
MOVEMENT_EFFICIENCY
OXYGEN_BONUS
SNEAKING_SPEED
SUBMERGED_MINING_SPEED
SWEEPING_DAMAGE_RATION
WATER_MOVEMENT_EFFICIENCY
1.21.2+
TEMPT_RANGE
ADD_VALUE
ADD_MULTIPLIED_BASE
ADD_MULTIPLIED_TOTAL
ANY
MAINHAND
OFFHAND
FEET
LEGS
CHEST
HEAD
// supported since 1.20.5
BODY
ARMOR
HAND
Since 1.6.0
you can define color for potions(Since mc 1.11+) or for leather armor.
items:
leather1:
item:
material: LEATHER_CHESTPLATE
color: '[dye] LIME' # Use minecraft's dye for color
leather2:
item:
material: LEATHER_CHESTPLATE
color: '[hex] #ff00ff' # support for hex. Also can be 0xff00ff or just ff00ff. RGB
leather3:
item:
material: LEATHER_CHESTPLATE
color: '[decimal] 632160' # support for decimal color numbers. RGB
leather4:
item:
material: LEATHER_CHESTPLATE
color: # also you can make color straight out of color components. Every component supports values from 0 to 255
red: 122
green: 32
blue: 200
BLACK
BLUE
BROWN
CYAN
GRAY
GREEN
LIGHT_BLUE
LIGHT_GRAY
LIME
MAGENTA
ORANGE
PINK
PURPLE
RED
WHITE
YELLOW
Since 1.6.0
you can add potion effects.
items:
your-potion:
item:
material: POTION
color: '[dye] RED' # more information you can find in `Colors` section
potion:
- type: SPEED
duration: 1m30s # 1 minute 30 seconds
amplifier: 1 # Strength of the potion. 1 - first level. 2 - second respectively.
- type: JUMP_BOOST
duration: 25s
amplifier: 2
ABSORPTION
BAD_OMEN
BLINDNESS
CONDUIT_POWER
DARKNESS
DOLPHINS_GRACE
FIRE_RESISTANCE
GLOWING
HASTE
HEALTH_BOOST
HERO_OF_THE_VILLAGE
HUNGER
INFESTED
INSTANT_DAMAGE
INSTANT_HEALTH
INVISIBILITY
JUMP_BOOST
LEVITATION
LUCK
MINING_FATIGUE
NAUSEA
OOZING
POISON
RAID_OMEN
REGENERATION
RESISTANCE
SATURATION
SLOW_FALLING
SLOWNESS
SPEED
STRENGTH
TRIAL_OMEN
UNLUCK
WATER_BREATHING
WEAKNESS
WEAVING
WIND_CHARGED
WITHER
Since 1.6.0
you can set head`s texture. HeadDatabase is supported.
items:
headtest:
item:
material: PLAYER_HEAD
head-texture: '[headdb] 40476' # Using HeadDatabase. In order to work HeadDatabase must be enabled. Otherwise you'll get an error.
headtest2:
item:
material: PLAYER_HEAD
head-texture: '[nickname] Runichi69' # You can get player's head from theirs nickname
selfhead:
item:
material: PLAYER_HEAD
head-texture: '[nickname] %player%' # You can use %player% placeholder so the item's holder can see their own skin.
headtest3:
item:
material: PLAYER_HEAD
head-texture: '[url] https://textures.minecraft.net/texture/da91846245a7342cc5aea8f548525ae5260b028f85ed183245731e40a514e4c6' # Support for url with skins. Only works with minecraft.net domain. This limitation hardcoded in minecraft client.
headtest4:
item:
material: PLAYER_HEAD
head-texture: '[base64] eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDQ5MjdjZTViYTIyYWQxZTc1N2Q2YTMzM2UyNzViMzZkYTFhODQzNmZjZWYwNzczNDBhYjUzZTNmYiJ9fX0=' # base64 skin information. You can find this in developer section of a head there https://minecraft-heads.com/
Usages of item. Can be a single item or a list. Example of single command usage.
items:
simple-usage-item
item:
material: IRON_INGOT
usage: '[console] msg %player% Hi from console!'
A command should start with sender type. There are 2 options [player] and [console]. The first one will issue the command as a player. And the second one will do the same as a console.
Any command supports PlaceholderAPI. Also there are built-in placeholders:
%minimessage_(your minimessage here)% - replaces your placeholder with json chat components. Useful for commands like tellraw.
%player% - replaces with the item's holder name.
%player_x% - x coordinate of the player.
%player_y% - y coordinate of the player.
%player_z% - z coordinate of the player.
// Placeholders when clicked at player, entity or a block
%target_x% - x coordinate of clicked target.
%target_y% - y coordinate of clicked target.
%target_z% - z coordinate of clicked target.
%target_uuid% - uuid of clicked target
// Placeholder when clicked at player
%player_target% - replaces with the target's name
// Placeholders available since 1.6.0
// Placeholders when clicked at block
%place_x% - x coordinate for placed(or potentially placed) block
%place_y% - y coordinate for placed(or potentially placed) block
%place_z% - z coordinate for placed(or potentially placed) block
If you need more detailed usage, you can use advanced usage. Example:
items:
adv-usage-item:
item:
material: IRON_INGOT
usage:
predicate: "[button] right"
commands:
- "[console] msg %player% you right clicked item"
cooldown: 5s
on-cooldown:
- "[console] msg %player% Wait %time_s.2f% seconds" # Will display seconds before usage with 2 digit after the dot in seconds.
freezetime: 500 # 500 ms delay for on-cooldown message
cancel: false # allow right click with item
By default all interactions with custom item are cancelled. But you can specify whether current usage should be cancelled or not.
items:
plain-sword:
item:
material: GOLDEN_SWORD
usage:
- predicate: '[button] left'
cancel: false
- predicate: '[button] right'
commands: '[console] msg %player% '
In the advanced format in order to execute commands you should define commands
property.
Example:
items:
commands-item:
item:
material: STICK
usage:
commands:
- '[console] msg %player% it is a stick'
This property add a cooldown and issues on-cooldown
command if defined.
Example:
items:
cooldown-command:
item:
material: STICK
usage:
commands:
- '[console] msg %player% You used the stick'
cooldown: 1h20m30s400 # cooldown for 1 hour, 20 minutes, 30 seconds and 400 millis
There is a property called cooldown-type
that can define a type of cooldown.
- GLOBAL - cooldown applied to all items of the same type(key) for everyone.
- PER_PLAYER - cooldown applied to all items of the same type(key) per player.
- PER_ITEM - cooldown applied per item even if it is the same type of item. Used by default.
Example:
items:
test-item:
item: ...
usage:
cooldown: 5s
cooldown-type: PER_PLAYER # PER_ITEM by default
If cooldown
is defined you can issue some commands when the item is on cooldown.
Example:
items:
cooldown-command2:
item:
material: STICK
usage:
commands:
- '[console] msg %player% You used the stick'
cooldown: 30s
on-cooldown:
- '[console] msg %player% You can't use item right now. Wait for %time_s.1f% seconds'
Placeholders in cooldown commands:
%time_<time_unit>.(digits after the dot)f% - expression placeholder that prints amount of time before item can be used.
Examples
%time_s% - print only integer part of seconds.
%time_t.1f% - print cooldown in ticks with 1 digit after the dot precision.
%time_h.3f% - print cooldown in hours with 3 digits after the dot precision.
%time_m.2f% - print cooldown in minutes with 2 digits after the dot precision.
In other words - cooldown for cooldown.
items:
cooldown-command2:
item:
material: STICK
usage:
commands:
- '[console] msg %player% You used the stick'
cooldown: 30s
on-cooldown:
- '[console] msg %player% You can't use item right now. Wait for %time_s.1f% seconds'
freezetime: 500 # can be also defined like 1h30s40m etc, but there is no point to make freezetime longer then the cooldown itself.
To define when item should be used you should define predicate
property.
Example:
items:
predicate-item:
item:
material: STICK
usage:
- predicate: # Listed predicates work like OR statement
- '[button] left'
- '[button] right'
- '[permission] someplugin.commands.use, another.permission' # available since 1.6.0. Checks for player's permissions
- '[amount] 5' # available since 1.6.0. Checks whether the used stack has at least 5 items in it.
- '[total_amount] 100' # available since 1.6.0. Checks whether the user has at least 100 items of this custom_item in theirs inventory.
- '[state_flag] build:true' # available since 1.6.0. Queries region where the item is used. In this case if player can build then the predicate will pass.
- '[slot] OFF_HAND, 17, 9-12' # available since 1.7.0. Slot where the item is. All texted values: ANY, HOTBAR, HAND, OFF_HAND, ANY_HAND, ARMOR, HEAD, CHEST, LEGS, FEET.
- '[time] 13t25s2m1h' # available since 1.7.0. Ticking period of the item. Useful if you want to execute command whenever player has this item periodically.
commands: '[console] msg %player% you clicked with mouse button'
- predicate:
- button: drop # predicates within one node works like AND statement
at: entity
amount: 5 # available since 1.6.0. Checks whether the used stack has at least 5 items in it.
total-amount: 100 # available since 1.6.0. Checks whether the user has at least 100 items of this custom_item in theirs inventory.
permission: # available since 1.6.0. Checks for player's permissions
- someplugin.commands.use
- another.permission
state-flag:
build: true # available since 1.6.0. Queries region where the item is used. In this case if player can build then the predicate will pass.
use: true # checking for use state flag
slot: # available since 1.7.0. Slot where the item is. All texted values: ANY, HOTBAR, HAND, OFF_HAND, ANY_HAND, ARMOR, HEAD, CHEST, LEGS, FEET.
- 15
- 18
time: # available since 1.7.0. Ticking period of the item. Useful if you want to execute command whenever player has this item periodically.
- 5t
- 6t-10t
commands: '[console] msg %player% you used drop button at entity. The entity located at %target_x% %target_y% %target_z%'
Buttons:
LEFT
RIGHT
DROP
Ats:
AIR
ENTITY
BLOCK
PLAYER
Slots: 0-40 on the latest version. Text values:
HAND
OFF_HAND
ANY_HAND
ANY
HEAD
CHEST
LEGS
FEET
ARMOR
HOTBAR
A property called consume
that defines consumption of the custom item on usage.
There are 3 possible values:
- An integer - amount of item to be consumed
- STACK - consumes the used item
- ALL - consumes all items of the same type
Example:
items:
predicate-item:
item:
material: STICK
usage:
- predicate:
- [button] left
- [button] right
commands: '[console] msg %player% hey, there is some information for ya!'
- predicate: [button] left
commands: '[console] msg %player% You used item. And now I will consume 100 items outta you'
consume: 100
- predicate: [button] drop
commands: '[console] msg %player% Super consumption activated'
consume: ALL
Sometimes you want to change only the item's name and lore, without touching its material, durability, enchantments, etc.
For this purpose there is an option called update-only
:
items:
your-item:
item:
material: DIAMOND_SWORD
durability: 300
name: The sword11
lore:
- Line1
- Line2
cmd: 5
unbreakable: false
enchantments:
minecraft:knockback: 2
attributes:
- attribute: MAX_HEALTH
operation: ADD_VALUE
name: 'max_health'
amount: 6
slot: HAND
is-plain: true
update-only:
- NAME
- LORE
update-only
supported values:
MATERIAL
NAME
LORE
CUSTOM_MODEL_DATA
UNBREAKABLE
ITEM_FLAGS
ENCHANTMENTS
ATTRIBUTES
COLOR
POTION_EFFECTS
DURABILITY
HEAD_TEXTURE
By default set to false. If set to true then the custom item can be used as an ingredient in recipes. Example:
items:
ingredient-item:
item:
material: IRON_INGOT
usage: ...
is-ingredient: true
By default set to false. If true the custom item can be put in inventory. Example:
items:
storable-item:
item:
material: IRON_INGOT
usage: ...
can-be-put-in-inventory: true
By default is set to false. If true the custom item will be not dropped on player's death.
items:
our-item:
item:
material: IRON_INGOT
usage: ...
remove-on-death: true
Incorrect:
items:
our-item:
item:
material: IRON_INGOT
usage:
is-plain: true
items:
our-item:
item:
material: IRON_INGOT
is-plain: true
usage: ...
Correct:
items:
our-item:
item:
material: IRON_INGOT
is-plain: true
usage: ...
By default is set to false. If true the custom item will behave like it is a normal one. This property overwrites every property that's alters item's behavior like usage's cancel property, remove-on-death, can-be-put-in-inventory, etc.
items:
our-item:
item:
material: IRON_INGOT
usage: ...
is-plain: true
can-move
property is set to true by default. If set to false then item cannot be moved in inventory.
items:
our-item:
item:
material: IRON_INGOT
usage: ...
can-move: false
In some cases you don't want your items to update theirs appearance after `/sig reload'. For that purpose there is an option that can be turned off.
item-pumpkin:
item:
material: CARVED_PUMPKIN
name: <red><bold>Iono Hat
lore:
- <green>First lore
- <red>Second lore
cmd: 1
attributes: []
auto-update: false # now items appearance won't be update even after /sig reload. By default its true.
Sometimes you want your custom items to be hooked by other plugins, and if you know how those plugins work, then you can add some custom NBT properties like:
items:
our-nbt-item:
item:
material: STICK
nbt:
key-name[string]: 'a string' # 'key-name' tag with a string value: 'a string'
some-list[list:int]: # 'some-list' tag with list of integers assigned to it. Values are [1,2,3,4,5,6]
- 1
- 2
- 3
- 4
- 5
- 6
some-nested-list[list:list:string]: # Nested lists are also supported, so there is no config-bounded limitations
- - 1:1
- 1:2
- 1:3
- - 2:1
- 2:2
- 2:3
test-compound[compound]: # Compounds also supported
inner-compound[compound]: # nested compounds
test-float[float]: 1.0
test-double[double]: .5
test-double2[double]: 5.
test-int[int]: 5
test-byte[byte]: 1
test-short[short]: 7
test-long[long]: 9
test-string[string]: 'some string'
test-byte-array[byte_array]:
- 5
- 2
- 1
test-int-array[int_array]:
- 6
- 4
- 8
test-long-array[long_array]:
- 100
- 50
- 10
The errors format is pretty straight forward. It starts from the root property down to the problematic child. Example error:
[SimpleItemGenerator] Error in configuration config.yml
[SimpleItemGenerator] Error in [items]
[SimpleItemGenerator] Error in [error-item]
[SimpleItemGenerator] Error in [item]
[SimpleItemGenerator] Error in [material]
[SimpleItemGenerator] Unknown material GOLDEN_INGOT. Did you mean: [GOLD_INGOT, GOLDEN_BOOTS, IRON_INGOT, GOLDEN_HOE, GOLDEN_CARROT]
SIG>> Configs weren't reloaded. Check console.
The error says that problem in items.error-item.item.material property. It says that error-item
was misconfigured and suggests GOLD_INGOT.
There how the config.yml looks like:
items:
error-item:
item:
material: GOLDEN_INGOT # << GOLDEN_INGOT is incorrect, the correct material is GOLD_INGOT
Some features are still being developed, but if a feature is too complex or buggy, then it gets delayed. Those features will be eventually polished and then enabled by default.
To enable or disable a feature you should change your config.yml:
items: ...
features:
ENHANCED_SLOT_PREDICATE: true # disabled by default
Available features so far:
ENHANCED_SLOT_PREDICATE # disabled by default
The actual list of feature tags can be found here.
If you have an item that behaves differently, and you don't know why, then you can use debug properties to debug those items. It will give you a verbose output whenever you use or interact with an item. Example config.yml:
items: ...
debug: true # false by default
tick-debug: true # false by default, can be too verbose, because it getting triggered every tick on every item
Usually, it's being used by the developers. But if it can help you, why not?
If you suspect SimpleItemGenerator of causing lags on your server, then report the issue and try decreasing the update rate for placeholders and item tick usage.
config.yml:
items:...
placeholder-update-period: 10t # updates once per 10 ticks, can be also seconds(s), minutes(m), millis(no time indentifier) and hours(h). Default values is 10t
item-update-period: 1t # the same time format as for placeholder-update-period. By default its set to 1. Supported since 1.10.0
# other properties
Since 1.9.0 you can create many item configurations in items
within SimpleItemGenerator
plugin folder.
The plugin's folder structure:
SimpleItemGenerator
├── config.yml
├── cooldowns
│ └── cooldowns.yml
├── items # folder where items configurations are stored
│ └── example.yml # example configuration, you can rename or delete it
└── lang.yml
the structure of every .yml file within items
folder should be like config.yml
's like, but there will be only items
root key.
config.yml
structure:
items: ... # your items are being set here
# config.yml only properties
placeholder-update-period: 10t
item-update-period: 1t
check-for-updates: true
send-welcome-message: true
send-invalid-item-message: true
debug: false
tick-debug: false
features: {}
items/<any-name>.yml
's file structure:
items: ... # your items here, the same as config.yml's one
# other root properties you could find in config.yml are not available here and cannot be accessed through this config
how to access the items those are set in items/<any-name>.yml
?
With /sig give <your-file-name>:<your-item-key>
command. The name you gave to your configuration will be used as a namespace.
For instance we've created items/my-cool-configuration.yml
configuration, then the folder tree would look like this:
SimpleItemGenerator
├── config.yml
├── cooldowns
│ └── cooldowns.yml
├── items
│ └── my-cool-configuration.yml # <------------- there is the configuration
└── lang.yml
lets define items/my-cool-configuration.yml
:
items:
my-cool-item:
item:
material: STICK
name: <white><bold>Yeah, I am very cool
Don't forget to reload our plugin so it will hook our changes: /sig reload
.
Then let's give ourselves the item: /sig give my-cool-configuration:my-cool-item
.
You can create as many configurations within items
directory as you want.
There are cases when you don't want the user to see the scary error about some items not being defined in your configuration files.
In order to disable those messages simply set send-invalid-item-message
to false
in config.yml
like:
items: ...
send-invalid-item-message: false # true by default