From 599b2800d82ded48d3dbef4afa386c424568443b Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 7 Nov 2022 12:36:28 +0000 Subject: [PATCH] Added confirmation GUI, improved prices --- build.gradle | 2 +- .../willfp/ecojobs/commands/CommandJoin.kt | 5 ++ .../willfp/ecojobs/commands/CommandLeave.kt | 18 ++-- .../kotlin/com/willfp/ecojobs/jobs/Job.kt | 35 +++++--- .../com/willfp/ecojobs/jobs/JobLeaveGUI.kt | 85 +++++++++++++++++++ .../kotlin/com/willfp/ecojobs/jobs/JobsGUI.kt | 14 ++- .../com/willfp/ecojobs/jobs/PriceHandler.kt | 32 +++---- .../core-plugin/src/main/resources/config.yml | 56 ++++++++++-- .../src/main/resources/jobs/_example.yml | 12 ++- .../src/main/resources/jobs/beekeeper.yml | 11 ++- .../src/main/resources/jobs/builder.yml | 11 ++- .../src/main/resources/jobs/enchanter.yml | 11 ++- .../src/main/resources/jobs/farmer.yml | 11 ++- .../src/main/resources/jobs/fisherman.yml | 11 ++- .../src/main/resources/jobs/lumberjack.yml | 11 ++- .../src/main/resources/jobs/miner.yml | 11 ++- .../src/main/resources/jobs/slayer.yml | 11 ++- .../src/main/resources/jobs/smelter.yml | 11 ++- .../src/main/resources/jobs/toolsmith.yml | 33 ++----- .../core-plugin/src/main/resources/lang.yml | 2 + 20 files changed, 300 insertions(+), 93 deletions(-) create mode 100644 eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobLeaveGUI.kt diff --git a/build.gradle b/build.gradle index 4f39e65..5281b02 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:6.44.0' + compileOnly 'com.willfp:eco:6.45.0' implementation 'com.willfp:libreforge:3.118.0' implementation 'com.willfp:ecomponent:1.0.0' implementation 'org.joml:joml:1.10.4' diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandJoin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandJoin.kt index cee1ca3..4bb1992 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandJoin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandJoin.kt @@ -33,6 +33,11 @@ class CommandJoin(plugin: EcoPlugin) : Subcommand(plugin, "join", "ecojobs.comma return } + if (player.activeJob != null) { + player.sendMessage(plugin.langYml.getMessage("leave-current-job")) + return + } + player.sendMessage( plugin.langYml.getMessage("joined-job", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS) .replace("%job%", job.name) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandLeave.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandLeave.kt index 839215a..9515d49 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandLeave.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/commands/CommandLeave.kt @@ -2,7 +2,6 @@ package com.willfp.ecojobs.commands import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.command.impl.Subcommand -import com.willfp.eco.util.StringUtils import com.willfp.ecojobs.jobs.activeJob import org.bukkit.command.CommandSender import org.bukkit.entity.Player @@ -16,11 +15,20 @@ class CommandLeave(plugin: EcoPlugin) : Subcommand(plugin, "leave", "ecojobs.com return } - player.sendMessage( - plugin.langYml.getMessage("left-job", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS) - .replace("%job%", player.activeJob?.name ?: "") - ) + val job = player.activeJob ?: return player.activeJob = null + + if (player.activeJob == null) { + player.sendMessage( + plugin.langYml.getMessage("left-job") + .replace("%job%", job.name) + ) + } else { + player.sendMessage( + plugin.langYml.getMessage("cant-leave-job") + .replace("%job%", job.name) + ) + } } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt index c68da8b..ae2882b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/Job.kt @@ -10,6 +10,8 @@ import com.willfp.eco.core.items.builder.ItemStackBuilder import com.willfp.eco.core.placeholder.PlayerPlaceholder import com.willfp.eco.core.placeholder.PlayerStaticPlaceholder import com.willfp.eco.core.placeholder.PlayerlessPlaceholder +import com.willfp.eco.core.price.ConfiguredPrice +import com.willfp.eco.core.price.impl.PriceEconomy import com.willfp.eco.util.NumberUtils import com.willfp.eco.util.formatEco import com.willfp.eco.util.toNiceString @@ -18,7 +20,6 @@ import com.willfp.ecojobs.api.event.PlayerJobExpGainEvent import com.willfp.ecojobs.api.event.PlayerJobJoinEvent import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent -import com.willfp.ecojobs.jobs.Jobs.unlockedJobs import com.willfp.libreforge.conditions.Conditions import com.willfp.libreforge.conditions.ConfiguredCondition import com.willfp.libreforge.effects.ConfiguredEffect @@ -29,7 +30,7 @@ import org.bukkit.Bukkit import org.bukkit.OfflinePlayer import org.bukkit.entity.Player import org.bukkit.inventory.ItemStack -import java.util.* +import java.util.Objects import java.util.concurrent.TimeUnit import kotlin.math.abs @@ -42,8 +43,16 @@ class Job( val description = config.getFormattedString("description") val isUnlockedByDefault = config.getBool("unlocked-by-default") val resetsOnQuit = config.getBool("reset-on-quit") - val joinPrice = config.getDouble("join-price") - val leavePrice = config.getDouble("leave-price") + + val joinPrice = ConfiguredPrice.create(config.getSubsection("join-price")) ?: ConfiguredPrice( + PriceEconomy(config.getDouble("join-price")), + "" + ) + + val leavePrice = ConfiguredPrice.create(config.getSubsection("leave-price")) ?: ConfiguredPrice( + PriceEconomy(config.getDouble("leave-price")), + "" + ) val levelKey: PersistentDataKey = PersistentDataKey( EcoJobsPlugin.instance.namespacedKeyFactory.create("${id}_level"), @@ -63,6 +72,8 @@ class Job( val levelGUI = JobLevelGUI(plugin, this) + val leaveGUI = JobLeaveGUI(plugin, this) + private val baseItem: ItemStack = Items.lookup(config.getString("icon")).item private val effects: Set @@ -167,8 +178,8 @@ class Job( }.register() PlayerPlaceholder( - plugin, - "${id}_level" + plugin, + "${id}_level" ) { it.getJobLevel(this).toString() }.register() @@ -264,8 +275,8 @@ class Job( .replace("%description%", this.description) .replace("%job%", this.name) .replace("%level%", (forceLevel ?: player.getJobLevel(this)).toString()) - .replace("%join_price%", NumberUtils.format(this.joinPrice)) - .replace("%leave_price%", NumberUtils.format(this.leavePrice)) + .replace("%join_price%", this.joinPrice.getDisplay(player)) + .replace("%leave_price%", this.leavePrice.getDisplay(player)) } .toMutableList() @@ -294,7 +305,6 @@ class Job( val base = baseItem.clone() val level = player.getJobLevel(this) - val isActive = player.activeJob == this return ItemStackBuilder(base) .setDisplayName( @@ -304,8 +314,11 @@ class Job( ) .addLoreLines { injectPlaceholdersInto(plugin.configYml.getStrings("gui.job-icon.lore"), player) + - if (isActive) plugin.configYml.getStrings("gui.job-icon.active-lore") else - plugin.configYml.getStrings("gui.job-icon.not-active-lore") + when (player.activeJob) { + this -> plugin.configYml.getStrings("gui.job-icon.active-lore") + null -> plugin.configYml.getStrings("gui.job-icon.join-lore") + else -> emptyList() + } } .build() } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobLeaveGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobLeaveGUI.kt new file mode 100644 index 0000000..8017beb --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobLeaveGUI.kt @@ -0,0 +1,85 @@ +package com.willfp.ecojobs.jobs + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.onLeftClick +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.FillerMask +import com.willfp.eco.core.gui.slot.MaskItems +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.builder.ItemStackBuilder +import com.willfp.eco.util.formatEco +import org.bukkit.entity.Player + +class JobLeaveGUI( + plugin: EcoPlugin, + job: Job +) { + private val menu = menu(plugin.configYml.getInt("leave-gui.rows")) { + val maskPattern = plugin.configYml.getStrings("leave-gui.mask.pattern").toTypedArray() + val maskItems = MaskItems.fromItemNames(plugin.configYml.getStrings("leave-gui.mask.materials")) + + title = plugin.configYml.getString("leave-gui.title") + .replace("%job%", job.name) + .formatEco() + + setMask( + FillerMask( + maskItems, + *maskPattern + ) + ) + + setSlot( + plugin.configYml.getInt("leave-gui.cancel.location.row"), + plugin.configYml.getInt("leave-gui.cancel.location.column"), + slot({ player, _ -> + ItemStackBuilder(Items.lookup(plugin.configYml.getString("leave-gui.cancel.item"))) + .setDisplayName(plugin.configYml.getString("leave-gui.cancel.name").replace("%job%", job.name)) + .addLoreLines( + job.injectPlaceholdersInto(plugin.configYml.getStrings("leave-gui.cancel.lore"), player) + ) + .build() + }) { + onLeftClick { player, _, _, _ -> + JobsGUI.open(player) + } + } + ) + + setSlot( + plugin.configYml.getInt("leave-gui.confirm.location.row"), + plugin.configYml.getInt("leave-gui.confirm.location.column"), + slot({ player, _ -> + ItemStackBuilder(Items.lookup(plugin.configYml.getString("leave-gui.confirm.item"))) + .setDisplayName(plugin.configYml.getString("leave-gui.confirm.name").replace("%job%", job.name)) + .addLoreLines( + job.injectPlaceholdersInto(plugin.configYml.getStrings("leave-gui.confirm.lore"), player) + ) + .build() + }) { + onLeftClick { player, _, _, _ -> + player.activeJob = null + + if (player.activeJob == null) { + player.sendMessage( + plugin.langYml.getMessage("left-job") + .replace("%job%", job.name) + ) + player.closeInventory() + } else { + player.sendMessage( + plugin.langYml.getMessage("cant-leave-job") + .replace("%job%", job.name) + ) + JobsGUI.open(player) + } + } + } + ) + } + + fun open(player: Player) { + menu.open(player) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobsGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobsGUI.kt index 36f1f19..4c9a19a 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobsGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/JobsGUI.kt @@ -3,6 +3,7 @@ package com.willfp.ecojobs.jobs import com.willfp.eco.core.config.updating.ConfigUpdater import com.willfp.eco.core.gui.menu import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.onLeftClick import com.willfp.eco.core.gui.slot import com.willfp.eco.core.gui.slot.ConfigSlot import com.willfp.eco.core.gui.slot.FillerMask @@ -99,10 +100,6 @@ object JobsGUI { val (row, column) = pair setSlot(row, column, slot({ p, m -> jobIconBuilder(p, m, index) }) { - setUpdater { p, m, _ -> - jobIconBuilder(p, m, index) - } - onLeftClick { event, _, _ -> val player = event.whoClicked as Player @@ -114,8 +111,10 @@ object JobsGUI { val job = unlockedJobs.getOrNull(pagedIndex) ?: return@onLeftClick - if (player.activeJob != job) { + if (player.activeJob == null) { player.activeJob = job + } else { + player.sendMessage(plugin.langYml.getMessage("leave-current-job")) } player.playSound( @@ -189,9 +188,8 @@ object JobsGUI { .setDisplayName(plugin.configYml.getString("gui.deactivate-job.name")) .build() ) { - onLeftClick { event, _ -> - val player = event.whoClicked as Player - player.activeJob = null + onLeftClick { player, _, _, _ -> + player.activeJob?.leaveGUI?.open(player) } } ) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/PriceHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/PriceHandler.kt index d054faf..7c64df2 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/PriceHandler.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecojobs/jobs/PriceHandler.kt @@ -1,8 +1,8 @@ package com.willfp.ecojobs.jobs -import com.willfp.eco.core.integrations.economy.balance import com.willfp.ecojobs.api.event.PlayerJobJoinEvent import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent +import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.EventPriority import org.bukkit.event.Listener @@ -13,19 +13,16 @@ object PriceHandler : Listener { ignoreCancelled = true ) fun onJoin(event: PlayerJobJoinEvent) { - val player = event.player + val player = event.player as? Player ?: return val job = event.job val price = job.joinPrice - if (price > 0) { - val hasMoney = player.balance >= price - - if (!hasMoney) { - event.isCancelled = true - } - - player.balance -= price + if (!price.canAfford(player)) { + event.isCancelled = true + return } + + price.pay(player) } @EventHandler( @@ -33,18 +30,15 @@ object PriceHandler : Listener { ignoreCancelled = true ) fun onLeave(event: PlayerJobLeaveEvent) { - val player = event.player + val player = event.player as? Player ?: return val job = event.job val price = job.leavePrice - if (price > 0) { - val hasMoney = player.balance >= price - - if (!hasMoney) { - event.isCancelled = true - } - - player.balance -= price + if (!price.canAfford(player)) { + event.isCancelled = true + return } + + price.pay(player) } } diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 2392290..a5a0322 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -78,11 +78,11 @@ gui: active-lore: - "" - - "&cThis job is already active!" + - "&cYou've already joined this job!" - not-active-lore: + join-lore: - "" - - "&eClick to activate this job!" + - "&eClick to join this job!" click: sound: ui_button_click @@ -117,7 +117,7 @@ gui: column: 2 # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots - custom-slots: [] + custom-slots: [ ] level-gui: rows: 6 @@ -214,7 +214,53 @@ level-gui: column: 5 # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots - custom-slots: [] + custom-slots: [ ] + +leave-gui: + rows: 3 + + title: "Confirm Leaving %job%" + + mask: + # The way the mask works is by having a list of materials + # And then a pattern to use those materials. + + # The pattern is the rows in the GUI + # Each line must be 9 long, and the amount of rows should be the amount of rows in the GUI + # A zero represents nothing + # A 1 represents the first material + # A 2 represents the second material + # And so on, you can add up to 9. + + materials: + - black_stained_glass_pane + pattern: + - "111111111" + - "110111011" + - "111111111" + + cancel: + item: arrow + name: "&eCancel" + lore: + - "" + - "&fGo back to the Jobs menu" + location: + row: 2 + column: 3 + + confirm: + item: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTRiZDlhNDViOTY4MWNlYTViMjhjNzBmNzVhNjk1NmIxZjU5NGZlYzg0MGI5NjA3Nzk4ZmIxZTcwNzc2NDQzMCJ9fX0= + name: "&cLeave %job%" + lore: + - "" + - "&8» This will cost %leave_price%" + location: + row: 2 + column: 7 + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] level-up: message: diff --git a/eco-core/core-plugin/src/main/resources/jobs/_example.yml b/eco-core/core-plugin/src/main/resources/jobs/_example.yml index 223128f..b6d910f 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/_example.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/_example.yml @@ -17,8 +17,16 @@ unlocked-by-default: true reset-on-quit: false # The price to join or leave this job (set to 0 to disable) -join-price: 0 -leave-price: 0 +# Read here for more: https://plugins.auxilor.io/all-plugins/prices +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" # The xp requirements for each job level - add new levels by adding more to this list level-xp-requirements: diff --git a/eco-core/core-plugin/src/main/resources/jobs/beekeeper.yml b/eco-core/core-plugin/src/main/resources/jobs/beekeeper.yml index ff84ade..b58e957 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/beekeeper.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/beekeeper.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/builder.yml b/eco-core/core-plugin/src/main/resources/jobs/builder.yml index 8072788..7daf853 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/builder.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/builder.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/enchanter.yml b/eco-core/core-plugin/src/main/resources/jobs/enchanter.yml index 5b80fb8..9c529b3 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/enchanter.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/enchanter.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/farmer.yml b/eco-core/core-plugin/src/main/resources/jobs/farmer.yml index 2eebf7e..752e98f 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/farmer.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/farmer.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/fisherman.yml b/eco-core/core-plugin/src/main/resources/jobs/fisherman.yml index 5ae57fd..5169243 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/fisherman.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/fisherman.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/lumberjack.yml b/eco-core/core-plugin/src/main/resources/jobs/lumberjack.yml index 9f444ce..54966ed 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/lumberjack.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/lumberjack.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/miner.yml b/eco-core/core-plugin/src/main/resources/jobs/miner.yml index c8ed79d..cb842be 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/miner.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/miner.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/slayer.yml b/eco-core/core-plugin/src/main/resources/jobs/slayer.yml index fc523bb..2b8e4c0 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/slayer.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/slayer.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/smelter.yml b/eco-core/core-plugin/src/main/resources/jobs/smelter.yml index 7339ed5..b6a4e52 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/smelter.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/smelter.yml @@ -5,8 +5,15 @@ unlocked-by-default: true reset-on-quit: false -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" level-xp-requirements: - 100 diff --git a/eco-core/core-plugin/src/main/resources/jobs/toolsmith.yml b/eco-core/core-plugin/src/main/resources/jobs/toolsmith.yml index 9c62fd6..41e7709 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/toolsmith.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/toolsmith.yml @@ -7,20 +7,22 @@ # The display name of the job name: "/b3Toolsmith" -# The description of the job description: "&8&oLevel up by crafting tools" -# If the job should be unlocked by default unlocked-by-default: true -# If job progress should be reset when quitting reset-on-quit: false -# The price to join or leave this job (set to 0 to disable) -join-price: 0 -leave-price: 0 +join-price: + value: 0 + type: coins + display: "&a$%value%" + +leave-price: + value: 0 + type: coins + display: "&a$%value%" -# The xp requirements for each job level - add new levels by adding more to this list level-xp-requirements: - 100 - 120 @@ -72,9 +74,6 @@ level-xp-requirements: - 580000 - 750000 -# An XP Gain method takes a trigger, a multiplier, conditions, and filters. -# The multiplier takes the value produced by the trigger and multiplies it -# by some value to calculate the experience that should be given xp-gain-methods: - trigger: craft multiplier: 2 @@ -113,36 +112,24 @@ xp-gain-methods: - "*shears" - "*spyglass" -# Custom placeholders to be used in descriptions, -# Don't add % to the IDs, this is done automatically -# The value takes a %level% placeholder and is a mathematical expression level-placeholders: - id: "money" value: "%level% * 2" -# The text shown with the %effects% placeholder -# The number dictates the minimum level for this text to show for -# Adding new levels will override this text on those levels or above effects-description: 1: - "&8» &8Earn &a$%money%&8 for each tool crafted" -# Same as above, but for %rewards% rewards-description: 1: - "&8» &8Earn &a$%money%&8 for each tool crafted" -# Same as above, but for %level_up_messages% level-up-messages: 1: - "&8» &8Earn &a$%money%&8 for each tool crafted" -# Commands to be sent on levelup, can be formatted two ways: -# level:command (e.g. 10:eco give %player% 1000), which would execute that command for level 10 -# command (e.g. eco give %player% 5000), which would execute that command for all levels level-commands: [ ] -# The effects for the job, has %level% as a placeholder effects: - id: give_money args: @@ -183,8 +170,6 @@ effects: triggers: - craft -# The conditions for the job, also has %level% as a placeholder conditions: [ ] -# The icon in GUIs icon: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODk2ZDRjODM4YTE2MDZhYzc1Nzc1NDIzMjA4NjE0OTcwOGI3OWFiYTAxYmU5NTNjNjUzOTkxMDFlODk0M2RhZiJ9fX0= diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index 531345d..98283d0 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -33,6 +33,8 @@ messages: joined-job: "&fYou have joined the %job%&f job!" left-job: "&fYou have left the %job%&f job!" job-already-joined: "&cYou already have this job!" + leave-current-job: "&cYou must leave your current job before joining a new one!" + cant-leave-job: "&cYou can't leave the %job%&f job!" menu: title: "Jobs"