9
0
mirror of https://github.com/Auxilor/EcoJobs.git synced 2025-12-21 07:59:15 +00:00

Added %join_lore% and %leave_lore%

This commit is contained in:
Auxilor
2022-11-07 12:47:15 +00:00
parent 3606d5f12b
commit e0084d61f7
14 changed files with 91 additions and 8 deletions

View File

@@ -259,6 +259,24 @@ class Job(
}
}
private fun getLeaveLore(level: Int, whitespace: Int = 0): List<String> =
this.config.getStrings("leave-lore")
.map {
levelPlaceholders.format(it, level)
}
.map {
" ".repeat(whitespace) + it
}
private fun getJoinLore(level: Int, whitespace: Int = 0): List<String> =
this.config.getStrings("join-lore")
.map {
levelPlaceholders.format(it, level)
}
.map {
" ".repeat(whitespace) + it
}
fun injectPlaceholdersInto(lore: List<String>, player: Player, forceLevel: Int? = null): List<String> {
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)
}

View File

@@ -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)
}
}
)

View File

@@ -254,7 +254,7 @@ leave-gui:
name: "&cLeave %job%"
lore:
- ""
- "&8» This will cost %leave_price%"
- "%leave_lore%"
location:
row: 2
column: 7

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +1,5 @@
name: "&#7A54FBEnchanter"
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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +1,5 @@
name: "&#4B4736Smelter"
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

View File

@@ -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