The plugin requires MythicLib and MMOItems as dependencies to run.
This is a simple plugin developed for my server to add various custom stats to MMOItems.
The stats themselves have
no features, in short, adding an stat called "Enchantment Slot" doesn't really limit the number of enchantments on an item, the stat is just be displayed there.
I personally use the
Skript plugin to create features for these stats.
Here is an example of the plugin config:
Code (YAML):
stats:
ENCHANTMENT_SLOT
:
# The stat ID, must in uppercase.
type
: double
# The stat type that determines what values this stat can have. Allowed value is string, double, boolean and string_list.
displayed-material
: ENDER_EYE
# Display icon in /mi browse item edit gui.
displayed-name
: 'Enchantment Slot'
# Display name in /mi browse item edit gui.
displayed-lore
:
# Display lore in /mi browse item edit gui.
-
"How many enchantment can an item hold."
-
"Featured by Skript."
disallowed-types
:
# The MMOItems type of item to which this stat cannot be added.
- 'consumable'
- 'miscellaneous'
And here is the effect in game:
After that, in order for your added stats to be displayed in the item's lore, you need to go to the
plugins/MMOItems/language folder and modify lore-format.yml and stats.yml to add lore based on your stat ID.
Here is the example:
Code (Text):
stats.yml:
enchantment-slot: ' &7+ &fEnchantment Slot: &f{value}'
lore-format.yml:
- '#enchantment-slot#'
Then, I will use the API provided by MythicLib or NBT to get the values of these stats and make features for them in Skript. Here is a small example of it:
Code (Text):
# Get the stats named max_weight and max_weight_boost on the player and calculate the final max_weight.
# Need a Skript addon called skript-reflect
# https://github.com/TPGamesNL/skript-reflect/releases
import:
net.Indyuce.mmoitems.MMOItems
net.Indyuce.mmoitems.stat.type.ItemStat
io.lumine.mythic.lib.api.player.MMOPlayerData
io.lumine.mythic.lib.api.stat.StatMap
function getMaxWeight(player: player) :: number:
set {_playerData} to MMOPlayerData.get({_player})
set {_statMap} to {_playerData}.getStatMap()
set {_add} to {_statMap}.getStat("MAX_WEIGHT") * ( 1 + {_statMap}.getStat("MAX_WEIGHT_BOOST") / 100 )
return {_add} + getBaseMaxWeight({_player})
# Get the enchantment_slot stat value on an item
# Need a Skript addon called SkBee
# https://www.spigotmc.org/resources/skbee-skript-addon.75839/
function getEnchantmentSlot(item: item) :: number:
set {_nbt} to full nbt compound of {_item}
return tag "tag;MMOITEMS_ENCHANTMENT_SLOT" of {_nbt}
Also, since this is a simple plugin for my own use, bugs reported by other users may not be actively fixed. Besides, this is the first plugin I have written after a period of first contact with JAVA, so the code may be full of errors and omissions, so please bear with me.