WolfyScript / CustomCrafting

Spigot based plugin to create your own custom Recipes & Items. Designed to be easy to use with in-game GUI and tons of configuration possibilities.
https://modrinth.com/plugin/customcrafting
GNU General Public License v3.0
114 stars 36 forks source link

Add Exlude Option to Lore, Book & Banner Merge Adapter #300

Closed WolfyScript closed 1 year ago

WolfyScript commented 1 year ago

This adds a few new features to the element options used by the lore, book, and banner merge adapter. Additionally, the value property can have an array of values now to provide an easier way to include/exclude values.

Examples

Compact value inclusions

Something like this pre-update:

{
  key: "customcrafting:display_lore",
  lines: [
    {
      value = "<grey>Special Enchant III</grey>"
    },
    {
      value = "<grey>Special Enchant IV</grey>"
    },
    {
      value = "<grey>Special Enchant V</grey>"
    }
  ]
}

Can be changed to this:

{
  key: "customcrafting:display_lore",
  lines: [
    {
      value = [
        "<grey>Special Enchant III</grey>",
        "<grey>Special Enchant IV</grey>",
        "<grey>Special Enchant V</grey>"
      ]
    }
  ]
}

Same for indices:

{
  key: "customcrafting:display_lore",
  lines: [
    {
      index = 1
    },
    {
      index = 2
    },
    {
      index = 3
    }
  ]
}

Can be changed to this:

{
  key: "customcrafting:display_lore",
  lines: [
    {
      indices = [ 1, 2, 3 ]
    }
  ]
}

Exclusion

Now it is possible to exclude specific values and indices from the ingredient lore/book/banner.

Excludes the first 3 lines/pages/patterns:

{
  key: "customcrafting:display_lore", // or "customcrafting:book", "customcrafting:banner"
  lines: [
    {
      indices = [ 0, 1, 2 ]
      exclude = true
    }
  ]
}

Excludes the lines/pages/patterns matching any of the values:

{
  key: "customcrafting:display_lore", // similar for "customcrafting:book", and "customcrafting:banner", just with other value options!
  lines: [
    {
      values = [
        "<grey>Special Enchant III</grey>",
        "<grey>Special Enchant IV</grey>",
        "<grey>Special Enchant V</grey>"
      ]
      exclude = true
    }
  ]
}

You may even combine both values and indices. Excludes the matching values in the first 3 lines/pages/patterns:

{
  key: "customcrafting:display_lore", // similar for "customcrafting:book", and "customcrafting:banner", just with other value options!
  lines: [
    {
      indices = [ 0, 1, 2 ]
      values = [
        "<grey>Special Enchant III</grey>",
        "<grey>Special Enchant IV</grey>",
        "<grey>Special Enchant V</grey>"
      ]
      exclude = true
    }
  ]
}