mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-30 20:39:13 +00:00
Lots of under-the-hood work
This commit is contained in:
@@ -60,7 +60,7 @@ public class Reforges {
|
||||
}
|
||||
|
||||
for (JSONConfig config : plugin.getReforgesJson().getSubsections("reforges")) {
|
||||
addNewReforge(new Reforge(config, plugin));
|
||||
new Reforge(config, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,10 +65,12 @@ class ReforgesDisplay(private val plugin: ReforgesPlugin) : DisplayModule(plugin
|
||||
|
||||
if (stone != null) {
|
||||
meta.setDisplayName(plugin.configYml.getString("reforge.stone.name").replace("%reforge%", stone.name))
|
||||
SkullUtils.setSkullTexture(
|
||||
meta as SkullMeta,
|
||||
stone.config.getString("stone.texture")
|
||||
)
|
||||
if (stone.config.has("stone.texture") && stone.config.getString("stone.texture").isNotEmpty()) {
|
||||
SkullUtils.setSkullTexture(
|
||||
meta as SkullMeta,
|
||||
stone.config.getString("stone.texture")
|
||||
)
|
||||
}
|
||||
itemStack.itemMeta = meta
|
||||
val stoneLore = plugin.configYml.getStrings("reforge.stone.lore").map {
|
||||
"${Display.PREFIX}${it.replace("%reforge%", stone.name)}"
|
||||
|
||||
@@ -27,6 +27,7 @@ object ReforgeGUI {
|
||||
update(ReforgesPlugin.getInstance())
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ConfigUpdater
|
||||
fun update(plugin: EcoPlugin) {
|
||||
val handler = ReforgeHandler(plugin)
|
||||
@@ -39,13 +40,13 @@ object ReforgeGUI {
|
||||
|
||||
val (status, specialCost) = ReforgeUtils.getStatus(menu.getCaptiveItems(player))
|
||||
|
||||
val cost: Double = when (status) {
|
||||
ReforgeStatus.ALLOW -> {
|
||||
val cost: Double = when {
|
||||
status == ReforgeStatus.ALLOW || (status == ReforgeStatus.ALLOW_STONE && specialCost < 0) -> {
|
||||
val amountOfReforges = ReforgeUtils.getReforges(menu.getCaptiveItems(player)[0])
|
||||
plugin.configYml.getDouble("reforge.cost") *
|
||||
plugin.configYml.getDouble("reforge.cost-exponent").pow(amountOfReforges)
|
||||
}
|
||||
ReforgeStatus.ALLOW_STONE -> {
|
||||
status == ReforgeStatus.ALLOW_STONE -> {
|
||||
specialCost
|
||||
}
|
||||
else -> 0.0 // Never used, but at least kotlin can shut up
|
||||
@@ -101,6 +102,8 @@ object ReforgeGUI {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
previous.itemMeta = meta
|
||||
}
|
||||
onLeftClick(handler::handleReforgeClick)
|
||||
}.build()
|
||||
|
||||
@@ -53,8 +53,12 @@ class Reforge(
|
||||
val stonePrice = config.getIntOrNull("stone.price") ?: -1
|
||||
|
||||
init {
|
||||
Reforges.addNewReforge(this)
|
||||
|
||||
ReforgeUtils.setReforgeStone(stone, this)
|
||||
|
||||
Display.display(stone)
|
||||
|
||||
CustomItem(
|
||||
plugin.namespacedKeyFactory.create("stone_" + this.id),
|
||||
{ test -> ReforgeUtils.getReforgeStone(test) == this },
|
||||
|
||||
Reference in New Issue
Block a user