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 ae2882b..43e0b0b 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 @@ -259,6 +259,24 @@ class Job( } } + private fun getLeaveLore(level: Int, whitespace: Int = 0): List = + this.config.getStrings("leave-lore") + .map { + levelPlaceholders.format(it, level) + } + .map { + " ".repeat(whitespace) + it + } + + private fun getJoinLore(level: Int, whitespace: Int = 0): List = + this.config.getStrings("join-lore") + .map { + levelPlaceholders.format(it, level) + } + .map { + " ".repeat(whitespace) + it + } + fun injectPlaceholdersInto(lore: List, player: Player, forceLevel: Int? = null): List { val withPlaceholders = lore .map { @@ -292,6 +310,10 @@ class Job( getRewardsDescription(forceLevel ?: player.getJobLevel(this), whitespace) } else if (s.contains("%level_up_messages%")) { getLevelUpMessages(forceLevel ?: player.getJobLevel(this), whitespace) + } else if (s.contains("%leave_lore%")) { + getLeaveLore(forceLevel ?: player.getJobLevel(this), whitespace) + } else if (s.contains("%join_lore%")) { + getJoinLore(forceLevel ?: player.getJobLevel(this), whitespace) } else { listOf(s) } 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 index 8017beb..f947f74 100644 --- 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 @@ -66,14 +66,14 @@ class JobLeaveGUI( 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) } + + JobsGUI.open(player) } } ) diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index a5a0322..553884a 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -254,7 +254,7 @@ leave-gui: name: "&cLeave %job%" lore: - "" - - "&8» This will cost %leave_price%" + - "%leave_lore%" location: row: 2 column: 7 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 b6d910f..cfb11c5 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/_example.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/_example.yml @@ -16,18 +16,29 @@ 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) +# The price to join this job (set to 0 to disable) # Read here for more: https://plugins.auxilor.io/all-plugins/prices join-price: value: 0 type: coins display: "&a$%value%" +# Lore shown when clicking on the job icon to join it +# Reference with %join_lore% +join-lore: [] + +# The price to leave this job (set to 0 to disable) +# Read here for more: https://plugins.auxilor.io/all-plugins/prices leave-price: - value: 0 + value: 20000 type: coins display: "&a$%value%" +# Lore shown on the confirm leave button +# Reference with %leave_lore% +leave-lore: + - " &8» This will cost %leave_price%" + # The xp requirements for each job level - add new levels by adding more to this list level-xp-requirements: - 100 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 b58e957..cc96120 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/beekeeper.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/beekeeper.yml @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 7daf853..ec52196 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/builder.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/builder.yml @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 9c529b3..eb7881b 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/enchanter.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/enchanter.yml @@ -1,5 +1,5 @@ name: "A54FBEnchanter" -description: "&7&oLevel up by enchanting items" +description: "&8&oLevel up by enchanting items" unlocked-by-default: true @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 752e98f..9b9163c 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/farmer.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/farmer.yml @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 5169243..6a0046a 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/fisherman.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/fisherman.yml @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 54966ed..91e11a3 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/lumberjack.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/lumberjack.yml @@ -1,5 +1,5 @@ name: "&#FB8810Lumberjack" -description: "&7&oLevel up by chopping wood" +description: "&8&oLevel up by chopping wood" unlocked-by-default: true @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 cb842be..520bd14 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/miner.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/miner.yml @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 2b8e4c0..4fff9f7 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/slayer.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/slayer.yml @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 b6a4e52..8fa00cd 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/smelter.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/smelter.yml @@ -1,5 +1,5 @@ name: "B4736Smelter" -description: "&7&oLevel up by smelting items" +description: "&8&oLevel up by smelting items" unlocked-by-default: true @@ -10,11 +10,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120 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 41e7709..10ba906 100644 --- a/eco-core/core-plugin/src/main/resources/jobs/toolsmith.yml +++ b/eco-core/core-plugin/src/main/resources/jobs/toolsmith.yml @@ -18,11 +18,16 @@ join-price: type: coins display: "&a$%value%" +join-lore: [] + leave-price: value: 0 type: coins display: "&a$%value%" +leave-lore: + - "" + level-xp-requirements: - 100 - 120