mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-20 23:49:21 +00:00
Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d68c7b1f43 | ||
|
|
1a14a11aa4 | ||
|
|
ff3af6b412 | ||
|
|
7bd43e6506 | ||
|
|
89c9935801 | ||
|
|
e15d6be301 | ||
|
|
d75a301cfa | ||
|
|
319afce452 | ||
|
|
8932593683 | ||
|
|
3fa95a5576 | ||
|
|
b5ec89f5d4 | ||
|
|
508c1e1d66 | ||
|
|
d921254584 | ||
|
|
2160fb5acc | ||
|
|
536b1d9dbf | ||
|
|
cef4abcfad | ||
|
|
7414ce787a | ||
|
|
d90fcc0d1a | ||
|
|
84e02044e1 | ||
|
|
19097fb7b5 | ||
|
|
8d86487eb6 | ||
|
|
32bf727816 | ||
|
|
023ae3d10e | ||
|
|
070b95eb94 | ||
|
|
a65f5add37 | ||
|
|
31a7b0f62f | ||
|
|
b11e34e823 | ||
|
|
cabae5c469 | ||
|
|
c930b89c8d | ||
|
|
9a6945c824 | ||
|
|
10a2e9ca7f | ||
|
|
22b18f7b24 | ||
|
|
a09444f3c0 | ||
|
|
df7e85e27b | ||
|
|
35ceb4bc68 | ||
|
|
89ecd11695 | ||
|
|
7b3b287f71 | ||
|
|
3f55d5a141 | ||
|
|
d2a925ec3e | ||
|
|
4e3128840f | ||
|
|
4074531b01 | ||
|
|
f506b10552 | ||
|
|
69e0ed176d | ||
|
|
31464a7ff7 | ||
|
|
182b4a354a | ||
|
|
d9315dfda9 | ||
|
|
4270804b1b | ||
|
|
ce7922ebfd | ||
|
|
abf4b71271 | ||
|
|
6e388e0372 | ||
|
|
be8bdf6b48 | ||
|
|
3884a8859c | ||
|
|
d898448e35 | ||
|
|
115aa6af07 | ||
|
|
a3dd390dc4 | ||
|
|
23ac0ee77c | ||
|
|
b6dbb08a00 | ||
|
|
58eb7b482c | ||
|
|
6ca8bbe3ab | ||
|
|
6da6cb84f0 | ||
|
|
a60cf095c0 | ||
|
|
ef9cb40e36 | ||
|
|
eea580b3c7 | ||
|
|
36d0c4048d | ||
|
|
782b4b4fe4 | ||
|
|
55b259360a | ||
|
|
18adf6fce6 | ||
|
|
7f07c4805d | ||
|
|
4529de3711 | ||
|
|
c723384060 | ||
|
|
4f40b69d64 | ||
|
|
14af73dbe4 | ||
|
|
bbae779308 | ||
|
|
d049430007 | ||
|
|
0d20247aa1 | ||
|
|
a9ed6d23cc | ||
|
|
38cf28faa9 | ||
|
|
f7a77351c7 | ||
|
|
28075b9ace | ||
|
|
4ce594c7ee | ||
|
|
18a793de8d | ||
|
|
f31ae82e61 | ||
|
|
4616fa0d88 | ||
|
|
16dd116151 | ||
|
|
d4451542d8 |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @WillFP
|
||||
@@ -37,7 +37,7 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.willfp:eco:6.53.0")
|
||||
compileOnly("com.willfp:eco:6.56.0")
|
||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
|
||||
}
|
||||
|
||||
@@ -11,9 +11,12 @@ dependencies {
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
register("maven", MavenPublication::class) {
|
||||
from(components["java"])
|
||||
register<MavenPublication>("maven") {
|
||||
groupId = project.group.toString()
|
||||
version = project.version.toString()
|
||||
artifactId = rootProject.name
|
||||
|
||||
artifact(rootProject.tasks.shadowJar.get().archiveFile)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class CommandApply(
|
||||
if (sender is Player) {
|
||||
val item = sender.inventory.itemInMainHand
|
||||
item.reforge = reforge
|
||||
reforge.runOnReforgeEffects(sender, item)
|
||||
sender.sendMessage(
|
||||
plugin.langYml.getMessage("applied-reforge")
|
||||
.replace("%reforge%", reforge.name)
|
||||
@@ -45,7 +46,10 @@ class CommandApply(
|
||||
return
|
||||
}
|
||||
|
||||
player.inventory.itemInMainHand.reforge = reforge
|
||||
val item = player.inventory.itemInMainHand
|
||||
|
||||
item.reforge = reforge
|
||||
reforge.runOnReforgeEffects(player, item)
|
||||
sender.sendMessage(
|
||||
plugin.langYml.getMessage("applied-reforge")
|
||||
.replace("%reforge%", reforge.name)
|
||||
|
||||
@@ -6,10 +6,13 @@ 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
|
||||
import com.willfp.eco.util.toJSON
|
||||
import com.willfp.libreforge.ItemProvidedHolder
|
||||
import com.willfp.libreforge.ProvidedHolder
|
||||
import com.willfp.reforges.ReforgesPlugin
|
||||
import com.willfp.reforges.reforges.ReforgeTargets
|
||||
import com.willfp.reforges.util.reforge
|
||||
@@ -45,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()
|
||||
@@ -89,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
|
||||
|
||||
@@ -111,7 +118,9 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
|
||||
|
||||
|
||||
if (player != null) {
|
||||
val lines = reforge.conditions.getNotMetLines(player).map { Display.PREFIX + it }
|
||||
val provided = ItemProvidedHolder(reforge, itemStack)
|
||||
|
||||
val lines = provided.getNotMetLines(player).map { Display.PREFIX + it }
|
||||
|
||||
if (lines.isNotEmpty()) {
|
||||
lore.add(Display.PREFIX)
|
||||
|
||||
@@ -150,6 +150,8 @@ private class ActivatorSlot(
|
||||
item.timesReforged++
|
||||
item.reforge = reforge
|
||||
|
||||
reforge.runOnReforgeEffects(player, item)
|
||||
|
||||
if (usedStone) {
|
||||
val stone = reforgeStone[player]
|
||||
stone?.amount = stone?.amount?.minus(1) ?: 0
|
||||
|
||||
@@ -11,12 +11,15 @@ import com.willfp.eco.core.recipe.Recipes
|
||||
import com.willfp.eco.core.registry.Registrable
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.libreforge.Holder
|
||||
import com.willfp.libreforge.ItemProvidedHolder
|
||||
import com.willfp.libreforge.ViolationContext
|
||||
import com.willfp.libreforge.conditions.Conditions
|
||||
import com.willfp.libreforge.effects.Effects
|
||||
import com.willfp.libreforge.triggers.TriggerData
|
||||
import com.willfp.reforges.ReforgesPlugin
|
||||
import com.willfp.reforges.util.reforgeStone
|
||||
import net.kyori.adventure.text.format.TextDecoration
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import java.util.Objects
|
||||
|
||||
@@ -30,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()
|
||||
|
||||
@@ -73,6 +76,11 @@ class Reforge(
|
||||
}
|
||||
} else null
|
||||
|
||||
private val onReforgeEffects = Effects.compileChain(
|
||||
config.getSubsections("on-reforge-effects"),
|
||||
ViolationContext(plugin, "Reforge $id").with("on-reforge-effects")
|
||||
)
|
||||
|
||||
init {
|
||||
stone.reforgeStone = this
|
||||
|
||||
@@ -98,6 +106,17 @@ class Reforge(
|
||||
return targets.any { target -> target.items.any { it.matches(item) } }
|
||||
}
|
||||
|
||||
fun runOnReforgeEffects(player: Player, item: ItemStack) {
|
||||
onReforgeEffects?.trigger(
|
||||
player,
|
||||
TriggerData(
|
||||
holder = ItemProvidedHolder(this, item),
|
||||
player = player,
|
||||
item = item
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getID(): String {
|
||||
return this.id.key
|
||||
}
|
||||
|
||||
@@ -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%"
|
||||
|
||||
@@ -54,3 +54,6 @@ effects:
|
||||
|
||||
# The conditions required to use the reforge
|
||||
conditions: [ ]
|
||||
|
||||
# Effects to run when the reforge is applied to an item.
|
||||
on-reforge-effects: [ ]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#libreforge-updater
|
||||
#Wed Mar 29 15:46:54 BST 2023
|
||||
#Fri Nov 17 19:01:58 GMT 2023
|
||||
kotlin.code.style=official
|
||||
libreforge-version=4.0.0
|
||||
version=6.0.0
|
||||
libreforge-version=4.43.0
|
||||
version=6.43.0
|
||||
|
||||
Reference in New Issue
Block a user