Skip to content

L | Utility: OneTimeCraftUtils

Sartaj Singh edited this page May 29, 2025 · 4 revisions

L | Utility: OneTimeCraftUtils

OneTimeCraftUtils lets you enforce "legendary" items that can only be crafted once on the whole server.


1. registerOneTimeItem(Class<?> itemClass)

What it does:
Marks an item as craftable only one time ever.

Example:

OneTimeCraftUtils.registerOneTimeItem(LegendarySword.class);

2. hasBeenCrafted(Class<?> itemClass): boolean

What it does:
Checks whether the legendary item was already crafted.

Example:

if (OneTimeCraftUtils.hasBeenCrafted(LegendarySword.class)) {
    player.sendMessage("This item can only be crafted once!");
}

3. getRegisteredItems(): Map<String, OneTimeCraftItem>

What it does:
Returns a map of all registered one-time craft items and their status.


Usage Patterns

  • Use in crafting event listeners to cancel crafting if already crafted.
  • Display a message to let players know why crafting is blocked.
  • Good for ultra-rare, server-unique items.

Clone this wiki locally