Updated description to be formatted per-talisman

This commit is contained in:
Auxilor
2021-12-18 19:39:04 +00:00
parent 050f9447b3
commit 1abb6f2bca
5 changed files with 15 additions and 25 deletions

View File

@@ -26,9 +26,9 @@ class TalismanDisplay(plugin: EcoPlugin) : DisplayModule(plugin, DisplayPriority
meta.setCustomModelData(talisman.itemStack.itemMeta?.customModelData)
}
val lore: MutableList<String?> = ArrayList()
val lore = mutableListOf<String>()
lore.addAll(talisman.formattedDescription)
lore.addAll(talisman.description)
lore.addAll(itemLore)
meta.lore = lore

View File

@@ -7,7 +7,6 @@ import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.builder.ItemStackBuilder
import com.willfp.eco.core.recipe.parts.EmptyTestableItem
import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe
import com.willfp.eco.util.StringUtils
import com.willfp.libreforge.Holder
import com.willfp.libreforge.conditions.Conditions
import com.willfp.libreforge.effects.Effects
@@ -15,14 +14,13 @@ import com.willfp.talismans.TalismansPlugin
import com.willfp.talismans.talismans.util.TalismanChecks
import com.willfp.talismans.talismans.util.TalismanUtils
import org.apache.commons.lang.Validate
import org.apache.commons.lang.WordUtils
import org.bukkit.Bukkit
import org.bukkit.NamespacedKey
import org.bukkit.inventory.ItemStack
import org.bukkit.permissions.Permission
import org.bukkit.permissions.PermissionDefault
import org.bukkit.persistence.PersistentDataType
import java.util.Objects
import java.util.*
class Talisman(
private val config: Config,
@@ -34,13 +32,7 @@ class Talisman(
val name = config.getFormattedString("name")
val description = config.getFormattedString("description")
val formattedDescription: List<String> =
WordUtils.wrap(description, plugin.configYml.getInt("description.wrap"), "\n", false)
.split("[\\r\\n]+")
.toTypedArray()
.map { "${Display.PREFIX}${StringUtils.format(plugin.langYml.getString("description-color"))}$it" }
val description = config.getFormattedStrings("description")
val itemStack: ItemStack = run {
val item = Items.lookup(config.getString("item"))

View File

@@ -3,10 +3,6 @@
# by Auxilor
#
description:
# How many characters to have on each line of description.
wrap: 20
crafting:
discover: true # If players should automatically have recipes added to their crafting table.

View File

@@ -9,6 +9,4 @@ messages:
needs-talisman: "&cYou must specify a talisman"
invalid-talisman: "&cInvalid talisman!"
invalid-level: "&cLevel doesn't exist!"
give-success: "Gave &a%talisman%&r to &a%recipient%"
description-color: "&8"
give-success: "Gave &a%talisman%&r to &a%recipient%"

View File

@@ -1,7 +1,8 @@
talismans:
- id: "archery_1"
name: "&aArchery Talisman I"
description: Deal 10% more damage with bows
description:
- &8Deal 10% more damage with bows
item: "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDBmOGRmYTVlZmM3NTYzMGNlMGRmNDBhNDliOGY1OWJjMjIyMTRkZTk3ZTNmYjQ0YjNjNTZlOGE5YzhhNTZiNiJ9fX0="
craftable: true
recipe:
@@ -25,7 +26,7 @@ talismans:
conditions: []
- id: "archery_2"
name: "&eArchery Talisman II"
description: Deal 20% more damage with bows
- &8Deal 20% more damage with bows
item: "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzgzODVhNWE0Njk4MjFiOGIzM2U0N2E1YjVjNDJhZWE1OTY2MzQ2NTQ2OTM4OGExYTRkNGU1MjNlNWE4ZGRkMiJ9fX0="
craftable: true
recipe:
@@ -49,7 +50,7 @@ talismans:
conditions: []
- id: "archery_3"
name: "&cArchery Talisman III"
description: Deal 40% more damage with bows
- &8Deal 40% more damage with bows
item: "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYmQ3NDk5NWQ2Y2RhMmI4YTI0NzcyYWY5NjllZjA3N2FlM2E4NWUyMzU3YzZmNjExOWI4YTI1MDYwNDFhNDQ4YiJ9fX0="
craftable: true
recipe:
@@ -74,7 +75,8 @@ talismans:
- id: "attack_speed_1"
name: "&aAttack Speed Talisman I"
description: Attack 5% faster.
description:
- &8Attack 5% faster.
item: "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTVmZGRlYzM2NjU1ZDNiMzcxYzc5ZDYxMTMzNTQ4Nzc1NzcwODljMWZjYjFiM2Q4ZTAwYWYzMjYxMmYyNmYyOCJ9fX0="
craftable: true
recipe:
@@ -96,7 +98,8 @@ talismans:
conditions: []
- id: "attack_speed_2"
name: "&eAttack Speed Talisman II"
description: Attack 10% faster.
description:
- &8Attack 10% faster.
item: "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzE1ZjAyZWFjNjAyNmI4ZTg3MTJjYTRkNzgxYjc5MWJiYmI3YjQ3NTVhYmRhMjdmNDYyMTg5YjkwZmVkNjZhMSJ9fX0="
craftable: true
recipe:
@@ -118,7 +121,8 @@ talismans:
conditions: []
- id: "attack_speed_3"
name: "&cAttack Speed Talisman III"
description: Attack 25% faster.
description:
- &8Attack 25% faster.
item: "player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjI2NjQ5MmZmMDk2MjRmZTdkYzA4MGI0YWE1ZjRiNjA4N2E3NTYzZmEwMjA3ZGY4NzdjZTUwZDI1OWE3NzM3NCJ9fX0="
craftable: true
recipe: