mirror of
https://github.com/Auxilor/Reforges.git
synced 2026-01-04 15:41:40 +00:00
Added support for item placeholders
This commit is contained in:
@@ -6,6 +6,7 @@ import com.willfp.eco.core.display.DisplayPriority
|
||||
import com.willfp.eco.core.display.DisplayProperties
|
||||
import com.willfp.eco.core.fast.FastItemStack
|
||||
import com.willfp.eco.core.fast.fast
|
||||
import com.willfp.eco.core.placeholder.context.placeholderContext
|
||||
import com.willfp.eco.util.SkullUtils
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.eco.util.formatEco
|
||||
@@ -47,12 +48,15 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
|
||||
|
||||
val reforge = fast.persistentDataContainer.reforge
|
||||
|
||||
val context = placeholderContext(
|
||||
player = player,
|
||||
item = itemStack
|
||||
)
|
||||
|
||||
if (reforge == null && stone == null) {
|
||||
if (plugin.configYml.getBool("reforge.show-reforgable")) {
|
||||
if (plugin.configYml.getBool("reforge.no-reforgable-in-gui")) {
|
||||
if (props.inGui) {
|
||||
return
|
||||
}
|
||||
if (props.inGui) {
|
||||
return
|
||||
}
|
||||
|
||||
val addLore: MutableList<String> = ArrayList()
|
||||
@@ -91,10 +95,11 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
|
||||
for (string in plugin.configYml.getFormattedStrings("reforge.reforged-prefix")) {
|
||||
addLore.add(Display.PREFIX + string.replace("%reforge%", reforge.name))
|
||||
}
|
||||
addLore.addAll(reforge.description)
|
||||
addLore.addAll(reforge.description.formatEco(context))
|
||||
addLore.replaceAll { "${Display.PREFIX}$it" }
|
||||
lore.addAll(addLore)
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("reforge.display-in-name")) {
|
||||
val displayName = fastItemStack.displayNameComponent
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class Reforge(
|
||||
|
||||
val namePrefixComponent = StringUtils.toComponent("$name ").decoration(TextDecoration.ITALIC, false)
|
||||
|
||||
val description: List<String> = config.getFormattedStrings("description")
|
||||
val description: List<String> = config.getStrings("description")
|
||||
|
||||
val targets = config.getStrings("targets").mapNotNull { ReforgeTargets.getByName(it) }.toSet()
|
||||
|
||||
|
||||
@@ -146,12 +146,11 @@ reforge:
|
||||
reforgable-suffix:
|
||||
- ""
|
||||
- "&8This item can be reforged!"
|
||||
no-reforgable-in-gui: true # Not perfect, won't work 100% of the time
|
||||
# due to how GUIs are handled differently in different plugins, but should help.
|
||||
|
||||
display-in-lore: true
|
||||
display-in-name: true
|
||||
|
||||
# The lore to display if an item is reforged, above the reforge description
|
||||
reforged-prefix:
|
||||
- ""
|
||||
- "%reforge%"
|
||||
|
||||
Reference in New Issue
Block a user