Skip to main content
Other plugins can use Lode Items through its Java API in the org.lodemc.api package. Build your own mechanics on top of Lode Items content, let server owners configure them in the same YAML files, and ship your models and textures in the same resource pack. The API is written in Kotlin and is called from Java like any Java library. Every example on these pages is Java.

Setting up

1

Compile against the Lode Items jar

Put the Lode Items jar in your project, for example in libs/, and add it as a compile-only dependency. Don’t shade it into your plugin.
2

Depend on Lode Items

Lode Items must load before your plugin, and your plugin must be able to see its classes.
With softdepend or required: false, check that Lode Items is enabled before you touch any org.lodemc.api class.

When to call what

Lode Items loads its content in its own onEnable, which runs after every plugin’s onLoad and before your onEnable. So: Everything you register is removed when your plugin disables.

Things to know

  • Call the API from the main thread. The one exception is crop rules, which Lode Items calls itself.
  • Ids are Adventure keys, such as Key.key("lodeitems", "ruby"). Methods that also take a String read ruby as lodeitems:ruby. A namespaced id like myserver:ruby is kept as written. LodeItemsApi.key("ruby") does the same conversion for you.
  • Content changes on /lodeitems reload. Items, blocks, props and crops can be added, changed or removed. Objects you got from the API before a reload are out of date afterwards, so look them up again on LodeItemsLoadEvent. Placed blocks and props in the world stay where they are.
  • Bukkit can’t tell custom blocks apart. It reports a generic Material for all of them: STONE for solid blocks, GLASS for see-through blocks, and TRIPWIRE for walk-through blocks and crops. Use LodeBlocks.at to find out what a block really is.
  • Normal Bukkit events still fire for custom content, such as BlockPlaceEvent, BlockBreakEvent and PlayerInteractEvent. See Vanilla events.
  • Free and licensed editions don’t change the API. The free edition loads fewer items, blocks and plants, so the API only sees what loaded.

Example: a mana cost on any item

This short plugin lets owners write mana-cost: on any Lode Items item, and reads it when a player right-clicks:
items/weapons/fire_staff.yml