Solved Set enchant limit.

Discussion in 'Plugin Development' started by LegoPal92, Jul 20, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    LegoPal92

    Is there a way to set the maximum amount of enchantments that can be on a sword? For instance, with the enchanting table, if there are going to be five enchants, rare, but I have seen it happen, it would limit it to four. Is that possible? I should think it would be.
     
  2. Offline

    Compressions

    LegoPal92 Not sure if this will work, but listen for EnchantItemEvent, and check if the size of the getEnchantsToAdd() Map is greater than 4, and cancel the event. If you can't cancel the event, get an Enchantment from the Map key and remove that Enchantment from the enchanted item.
     
  3. Offline

    LegoPal92

    That seems like it should work, thanks!
     
Thread Status:
Not open for further replies.

Share This Page