9
0
mirror of https://github.com/Auxilor/Reforges.git synced 2025-12-22 16:39:34 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Auxilor
d68c7b1f43 libreforge-updater 2023-11-17 19:01:58 +00:00
Auxilor
1a14a11aa4 libreforge-updater 2023-11-11 17:58:28 +00:00
Auxilor
ff3af6b412 Added support for item placeholders 2023-11-11 15:00:10 +00:00
Auxilor
7bd43e6506 Updated not-met-lines 2023-11-11 14:51:25 +00:00
4 changed files with 16 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ import com.willfp.eco.core.display.DisplayPriority
import com.willfp.eco.core.display.DisplayProperties import com.willfp.eco.core.display.DisplayProperties
import com.willfp.eco.core.fast.FastItemStack import com.willfp.eco.core.fast.FastItemStack
import com.willfp.eco.core.fast.fast 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.SkullUtils
import com.willfp.eco.util.StringUtils import com.willfp.eco.util.StringUtils
import com.willfp.eco.util.formatEco import com.willfp.eco.util.formatEco
@@ -47,12 +48,15 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
val reforge = fast.persistentDataContainer.reforge val reforge = fast.persistentDataContainer.reforge
val context = placeholderContext(
player = player,
item = itemStack
)
if (reforge == null && stone == null) { if (reforge == null && stone == null) {
if (plugin.configYml.getBool("reforge.show-reforgable")) { if (plugin.configYml.getBool("reforge.show-reforgable")) {
if (plugin.configYml.getBool("reforge.no-reforgable-in-gui")) { if (props.inGui) {
if (props.inGui) { return
return
}
} }
val addLore: MutableList<String> = ArrayList() 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")) { for (string in plugin.configYml.getFormattedStrings("reforge.reforged-prefix")) {
addLore.add(Display.PREFIX + string.replace("%reforge%", reforge.name)) addLore.add(Display.PREFIX + string.replace("%reforge%", reforge.name))
} }
addLore.addAll(reforge.description) addLore.addAll(reforge.description.formatEco(context))
addLore.replaceAll { "${Display.PREFIX}$it" } addLore.replaceAll { "${Display.PREFIX}$it" }
lore.addAll(addLore) lore.addAll(addLore)
} }
if (plugin.configYml.getBool("reforge.display-in-name")) { if (plugin.configYml.getBool("reforge.display-in-name")) {
val displayName = fastItemStack.displayNameComponent val displayName = fastItemStack.displayNameComponent
@@ -115,7 +120,7 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
if (player != null) { if (player != null) {
val provided = ItemProvidedHolder(reforge, itemStack) val provided = ItemProvidedHolder(reforge, itemStack)
val lines = reforge.conditions.getNotMetLines(player, provided).map { Display.PREFIX + it } val lines = provided.getNotMetLines(player).map { Display.PREFIX + it }
if (lines.isNotEmpty()) { if (lines.isNotEmpty()) {
lore.add(Display.PREFIX) lore.add(Display.PREFIX)

View File

@@ -33,7 +33,7 @@ class Reforge(
val namePrefixComponent = StringUtils.toComponent("$name ").decoration(TextDecoration.ITALIC, false) 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() val targets = config.getStrings("targets").mapNotNull { ReforgeTargets.getByName(it) }.toSet()

View File

@@ -146,12 +146,11 @@ reforge:
reforgable-suffix: reforgable-suffix:
- "" - ""
- "&8This item can be reforged!" - "&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-lore: true
display-in-name: true display-in-name: true
# The lore to display if an item is reforged, above the reforge description
reforged-prefix: reforged-prefix:
- "" - ""
- "%reforge%" - "%reforge%"

View File

@@ -1,5 +1,5 @@
#libreforge-updater #libreforge-updater
#Fri Nov 10 13:58:55 GMT 2023 #Fri Nov 17 19:01:58 GMT 2023
kotlin.code.style=official kotlin.code.style=official
libreforge-version=4.41.0 libreforge-version=4.43.0
version=6.41.0 version=6.43.0