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

Compare commits

..

36 Commits

Author SHA1 Message Date
Auxilor
3ddf466f2d libreforge-updater 2022-11-01 16:23:07 +00:00
Auxilor
ca41b54daa libreforge-updater 2022-10-28 11:34:59 +01:00
Auxilor
ff9e16a25f libreforge-updater 2022-10-26 22:10:30 +01:00
Auxilor
c0d94f6150 Fix 2022-10-24 17:09:11 +01:00
Auxilor
4b3bf30a9b Fix 2022-10-24 17:08:49 +01:00
Auxilor
4c1ee554b4 libreforge-updater 2022-10-24 17:05:03 +01:00
Auxilor
695d90c793 Fixed reforge stone bug 2022-10-24 12:54:51 +01:00
Auxilor
a67270c09d libreforge-updater 2022-10-21 19:25:56 +01:00
Auxilor
8f23b22a05 libreforge-updater 2022-10-19 20:43:41 +01:00
Auxilor
7279958cca libreforge-updater 2022-10-18 14:13:24 +01:00
Auxilor
6689c3cf23 Fixed GUI, Improved _example.yml 2022-10-18 14:02:09 +01:00
Auxilor
df8357ac61 libreforge-updater 2022-10-16 23:26:48 +01:00
Auxilor
aa0f06092e libreforge-updater 2022-10-13 20:12:39 +01:00
Auxilor
19083d54b8 libreforge-updater 2022-10-10 21:04:09 +01:00
Auxilor
2a6c2941d8 libreforge-updater 2022-10-09 15:02:19 +01:00
Auxilor
757dffb08d libreforge-updater 2022-10-07 19:51:01 +01:00
Auxilor
277a0bef78 libreforge-updater 2022-10-06 12:04:08 +01:00
Auxilor
c7f8b9f97e libreforge-updater 2022-10-04 15:53:05 +01:00
Auxilor
0f97e2dfc4 Fixed reforge GUI 2022-10-04 12:33:52 +01:00
Auxilor
ae503fd646 libreforge-updater 2022-10-03 18:29:16 +01:00
Auxilor
89df16dabe libreforge-updater 2022-10-02 14:57:56 +01:00
Auxilor
c6dfa1849d libreforge-updater 2022-09-28 17:52:47 +01:00
Auxilor
fb4022dfd9 libreforge-updater 2022-09-26 18:27:29 +01:00
Auxilor
60c785717a libreforge-updater 2022-09-26 14:41:56 +01:00
Auxilor
a3810a9ff8 libreforge-updater 2022-09-26 10:51:59 +01:00
Auxilor
3498b575dc libreforge-updater 2022-09-22 17:30:19 +01:00
Auxilor
8f5668d8c4 libreforge-updater 2022-09-21 15:28:42 +01:00
Auxilor
6cde0ca092 libreforge-updater 2022-09-20 10:39:57 +01:00
Auxilor
d54e4ee8d5 libreforge-updater 2022-09-17 15:45:48 +01:00
Auxilor
65ef2a63d2 libreforge-updater 2022-09-15 12:16:42 +01:00
Auxilor
0d1ea5a7c8 libreforge-updater 2022-09-15 12:10:27 +01:00
Auxilor
7d32350eed libreforge-updater 2022-09-14 18:54:05 +01:00
Auxilor
4361ce0407 libreforge-updater 2022-09-14 15:13:49 +01:00
Auxilor
4267f5bd5d libreforge-updater 2022-09-14 15:10:16 +01:00
Auxilor
a5fc6e7436 libreforge-updater 2022-09-14 13:00:33 +01:00
Auxilor
cc5dfc0b0d libreforge-updater 2022-09-13 19:16:01 +01:00
17 changed files with 199 additions and 285 deletions

View File

@@ -44,8 +44,8 @@ allprojects {
} }
dependencies { dependencies {
compileOnly 'com.willfp:eco:6.38.0' compileOnly 'com.willfp:eco:6.44.0'
implementation 'com.willfp:libreforge:3.98.1' implementation 'com.willfp:libreforge:3.117.0'
implementation 'org.joml:joml:1.10.4' implementation 'org.joml:joml:1.10.4'
compileOnly 'org.jetbrains:annotations:23.0.0' compileOnly 'org.jetbrains:annotations:23.0.0'

View File

@@ -1,184 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
https://docs.oracle.com/javase/specs/jls/se11/html/index.html
- the Sun Code Conventions at https://www.oracle.com/java/technologies/javase/codeconventions-contents.html
- the Javadoc guidelines at
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
- the JDK Api documentation https://docs.oracle.com/en/java/javase/11/
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
https://checkstyle.org (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
To suppress certain violations please review suppression filters.
Finally, it is worth reading the documentation.
-->
<module name="Checker">
<module name="SuppressionFilter">
<property name="file" value="config/checkstyle/suppression.xml"/>
</module>
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
https://checkstyle.org/config.html#Checker
<property name="basedir" value="${basedir}"/>
-->
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- Checks whether files end with a new line. -->
<!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- Checks that property files contain the same keys. -->
<!-- See https://checkstyle.org/config_misc.html#Translation -->
<module name="Translation"/>
<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/config_sizes.html -->
<module name="FileLength"/>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="200"/>
</module>
<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/config_whitespace.html -->
<module name="FileTabCharacter"/>
<!-- Miscellaneous other checks. -->
<!-- See https://checkstyle.org/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<!-- Checks for Headers -->
<!-- See https://checkstyle.org/config_header.html -->
<!-- <module name="Header"> -->
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
<!-- <property name="fileExtensions" value="java"/> -->
<!-- </module> -->
<module name="TreeWalker">
<!-- Checks for Javadoc comments. -->
<!-- See https://checkstyle.org/config_javadoc.html -->
<module name="InvalidJavadocPosition"/>
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocStyle"/>
<module name="MissingJavadocMethod"/>
<!-- Checks for Naming Conventions. -->
<!-- See https://checkstyle.org/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Checks for imports -->
<!-- See https://checkstyle.org/config_imports.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/config_sizes.html -->
<!-- <module name="MethodLength"/> -->
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<!-- Modifier Checks -->
<!-- See https://checkstyle.org/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
<!-- See https://checkstyle.org/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See https://checkstyle.org/config_coding.html -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!-- <module name="MagicNumber"/> -->
<module name="MissingSwitchDefault"/>
<module name="MultipleVariableDeclarations"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Checks for class design -->
<!-- See https://checkstyle.org/config_design.html -->
<!-- <module name="DesignForExtension"/> -->
<module name="FinalClass"/>
<!-- <module name="HideUtilityClassConstructor"/> -->
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<module name="RequireThis"/>
<!-- Miscellaneous other checks. -->
<!-- See https://checkstyle.org/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="FinalParameters"/>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<!-- Effects don't need javadoc. -->
<suppress files="[\\/]reforges[\\/]reforges[\\/]" checks="MissingJavadocMethod"/>
<suppress files="[\\/]reforges[\\/]reforges[\\/]" checks="JavadocVariable"/>
<!-- Fields don't need javadoc -->
<suppress files="Reforges.java" checks="JavadocVariable"/>
</suppressions>

View File

@@ -62,10 +62,6 @@ class ReforgesPlugin : LibReforgePlugin() {
) )
} }
override fun getMinimumEcoVersion(): String {
return "6.38.0"
}
companion object { companion object {
/** /**
* Instance of Reforges. * Instance of Reforges.

View File

@@ -1,10 +1,15 @@
package com.willfp.reforges.commands package com.willfp.reforges.commands
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.command.impl.PluginCommand import com.willfp.eco.core.command.impl.PluginCommand
import com.willfp.libreforge.LibReforgePlugin
import com.willfp.libreforge.lrcdb.CommandExport
import com.willfp.libreforge.lrcdb.CommandImport
import com.willfp.libreforge.lrcdb.ExportableConfig
import com.willfp.reforges.reforges.Reforges
import org.bukkit.command.CommandSender import org.bukkit.command.CommandSender
class CommandReforges(plugin: EcoPlugin) : PluginCommand(plugin, "reforges", "reforges.command.reforges", false) { class CommandReforges(plugin: LibReforgePlugin) :
PluginCommand(plugin, "reforges", "reforges.command.reforges", false) {
override fun onExecute(sender: CommandSender, args: List<String>) { override fun onExecute(sender: CommandSender, args: List<String>) {
sender.sendMessage( sender.sendMessage(
plugin.langYml.getMessage("invalid-command") plugin.langYml.getMessage("invalid-command")
@@ -16,5 +21,14 @@ class CommandReforges(plugin: EcoPlugin) : PluginCommand(plugin, "reforges", "re
.addSubcommand(CommandGive(plugin)) .addSubcommand(CommandGive(plugin))
.addSubcommand(CommandOpen(plugin)) .addSubcommand(CommandOpen(plugin))
.addSubcommand(CommandApply(plugin)) .addSubcommand(CommandApply(plugin))
.addSubcommand(CommandImport("reforges", plugin))
.addSubcommand(CommandExport(plugin) {
Reforges.values().map {
ExportableConfig(
it.id,
it.config
)
}
})
} }
} }

View File

@@ -0,0 +1,5 @@
package com.willfp.reforges.gui
import com.willfp.reforges.util.ReforgeStatus
data class PricedReforgeStatus(val status: ReforgeStatus, val cost: Double)

View File

@@ -4,21 +4,21 @@ import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.config.updating.ConfigUpdater import com.willfp.eco.core.config.updating.ConfigUpdater
import com.willfp.eco.core.drops.DropQueue import com.willfp.eco.core.drops.DropQueue
import com.willfp.eco.core.fast.fast import com.willfp.eco.core.fast.fast
import com.willfp.eco.core.gui.captiveSlot
import com.willfp.eco.core.gui.menu import com.willfp.eco.core.gui.menu
import com.willfp.eco.core.gui.menu.Menu import com.willfp.eco.core.gui.menu.Menu
import com.willfp.eco.core.gui.slot import com.willfp.eco.core.gui.slot
import com.willfp.eco.core.gui.slot.FillerMask import com.willfp.eco.core.gui.slot.FillerMask
import com.willfp.eco.core.gui.slot.MaskItems import com.willfp.eco.core.gui.slot.MaskItems
import com.willfp.eco.core.gui.slot.Slot
import com.willfp.eco.core.integrations.economy.EconomyManager import com.willfp.eco.core.integrations.economy.EconomyManager
import com.willfp.eco.core.items.Items import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.builder.ItemStackBuilder import com.willfp.eco.core.items.builder.ItemStackBuilder
import com.willfp.eco.core.items.isEmpty
import com.willfp.eco.util.NumberUtils import com.willfp.eco.util.NumberUtils
import com.willfp.reforges.reforges.PriceMultipliers import com.willfp.reforges.reforges.PriceMultipliers
import com.willfp.reforges.reforges.Reforge import com.willfp.reforges.reforges.Reforge
import com.willfp.reforges.reforges.ReforgeTarget import com.willfp.reforges.reforges.ReforgeTarget
import com.willfp.reforges.reforges.ReforgeTargets import com.willfp.reforges.reforges.ReforgeTargets
import com.willfp.reforges.reforges.util.MetadatedReforgeStatus
import com.willfp.reforges.util.ReforgeStatus import com.willfp.reforges.util.ReforgeStatus
import com.willfp.reforges.util.getRandomReforge import com.willfp.reforges.util.getRandomReforge
import com.willfp.reforges.util.reforge import com.willfp.reforges.util.reforge
@@ -28,40 +28,28 @@ import org.bukkit.Material
import org.bukkit.Sound import org.bukkit.Sound
import org.bukkit.entity.Player import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack import org.bukkit.inventory.ItemStack
import java.util.* import java.util.Locale
import kotlin.math.pow import kotlin.math.pow
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
object ReforgeGUI { object ReforgeGUI {
private lateinit var menu: Menu private lateinit var menu: Menu
private fun Menu.getReforgeStatus(player: Player): MetadatedReforgeStatus { private fun Menu.getItemToReforge(player: Player) = this.getState<ItemStack>(
val captive = this.getCaptiveItems(player) player,
val item = captive.getOrNull(0) "item_to_reforge"
val stone = captive.getOrNull(1) )
val targets = mutableListOf<ReforgeTarget>() private fun Menu.getReforgeStone(player: Player) = this.getState<ItemStack>(
player,
"reforge_stone"
)
var cost = 0.0 private fun Menu.getReforgeStatus(player: Player): PricedReforgeStatus =
val status = if (item == null || item.type == Material.AIR) { this.getState<PricedReforgeStatus>(player, "reforge_status") ?: PricedReforgeStatus(
ReforgeStatus.NO_ITEM ReforgeStatus.NO_ITEM,
} else { 0.0
targets.addAll(ReforgeTargets.getForItem(item)) )
if (targets.isEmpty()) {
ReforgeStatus.INVALID_ITEM
} else {
val reforgeStone = stone.reforgeStone
if (reforgeStone != null && reforgeStone.canBeAppliedTo(item)) {
cost = reforgeStone.stonePrice.toDouble()
ReforgeStatus.ALLOW_STONE
} else {
ReforgeStatus.ALLOW
}
}
}
return MetadatedReforgeStatus(status, cost)
}
@JvmStatic @JvmStatic
fun open(player: Player) { fun open(player: Player) {
@@ -77,7 +65,7 @@ object ReforgeGUI {
val cost = when { val cost = when {
status == ReforgeStatus.ALLOW || (status == ReforgeStatus.ALLOW_STONE && specialCost < 0) -> { status == ReforgeStatus.ALLOW || (status == ReforgeStatus.ALLOW_STONE && specialCost < 0) -> {
val amountOfReforges = menu.getCaptiveItems(player)[0].timesReforged val amountOfReforges = menu.getItemToReforge(player)?.timesReforged ?: 0
plugin.configYml.getDouble("reforge.cost") * plugin.configYml.getDouble("reforge.cost") *
plugin.configYml.getDouble("reforge.cost-exponent").pow(amountOfReforges) * plugin.configYml.getDouble("reforge.cost-exponent").pow(amountOfReforges) *
@@ -91,8 +79,8 @@ object ReforgeGUI {
var xpCost = plugin.configYml.getInt("reforge.xp-cost") var xpCost = plugin.configYml.getInt("reforge.xp-cost")
if (status == ReforgeStatus.ALLOW) { if (status == ReforgeStatus.ALLOW) {
val item = menu.getCaptiveItems(player)[0] val item = menu.getItemToReforge(player)
val reforges = item.timesReforged val reforges = item?.timesReforged ?: 0
xpCost *= PriceMultipliers.getForPlayer(player).multiplier.toInt() xpCost *= PriceMultipliers.getForPlayer(player).multiplier.toInt()
xpCost *= plugin.configYml.getDouble("reforge.cost-exponent").pow(reforges.toDouble()).toInt() xpCost *= plugin.configYml.getDouble("reforge.cost-exponent").pow(reforges.toDouble()).toInt()
} }
@@ -106,7 +94,7 @@ object ReforgeGUI {
.replace("%xpcost%", NumberUtils.format(xpCost.toDouble())) .replace("%xpcost%", NumberUtils.format(xpCost.toDouble()))
.replace( .replace(
"%stone%", "%stone%",
menu.getCaptiveItems(player).getOrNull(1).reforgeStone?.name ?: "" menu.getReforgeStone(player)?.reforgeStone?.name ?: ""
) )
} }
} }
@@ -114,9 +102,8 @@ object ReforgeGUI {
onLeftClick { event, _, menu -> onLeftClick { event, _, menu ->
val player = event.whoClicked as Player val player = event.whoClicked as Player
val captive = menu.getCaptiveItems(player)
val item = captive.getOrNull(0) ?: return@onLeftClick val item = menu.getItemToReforge(player) ?: return@onLeftClick
val currentReforge = item.reforge val currentReforge = item.reforge
val targets = ReforgeTargets.getForItem(item) val targets = ReforgeTargets.getForItem(item)
@@ -124,7 +111,7 @@ object ReforgeGUI {
var usedStone = false var usedStone = false
val stoneInMenu = menu.getCaptiveItems(player).getOrNull(1).reforgeStone val stoneInMenu = menu.getReforgeStone(player)?.reforgeStone
val reforge = if (stoneInMenu != null && stoneInMenu.canBeAppliedTo(item)) { val reforge = if (stoneInMenu != null && stoneInMenu.canBeAppliedTo(item)) {
usedStone = true usedStone = true
@@ -198,9 +185,9 @@ object ReforgeGUI {
item.reforge = reforge item.reforge = reforge
if (usedStone) { if (usedStone) {
val stone = menu.getCaptiveItems(player)[1] val stone = menu.getReforgeStone(player)
stone.itemMeta = null stone?.itemMeta = null
stone.amount = 0 stone?.amount = 0
if (plugin.configYml.getBool("gui.stone-sound.enabled")) { if (plugin.configYml.getBool("gui.stone-sound.enabled")) {
player.playSound( player.playSound(
player.location, player.location,
@@ -229,8 +216,9 @@ object ReforgeGUI {
.toTypedArray() .toTypedArray()
menu = menu(plugin.configYml.getInt("gui.rows")) { menu = menu(plugin.configYml.getInt("gui.rows")) {
setTitle(plugin.langYml.getFormattedString("menu.title")) title = plugin.langYml.getFormattedString("menu.title")
setMask(FillerMask(MaskItems(*maskItems), *maskPattern)) setMask(FillerMask(MaskItems(*maskItems), *maskPattern))
allowChangingHeldItem()
val slot = slot( val slot = slot(
ItemStackBuilder(Material.BLACK_STAINED_GLASS_PANE) ItemStackBuilder(Material.BLACK_STAINED_GLASS_PANE)
@@ -261,13 +249,13 @@ object ReforgeGUI {
setSlot( setSlot(
plugin.configYml.getInt("gui.item-slot.row"), plugin.configYml.getInt("gui.item-slot.row"),
plugin.configYml.getInt("gui.item-slot.column"), plugin.configYml.getInt("gui.item-slot.column"),
Slot.builder().setCaptive().build() captiveSlot()
) )
setSlot( setSlot(
plugin.configYml.getInt("gui.stone-slot.row"), plugin.configYml.getInt("gui.stone-slot.row"),
plugin.configYml.getInt("gui.stone-slot.column"), plugin.configYml.getInt("gui.stone-slot.column"),
Slot.builder().setCaptive().build() captiveSlot()
) )
setSlot( setSlot(
@@ -288,6 +276,54 @@ object ReforgeGUI {
} }
) )
onRender { player, menu ->
menu.setState(
player, "item_to_reforge", menu.getCaptiveItem(
player,
plugin.configYml.getInt("gui.item-slot.row"),
plugin.configYml.getInt("gui.item-slot.column")
)
)
menu.setState(
player, "reforge_stone", menu.getCaptiveItem(
player,
plugin.configYml.getInt("gui.stone-slot.row"),
plugin.configYml.getInt("gui.stone-slot.column")
)
)
val item = menu.getItemToReforge(player)
val stone = menu.getReforgeStone(player)
val targets = mutableListOf<ReforgeTarget>()
var cost = 0.0
val status = if (item.isEmpty) {
ReforgeStatus.NO_ITEM
} else {
targets.addAll(ReforgeTargets.getForItem(item!!))
if (targets.isEmpty()) {
ReforgeStatus.INVALID_ITEM
} else {
val reforgeStone = stone.reforgeStone
if (reforgeStone == null) {
ReforgeStatus.ALLOW
} else {
if (reforgeStone.canBeAppliedTo(item)) {
cost = reforgeStone.stonePrice.toDouble()
ReforgeStatus.ALLOW_STONE
} else {
ReforgeStatus.INVALID_ITEM
}
}
}
}
menu.setState(player, "reforge_status", PricedReforgeStatus(status, cost))
}
onClose { event, menu -> onClose { event, menu ->
DropQueue(event.player as Player) DropQueue(event.player as Player)
.addItems(menu.getCaptiveItems(event.player as Player)) .addItems(menu.getCaptiveItems(event.player as Player))

View File

@@ -30,13 +30,15 @@ class Reforge(
val targets = config.getStrings("targets").mapNotNull { ReforgeTargets.getByName(it) }.toSet() val targets = config.getStrings("targets").mapNotNull { ReforgeTargets.getByName(it) }.toSet()
override val effects = config.getSubsections("effects").mapNotNull { override val effects = Effects.compile(
Effects.compile(it, "Reforge ID $id") config.getSubsections("effects"),
}.toSet() "Reforge $id"
)
override val conditions = config.getSubsections("conditions").mapNotNull { override val conditions = Conditions.compile(
Conditions.compile(it, "Reforge ID $id") config.getSubsections("conditions"),
}.toSet() "Reforge $id"
)
val requiresStone = config.getBool("stone.enabled") val requiresStone = config.getBool("stone.enabled")

View File

@@ -3,7 +3,7 @@ package com.willfp.reforges.reforges
import com.google.common.collect.HashBiMap import com.google.common.collect.HashBiMap
import com.google.common.collect.ImmutableSet import com.google.common.collect.ImmutableSet
import com.willfp.eco.core.config.ConfigType import com.willfp.eco.core.config.ConfigType
import com.willfp.eco.core.config.TransientConfig import com.willfp.eco.core.config.readConfig
import com.willfp.eco.core.config.updating.ConfigUpdater import com.willfp.eco.core.config.updating.ConfigUpdater
import com.willfp.libreforge.chains.EffectChains import com.willfp.libreforge.chains.EffectChains
import com.willfp.reforges.ReforgesPlugin import com.willfp.reforges.ReforgesPlugin
@@ -54,7 +54,7 @@ object Reforges {
@ConfigUpdater @ConfigUpdater
@JvmStatic @JvmStatic
fun update(plugin: ReforgesPlugin) { fun update(plugin: ReforgesPlugin) {
val reforgesYml = TransientConfig(File(plugin.dataFolder, "reforges.yml"), ConfigType.YAML) val reforgesYml = File(plugin.dataFolder, "reforges.yml").readConfig(ConfigType.YAML)
for (config in reforgesYml.getSubsections("chains")) { for (config in reforgesYml.getSubsections("chains")) {
EffectChains.compile(config, "Chains") EffectChains.compile(config, "Chains")

View File

@@ -1,5 +0,0 @@
package com.willfp.reforges.reforges.util
import com.willfp.reforges.util.ReforgeStatus
data class MetadatedReforgeStatus(val status: ReforgeStatus, val cost: Double)

View File

@@ -179,12 +179,18 @@ cannot-afford-type:
sound: "BLOCK_NOTE_BLOCK_PLING" sound: "BLOCK_NOTE_BLOCK_PLING"
pitch: 0.5 pitch: 0.5
cannot-afford-price:
in-actionbar: true
sound:
enabled: true
sound: "BLOCK_NOTE_BLOCK_PLING"
pitch: 0.5
point-names: # If you have point names that look ugly (eg g_souls) then you can map them to nice names to be shown to players. point-names: # If you have point names that look ugly (eg g_souls) then you can map them to nice names to be shown to players.
example_point: "Nicely Formatted Point" example_point: "Nicely Formatted Point"
use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements
raytrace-distance: 80 # The distance that alt_click should check for a location raytrace-distance: 80 # The distance that alt_click should check for a location
block-item-drop-place-check: true # If the block_item_drop trigger should only fire on naturally placed blocks (prevents dupes)
potions: potions:
icon: icon:
@@ -196,5 +202,3 @@ potions:
particles: particles:
permanent: false permanent: false
triggered: true triggered: true
share-configs: true # If your configs are allowed to be used to gather data and improve the plugin. Nothing identifying (IP, Name, etc) is shared.

View File

@@ -3,7 +3,20 @@ messages:
no-permission: "&cYou don't have permission to do this!" no-permission: "&cYou don't have permission to do this!"
not-player: "&cThis command must be run by a player" not-player: "&cThis command must be run by a player"
invalid-command: "&cUnknown subcommand!" invalid-command: "&cUnknown subcommand!"
reloaded: "Reloaded! (Restart if you're removed reforges!) Took %time%ms" reloaded: "Reloaded!"
cannot-afford: "&cYou can't afford to do this! &fCost: &a$$%cost%"
cannot-afford-type: "&cYou can't afford to do this! &fCost: &a%cost% %type%"
cannot-afford-price: "&cYou can't afford to do this! &fPrice: %price%"
on-cooldown: "&cThis effect is on cooldown! &fTime left: &a%seconds% seconds"
cannot-transmit: "&cYou can't transmit here!"
must-specify-lrcdb-id: "&cYou must specify the ID of the config to download! Not sure what this means? Go to &alrcdb.auxilor.io"
lrcdb-import-error: "&cError importing config: &f%message%"
lrcdb-import-success: "&fImported &a%name%&f! Reload the plugin to install it"
must-specify-config-name: "&cYou must specify the config name!"
invalid-config-name: "&cInvalid config name!"
lrcdb-export-error: "&cError exporting config: &f%message%"
lrcdb-export-success: "&fExported &a%name%&f! View it on &alrcdb.auxilor.io&f, or share your config ID: &f%id%"
insufficient-money: "&cYou don't have enough money for this!" insufficient-money: "&cYou don't have enough money for this!"
insufficient-xp: "&cYou don't have enough xp levels for this!" insufficient-xp: "&cYou don't have enough xp levels for this!"
applied-reforge: "Applied %reforge%&r reforge!" applied-reforge: "Applied %reforge%&r reforge!"
@@ -12,12 +25,8 @@ messages:
needs-stone: "&cYou must specify a reforge stone" needs-stone: "&cYou must specify a reforge stone"
invalid-stone: "&cInvalid reforge!" invalid-stone: "&cInvalid reforge!"
give-success: "Gave &a%reforge%&r reforge stone to &a%recipient%" give-success: "Gave &a%reforge%&r reforge stone to &a%recipient%"
on-cooldown: "&cThis reforge is on cooldown! &fTime left: &a%seconds% seconds"
cannot-afford: "&cYou can't afford to do this! &fCost: &a$$%cost%"
cannot-afford-type: "&cYou can't afford to do this! &fCost: &a%cost% %type%"
invalid-reforge: "&cInvalid reforge!" invalid-reforge: "&cInvalid reforge!"
needs-reforge: "&cYou must specify a reforge" needs-reforge: "&cYou must specify a reforge"
cannot-transmit: "&cYou can't transmit here!"
menu: menu:
title: "Reforge Item" title: "Reforge Item"

View File

@@ -0,0 +1,19 @@
# Options for lrcdb (https://lrcdb.auxilor.io), a website to share configs
# with other server owners, so you can get more configs without making them
# yourself!
author: "Unknown Author" # The name attached to configs you export
# Options about automatically sharing configs you create
share-configs:
# If you want all your configs to automatically be publicly available,
# set this to true. This really helps out other users!
publicly: false
# If you don't want your configs to be usable to gather information about
# plugin usage or to improve the plugins in the future, disable this.
# Nothing identifying is shared.
enabled: true
# If you disable share-configs, you can still share select configs publicly
# with /ecoenchants export <config>.

View File

@@ -46,6 +46,8 @@ permissions:
reforges.command.give: true reforges.command.give: true
reforges.command.apply: true reforges.command.apply: true
reforges.command.open: true reforges.command.open: true
reforges.command.import: true
reforges.command.export: true
reforges.command.reload: reforges.command.reload:
description: Allows reloading the config description: Allows reloading the config
@@ -65,3 +67,9 @@ permissions:
reforges.command.apply: reforges.command.apply:
description: Allows the user of /reforges apply. description: Allows the user of /reforges apply.
default: op default: op
reforges.command.import:
description: Allows the user of /reforges import.
default: op
reforges.command.export:
description: Allows the user of /reforges export.
default: op

View File

@@ -4,25 +4,48 @@
# including in subfolders if you want to organize your reforge configs # including in subfolders if you want to organize your reforge configs
# _example.yml is not loaded. # _example.yml is not loaded.
name: "<gradient:#4776E6>Acute</gradient:#8E54E9>" name: "<gradient:#AAFFA9>Dynamic</gradient:#11FFBD>" # The display name for the reforge
description: description: # The lore to add to an item with this reforge:
- "&a+2% &fTriple Damage Chance" - "&a+5% &fDamage"
targets: - "&a+10% &fCrit Damage"
- axe targets: # The targets that this reforge can be applied to
- melee
# Options for the reforge stone
stone: stone:
enabled: false enabled: true # If this reforge requires the use of a reforge stone
name: '' name: "<gradient:#AAFFA9>Dynamic</gradient:#11FFBD>&f Reforge Stone" # The display name of the stone
lore: [] lore: # The lore of the stone
item: '' - "&7Place on the right of the"
craftable: false - "&7reforge menu to apply the"
recipe: [] - "<gradient:#AAFFA9>Dynamic</gradient:#11FFBD>&7 reforge!"
item: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmM0YTY1YzY4OWIyZDM2NDA5MTAwYTYwYzJhYjhkM2QwYTY3Y2U5NGVlYTNjMWY3YWM5NzRmZDg5MzU2OGI1ZCJ9fX0=
craftable: true # If the reforge stone should be craftable
price: 100000 # (Optional) The price required to apply this reforge, overrides the default reforge price
recipe: # The recipe for the stone to have
- air
- ecoitems:blank_reforge_stone ? air
- air
- iron_block
- daylight_sensor
- iron_block
- air
- phantom_membrane
- air
# The effects of the reforge (i.e. the functionality)
# See here: https://plugins.auxilor.io/effects/configuring-an-effect
effects: effects:
- id: damage_multiplier - id: damage_multiplier
args: args:
multiplier: 3 multiplier: 1.05
chance: 2
triggers: triggers:
- melee_attack - melee_attack
- id: crit_multiplier
args:
multiplier: 1.1
triggers:
- melee_attack
# The conditions required to use the reforge
conditions: [] conditions: []

View File

@@ -13,6 +13,7 @@ stone:
- "<gradient:#AAFFA9>Dynamic</gradient:#11FFBD>&7 reforge!" - "<gradient:#AAFFA9>Dynamic</gradient:#11FFBD>&7 reforge!"
item: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmM0YTY1YzY4OWIyZDM2NDA5MTAwYTYwYzJhYjhkM2QwYTY3Y2U5NGVlYTNjMWY3YWM5NzRmZDg5MzU2OGI1ZCJ9fX0= item: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmM0YTY1YzY4OWIyZDM2NDA5MTAwYTYwYzJhYjhkM2QwYTY3Y2U5NGVlYTNjMWY3YWM5NzRmZDg5MzU2OGI1ZCJ9fX0=
craftable: true craftable: true
price: 100000
recipe: recipe:
- air - air
- ecoitems:blank_reforge_stone ? air - ecoitems:blank_reforge_stone ? air

View File

@@ -1,4 +1,4 @@
#libreforge-updater #libreforge-updater
#Mon Sep 12 21:22:09 BST 2022 #Tue Nov 01 16:23:07 GMT 2022
version=5.49.1 version=5.68.0
plugin-name=Reforges plugin-name=Reforges