Enchantments on signs.

Discussion in 'Spigot Plugin Development' started by CMCosMic, Jan 14, 2019.

  1. Is there any way I could put enchantments on a sign that increase the level by one? For example,
    if you have a level 3 efficiency pickaxe, and you right click the sign, it adds one level for $1000. Then you take the SAME pickaxe, use the same sign and increase the level again for $1000. I know essentials makes it so you can do enchants on signs, but I mean increase a level each time instead of setting it.
     
  2. First of all the sign format should be

    [Enchant]
    Enchant_Name
    Level

    Make a listener for interact event, check if the clicked block is a sign using getType().equals()

    Cast the block into Sign, and check for the first line if its equals to [Enchant], now proceed into the next lines. You should know what to do next.

    For adding the level you can get the current same enchant, and get the level + the level from the sign. And then add it back into the item. Also make sure to ignore the safe enchant bool