mirror of
https://github.com/Auxilor/EcoJobs.git
synced 2025-12-19 23:19:16 +00:00
Compare commits
151 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e67717cf84 | ||
|
|
16798df570 | ||
|
|
d0eaee3ad0 | ||
|
|
4e076680aa | ||
|
|
4257c45920 | ||
|
|
8a05885940 | ||
|
|
42033f31b6 | ||
|
|
662e978cbf | ||
|
|
ec8ddba84c | ||
|
|
d5eea9549f | ||
|
|
744f5bf4b0 | ||
|
|
1a6c879305 | ||
|
|
682446aa90 | ||
|
|
2e2f44a387 | ||
|
|
ec1fe90c8c | ||
|
|
7420415514 | ||
|
|
11bce9975d | ||
|
|
013d8a0068 | ||
|
|
338c1c3499 | ||
|
|
cdcc45aef8 | ||
|
|
533d036a18 | ||
|
|
03e99e2e1e | ||
|
|
86b7ad2971 | ||
|
|
7065642d97 | ||
|
|
e6c486bc3a | ||
|
|
c99769a1e3 | ||
|
|
6fc1ba72d8 | ||
|
|
b08687eba2 | ||
|
|
8cd544b327 | ||
|
|
5d40c32c1e | ||
|
|
ee155ccca6 | ||
|
|
acdb4d0f78 | ||
|
|
b99a72808c | ||
|
|
6bd56c8d95 | ||
|
|
e90f321517 | ||
|
|
4c021781e5 | ||
|
|
abfce4428f | ||
|
|
d7b7f6895e | ||
|
|
2a97bc2d29 | ||
|
|
af4d3058e8 | ||
|
|
802360e885 | ||
|
|
79a396f5d3 | ||
|
|
e264e49b05 | ||
|
|
d9263bcb53 | ||
|
|
4681bd63e1 | ||
|
|
998e25e7ec | ||
|
|
f1f7ec5afd | ||
|
|
875928b4c2 | ||
|
|
049cb72385 | ||
|
|
b7decc9eb8 | ||
|
|
44c59de546 | ||
|
|
fdbbf8102c | ||
|
|
cf7084fd44 | ||
|
|
fa4e0dc67a | ||
|
|
210a6e821e | ||
|
|
b520442dee | ||
|
|
58966f04ff | ||
|
|
4588122b20 | ||
|
|
b98ee1d0dc | ||
|
|
929e6d59d8 | ||
|
|
e6884a0320 | ||
|
|
569f63e22d | ||
|
|
49aecb54bf | ||
|
|
da80fbdcce | ||
|
|
c66919ec49 | ||
|
|
117f412ed3 | ||
|
|
1bd643eb8a | ||
|
|
2eb7625711 | ||
|
|
48b86099c9 | ||
|
|
966051bc21 | ||
|
|
442ea73366 | ||
|
|
52a6b45c85 | ||
|
|
dfff7c339c | ||
|
|
eb13e26512 | ||
|
|
7219918101 | ||
|
|
92787738b6 | ||
|
|
05cf850aab | ||
|
|
ac9f26bcce | ||
|
|
72f30769ad | ||
|
|
7282046ba0 | ||
|
|
0646965c9f | ||
|
|
243407ce3c | ||
|
|
1e2b101011 | ||
|
|
ecf99839bf | ||
|
|
b414ff57ab | ||
|
|
a476fac03e | ||
|
|
50b42f38ba | ||
|
|
08d5fa6b0c | ||
|
|
c3febb89ec | ||
|
|
7e3ba5293f | ||
|
|
19ef0341fa | ||
|
|
1bfaf7f7e1 | ||
|
|
827f8430e1 | ||
|
|
6192ce5bb6 | ||
|
|
fe59c30f52 | ||
|
|
7763ea48fd | ||
|
|
aef5d348bc | ||
|
|
d0bf9c848b | ||
|
|
6468ba5312 | ||
|
|
649253b82a | ||
|
|
e2cafdf031 | ||
|
|
3bc5661ea6 | ||
|
|
c83bf6e607 | ||
|
|
b161bc4adf | ||
|
|
30af9048af | ||
|
|
8cb2fd8700 | ||
|
|
e0efc21da9 | ||
|
|
24951ea269 | ||
|
|
1041aa6f5f | ||
|
|
691e08fb44 | ||
|
|
f049f31778 | ||
|
|
01d24cd517 | ||
|
|
12c4d1938f | ||
|
|
edc1f58b40 | ||
|
|
9c0a8ee1dc | ||
|
|
8315707aed | ||
|
|
1f1ece53ce | ||
|
|
92af313c43 | ||
|
|
0d207545b8 | ||
|
|
83ece163c0 | ||
|
|
608c16d554 | ||
|
|
fd6f525a65 | ||
|
|
9c01b582eb | ||
|
|
30ae94e8e2 | ||
|
|
9e15f12800 | ||
|
|
aaf922c79a | ||
|
|
4008d0a9d0 | ||
|
|
7cbcbaad8d | ||
|
|
496dff834d | ||
|
|
d81e03ef6f | ||
|
|
85a6a03d41 | ||
|
|
6f78e4b704 | ||
|
|
2656156bcf | ||
|
|
4e3d419e53 | ||
|
|
436b176e36 | ||
|
|
efb8bda519 | ||
|
|
097582fe5e | ||
|
|
1a6a8b3e38 | ||
|
|
3f54f8af2d | ||
|
|
94ca19447f | ||
|
|
2d67115569 | ||
|
|
6e9e9b000f | ||
|
|
a34727feb5 | ||
|
|
b744fbfe2d | ||
|
|
2db3a90049 | ||
|
|
466f80f860 | ||
|
|
2f177f34f1 | ||
|
|
2c2b008678 | ||
|
|
9c26ba3b91 | ||
|
|
1c16e52b97 | ||
|
|
f6fe3477c6 |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* @WillFP
|
||||||
4
.github/workflows/publish-release.yml
vendored
4
.github/workflows/publish-release.yml
vendored
@@ -15,11 +15,11 @@ jobs:
|
|||||||
- name: Checkout latest code
|
- name: Checkout latest code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 21
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: 17
|
java-version: 21
|
||||||
|
|
||||||
- name: Change wrapper permissions
|
- name: Change wrapper permissions
|
||||||
run: chmod +x ./gradlew
|
run: chmod +x ./gradlew
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`java-library`
|
`java-library`
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
kotlin("jvm") version "1.7.10"
|
kotlin("jvm") version "2.1.0"
|
||||||
id("com.github.johnrengelman.shadow") version "8.0.0"
|
id("com.gradleup.shadow") version "8.3.0"
|
||||||
id("com.willfp.libreforge-gradle-plugin") version "1.0.0"
|
id("com.willfp.libreforge-gradle-plugin") version "1.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +27,7 @@ allprojects {
|
|||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
apply(plugin = "kotlin")
|
apply(plugin = "kotlin")
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
apply(plugin = "com.github.johnrengelman.shadow")
|
apply(plugin = "com.gradleup.shadow")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
@@ -37,14 +39,14 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("com.willfp:eco:6.55.0")
|
compileOnly("com.willfp:eco:6.77.0")
|
||||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
@@ -54,8 +56,8 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions {
|
compilerOptions {
|
||||||
jvmTarget = "17"
|
jvmTarget.set(JvmTarget.JVM_21)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,12 @@ dependencies {
|
|||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
register("maven", MavenPublication::class) {
|
register<MavenPublication>("maven") {
|
||||||
from(components["java"])
|
groupId = project.group.toString()
|
||||||
|
version = project.version.toString()
|
||||||
artifactId = rootProject.name
|
artifactId = rootProject.name
|
||||||
|
|
||||||
|
artifact(rootProject.tasks.shadowJar.get().archiveFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ import com.willfp.ecojobs.api.getJobLevel
|
|||||||
import com.willfp.ecojobs.api.jobLimit
|
import com.willfp.ecojobs.api.jobLimit
|
||||||
import com.willfp.ecojobs.commands.CommandEcoJobs
|
import com.willfp.ecojobs.commands.CommandEcoJobs
|
||||||
import com.willfp.ecojobs.commands.CommandJobs
|
import com.willfp.ecojobs.commands.CommandJobs
|
||||||
|
import com.willfp.ecojobs.jobs.EcoJobsJobTopPlaceholder
|
||||||
import com.willfp.ecojobs.jobs.JobLevelListener
|
import com.willfp.ecojobs.jobs.JobLevelListener
|
||||||
import com.willfp.ecojobs.jobs.Jobs
|
import com.willfp.ecojobs.jobs.Jobs
|
||||||
|
import com.willfp.ecojobs.jobs.JobsGUI
|
||||||
import com.willfp.ecojobs.jobs.PriceHandler
|
import com.willfp.ecojobs.jobs.PriceHandler
|
||||||
import com.willfp.ecojobs.jobs.ResetOnQuitListener
|
import com.willfp.ecojobs.jobs.ResetOnQuitListener
|
||||||
import com.willfp.ecojobs.libreforge.ConditionHasActiveJob
|
import com.willfp.ecojobs.libreforge.ConditionHasActiveJob
|
||||||
@@ -30,7 +32,9 @@ import com.willfp.libreforge.filters.Filters
|
|||||||
import com.willfp.libreforge.loader.LibreforgePlugin
|
import com.willfp.libreforge.loader.LibreforgePlugin
|
||||||
import com.willfp.libreforge.loader.configs.ConfigCategory
|
import com.willfp.libreforge.loader.configs.ConfigCategory
|
||||||
import com.willfp.libreforge.registerHolderProvider
|
import com.willfp.libreforge.registerHolderProvider
|
||||||
|
import com.willfp.libreforge.registerSpecificHolderProvider
|
||||||
import com.willfp.libreforge.triggers.Triggers
|
import com.willfp.libreforge.triggers.Triggers
|
||||||
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.event.Listener
|
import org.bukkit.event.Listener
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
@@ -56,12 +60,14 @@ class EcoJobsPlugin : LibreforgePlugin() {
|
|||||||
Triggers.register(TriggerLeaveJob)
|
Triggers.register(TriggerLeaveJob)
|
||||||
Filters.register(FilterJob)
|
Filters.register(FilterJob)
|
||||||
|
|
||||||
registerHolderProvider { player ->
|
registerSpecificHolderProvider<Player> { player ->
|
||||||
player.activeJobs.map { it.getLevel(player.getJobLevel(it)) }.map {
|
player.activeJobs.map { it.getLevel(player.getJobLevel(it)) }.map {
|
||||||
SimpleProvidedHolder(it)
|
SimpleProvidedHolder(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EcoJobsJobTopPlaceholder(this).register()
|
||||||
|
|
||||||
PlayerPlaceholder(
|
PlayerPlaceholder(
|
||||||
this,
|
this,
|
||||||
"limit"
|
"limit"
|
||||||
@@ -82,28 +88,10 @@ class EcoJobsPlugin : LibreforgePlugin() {
|
|||||||
}
|
}
|
||||||
level.toString()
|
level.toString()
|
||||||
}.register()
|
}.register()
|
||||||
|
}
|
||||||
|
|
||||||
DynamicPlaceholder(
|
override fun handleReload() {
|
||||||
this,
|
JobsGUI.update(this)
|
||||||
Pattern.compile("top_[a-z]+_[0-9]+_[a-z]+")
|
|
||||||
) {
|
|
||||||
val split = it.split("_")
|
|
||||||
val jobId = split.getOrNull(1) ?: return@DynamicPlaceholder "You must specify the job id!"
|
|
||||||
val job = Jobs.getByID(jobId) ?: return@DynamicPlaceholder "Invalid job id!"
|
|
||||||
val placeString = split.getOrNull(2) ?: return@DynamicPlaceholder "You must specify the place!"
|
|
||||||
val place = placeString.toIntOrNull() ?: return@DynamicPlaceholder "Invalid place!"
|
|
||||||
val type = split.getOrNull(3) ?: return@DynamicPlaceholder "You must specify the top type!"
|
|
||||||
val topEntry = job.getTop(place)
|
|
||||||
return@DynamicPlaceholder when (type) {
|
|
||||||
"name" -> topEntry?.player?.savedDisplayName
|
|
||||||
?: this.langYml.getFormattedString("top.name-empty")
|
|
||||||
|
|
||||||
"amount" -> topEntry?.amount?.toNiceString()
|
|
||||||
?: this.langYml.getFormattedString("top.amount-empty")
|
|
||||||
|
|
||||||
else -> "Invalid type: $type! Available types: name/amount"
|
|
||||||
}
|
|
||||||
}.register()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadPluginCommands(): List<PluginCommand> {
|
override fun loadPluginCommands(): List<PluginCommand> {
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ fun OfflinePlayer.resetJob(job: Job) {
|
|||||||
/**
|
/**
|
||||||
* Get the experience required to advance to the next level.
|
* Get the experience required to advance to the next level.
|
||||||
*/
|
*/
|
||||||
fun OfflinePlayer.getJobXPRequired(job: Job) = job.getExpForLevel(this.getJobLevel(job) + 1)
|
fun OfflinePlayer.getJobXPRequired(job: Job) = job.getFormattedExpForLevel(this.getJobLevel(job) + 1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get progress to next level between 0 and 1, where 0 is none and 1 is complete.
|
* Get progress to next level between 0 and 1, where 0 is none and 1 is complete.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class CommandJobs(plugin: EcoPlugin) : PluginCommand(plugin, "jobs", "ecojobs.co
|
|||||||
init {
|
init {
|
||||||
this.addSubcommand(CommandJoin(plugin))
|
this.addSubcommand(CommandJoin(plugin))
|
||||||
.addSubcommand(CommandLeave(plugin))
|
.addSubcommand(CommandLeave(plugin))
|
||||||
|
.addSubcommand(CommandTop(plugin))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onExecute(player: Player, args: List<String>) {
|
override fun onExecute(player: Player, args: List<String>) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.willfp.ecojobs.api.resetJob
|
|||||||
import com.willfp.ecojobs.jobs.Jobs
|
import com.willfp.ecojobs.jobs.Jobs
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
||||||
|
import org.bukkit.util.StringUtil
|
||||||
|
|
||||||
class CommandReset(plugin: EcoPlugin) : Subcommand(plugin, "reset", "ecojobs.command.reset", false) {
|
class CommandReset(plugin: EcoPlugin) : Subcommand(plugin, "reset", "ecojobs.command.reset", false) {
|
||||||
override fun onExecute(sender: CommandSender, args: List<String>) {
|
override fun onExecute(sender: CommandSender, args: List<String>) {
|
||||||
@@ -24,16 +25,68 @@ class CommandReset(plugin: EcoPlugin) : Subcommand(plugin, "reset", "ecojobs.com
|
|||||||
}
|
}
|
||||||
|
|
||||||
val playerName = args[0]
|
val playerName = args[0]
|
||||||
|
val jobName = args[1]
|
||||||
|
|
||||||
|
// Reset all jobs for all players
|
||||||
|
if (playerName.equals("all", ignoreCase = true) && jobName.equals("all", ignoreCase = true)) {
|
||||||
|
Bukkit.getOnlinePlayers().forEach { player ->
|
||||||
|
Jobs.values().forEach { job ->
|
||||||
|
if (player.hasJob(job)) {
|
||||||
|
player.forceLeaveJob(job)
|
||||||
|
player.resetJob(job)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(plugin.langYml.getMessage("reset-all-players-all-jobs"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset a specific job for all players
|
||||||
|
if (playerName.equals("all", ignoreCase = true)) {
|
||||||
|
val job = Jobs.getByID(jobName)
|
||||||
|
if (job == null) {
|
||||||
|
sender.sendMessage(plugin.langYml.getMessage("invalid-job"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getOnlinePlayers().forEach { player ->
|
||||||
|
if (player.hasJob(job)) {
|
||||||
|
player.forceLeaveJob(job)
|
||||||
|
player.resetJob(job)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(
|
||||||
|
plugin.langYml.getMessage("reset-all-players")
|
||||||
|
.replace("%job%", job.name)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset all jobs for a specific player
|
||||||
val player = Bukkit.getPlayer(playerName)
|
val player = Bukkit.getPlayer(playerName)
|
||||||
|
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
|
sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val job = Jobs.getByID(args[1])
|
if (jobName.equals("all", ignoreCase = true)) {
|
||||||
|
Jobs.values().forEach { job ->
|
||||||
|
if (player.hasJob(job)) {
|
||||||
|
player.forceLeaveJob(job)
|
||||||
|
player.resetJob(job)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(
|
||||||
|
plugin.langYml.getMessage("reset-all-jobs")
|
||||||
|
.replace("%player%", player.savedDisplayName)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset a specific job for a specific player
|
||||||
|
val job = Jobs.getByID(jobName)
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
sender.sendMessage(plugin.langYml.getMessage("invalid-job"))
|
sender.sendMessage(plugin.langYml.getMessage("invalid-job"))
|
||||||
return
|
return
|
||||||
@@ -55,12 +108,23 @@ class CommandReset(plugin: EcoPlugin) : Subcommand(plugin, "reset", "ecojobs.com
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||||
|
val completions = mutableListOf<String>()
|
||||||
if (args.size == 1) {
|
if (args.size == 1) {
|
||||||
return Bukkit.getOnlinePlayers().map { it.name }
|
StringUtil.copyPartialMatches(
|
||||||
|
args[0],
|
||||||
|
listOf("all") union Bukkit.getOnlinePlayers().map { player -> player.name },
|
||||||
|
completions
|
||||||
|
)
|
||||||
|
return completions
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.size == 2) {
|
if (args.size == 2) {
|
||||||
return Jobs.values().map { it.id }
|
StringUtil.copyPartialMatches(
|
||||||
|
args[1],
|
||||||
|
listOf("all") union Jobs.values().map { it.id },
|
||||||
|
completions
|
||||||
|
)
|
||||||
|
return completions
|
||||||
}
|
}
|
||||||
|
|
||||||
return emptyList()
|
return emptyList()
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.willfp.ecojobs.commands
|
||||||
|
|
||||||
|
import com.willfp.eco.core.EcoPlugin
|
||||||
|
import com.willfp.eco.core.command.impl.Subcommand
|
||||||
|
import com.willfp.eco.core.placeholder.context.placeholderContext
|
||||||
|
import com.willfp.eco.util.formatEco
|
||||||
|
import com.willfp.eco.util.savedDisplayName
|
||||||
|
import com.willfp.ecojobs.jobs.Jobs
|
||||||
|
import org.bukkit.command.CommandSender
|
||||||
|
import org.bukkit.entity.Player
|
||||||
|
import org.bukkit.util.StringUtil
|
||||||
|
|
||||||
|
class CommandTop(plugin: EcoPlugin) : Subcommand(plugin, "top", "ecojobs.command.top", false) {
|
||||||
|
override fun onExecute(sender: CommandSender, args: List<String>) {
|
||||||
|
plugin.scheduler.runAsync {
|
||||||
|
val job = Jobs.getByID(args.getOrNull(0))
|
||||||
|
|
||||||
|
if (job == null) {
|
||||||
|
sender.sendMessage(plugin.langYml.getMessage("invalid-job"))
|
||||||
|
return@runAsync
|
||||||
|
}
|
||||||
|
|
||||||
|
val page = args.getOrNull(1)?.toIntOrNull() ?: 1
|
||||||
|
|
||||||
|
if (args.getOrNull(1)?.let { it.isNotBlank() && !it.matches("\\d+".toRegex()) } == true) {
|
||||||
|
sender.sendMessage(plugin.langYml.getMessage("invalid-page"))
|
||||||
|
return@runAsync
|
||||||
|
}
|
||||||
|
|
||||||
|
val offset = (page - 1) * 10
|
||||||
|
val positions = (offset + 1..offset + 10).toList()
|
||||||
|
|
||||||
|
val top = positions.mapNotNull { job.getTop(it) }
|
||||||
|
|
||||||
|
val messages = plugin.langYml.getStrings("top.format").toMutableList()
|
||||||
|
val lines = mutableListOf<String>()
|
||||||
|
|
||||||
|
top.forEachIndexed { index, entry ->
|
||||||
|
val line = plugin.langYml.getString("top-line-format")
|
||||||
|
.replace("%rank%", (offset + index + 1).toString())
|
||||||
|
.replace("%level%", entry.level.toString())
|
||||||
|
.replace("%player%", entry.player.savedDisplayName)
|
||||||
|
lines.add(line)
|
||||||
|
}
|
||||||
|
|
||||||
|
val linesIndex = messages.indexOf("%lines%")
|
||||||
|
if (linesIndex != -1) {
|
||||||
|
messages.removeAt(linesIndex)
|
||||||
|
messages.addAll(linesIndex, lines)
|
||||||
|
}
|
||||||
|
|
||||||
|
messages.forEach { message ->
|
||||||
|
sender.sendMessage(
|
||||||
|
message.formatEco(
|
||||||
|
placeholderContext(
|
||||||
|
player = sender as? Player
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||||
|
val completions = mutableListOf<String>()
|
||||||
|
|
||||||
|
if (args.size == 1) {
|
||||||
|
StringUtil.copyPartialMatches(
|
||||||
|
args[0],
|
||||||
|
Jobs.values().map { it.id },
|
||||||
|
completions
|
||||||
|
)
|
||||||
|
return completions
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size == 2 && Jobs.getByID(args[0]) != null) {
|
||||||
|
StringUtil.copyPartialMatches(
|
||||||
|
args[1],
|
||||||
|
listOf("1", "2", "3", "4", "5"),
|
||||||
|
completions
|
||||||
|
)
|
||||||
|
return completions
|
||||||
|
}
|
||||||
|
|
||||||
|
return emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.willfp.ecojobs.jobs
|
||||||
|
|
||||||
|
import com.willfp.eco.core.EcoPlugin
|
||||||
|
import com.willfp.eco.core.placeholder.RegistrablePlaceholder
|
||||||
|
import com.willfp.eco.core.placeholder.context.PlaceholderContext
|
||||||
|
import com.willfp.eco.util.savedDisplayName
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
|
class EcoJobsJobTopPlaceholder(
|
||||||
|
private val plugin: EcoPlugin
|
||||||
|
) : RegistrablePlaceholder {
|
||||||
|
private val pattern = Pattern.compile("top_([a-z0-9_]+)_(\\d+)_(name|level|amount)")
|
||||||
|
|
||||||
|
override fun getPattern(): Pattern = pattern
|
||||||
|
override fun getPlugin(): EcoPlugin = plugin
|
||||||
|
|
||||||
|
override fun getValue(params: String, ctx: PlaceholderContext): String? {
|
||||||
|
val emptyPosition: String = plugin.langYml.getString("top.empty-position")
|
||||||
|
|
||||||
|
val matcher = pattern.matcher(params)
|
||||||
|
if (!matcher.matches()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
val jobId = matcher.group(1)
|
||||||
|
val place = matcher.group(2).toIntOrNull() ?: return null
|
||||||
|
val type = matcher.group(3)
|
||||||
|
|
||||||
|
val job = Jobs.getByID(jobId) ?: return null
|
||||||
|
|
||||||
|
return when (type) {
|
||||||
|
"name" -> job.getTop(place)?.player?.savedDisplayName ?: emptyPosition
|
||||||
|
"level", "amount" -> job.getTop(place)?.level?.toString() ?: emptyPosition
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,12 +9,15 @@ import com.willfp.eco.core.items.builder.ItemStackBuilder
|
|||||||
import com.willfp.eco.core.placeholder.PlayerPlaceholder
|
import com.willfp.eco.core.placeholder.PlayerPlaceholder
|
||||||
import com.willfp.eco.core.placeholder.PlayerStaticPlaceholder
|
import com.willfp.eco.core.placeholder.PlayerStaticPlaceholder
|
||||||
import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
|
import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
|
||||||
|
import com.willfp.eco.core.placeholder.context.placeholderContext
|
||||||
import com.willfp.eco.core.price.ConfiguredPrice
|
import com.willfp.eco.core.price.ConfiguredPrice
|
||||||
import com.willfp.eco.core.price.impl.PriceEconomy
|
import com.willfp.eco.core.price.impl.PriceEconomy
|
||||||
import com.willfp.eco.core.registry.Registrable
|
import com.willfp.eco.core.registry.Registrable
|
||||||
import com.willfp.eco.util.NumberUtils
|
import com.willfp.eco.util.NumberUtils
|
||||||
|
import com.willfp.eco.util.NumberUtils.evaluateExpression
|
||||||
import com.willfp.eco.util.formatEco
|
import com.willfp.eco.util.formatEco
|
||||||
import com.willfp.eco.util.toNiceString
|
import com.willfp.eco.util.toNiceString
|
||||||
|
import com.willfp.eco.util.toNumeral
|
||||||
import com.willfp.ecojobs.EcoJobsPlugin
|
import com.willfp.ecojobs.EcoJobsPlugin
|
||||||
import com.willfp.ecojobs.api.activeJobs
|
import com.willfp.ecojobs.api.activeJobs
|
||||||
import com.willfp.ecojobs.api.canJoinJob
|
import com.willfp.ecojobs.api.canJoinJob
|
||||||
@@ -24,20 +27,23 @@ import com.willfp.ecojobs.api.getJobXP
|
|||||||
import com.willfp.ecojobs.api.getJobXPRequired
|
import com.willfp.ecojobs.api.getJobXPRequired
|
||||||
import com.willfp.ecojobs.api.hasJobActive
|
import com.willfp.ecojobs.api.hasJobActive
|
||||||
import com.willfp.ecojobs.api.jobLimit
|
import com.willfp.ecojobs.api.jobLimit
|
||||||
|
import com.willfp.ecojobs.util.LeaderboardCacheEntry
|
||||||
|
import com.willfp.ecojobs.util.LevelInjectable
|
||||||
import com.willfp.libreforge.ViolationContext
|
import com.willfp.libreforge.ViolationContext
|
||||||
import com.willfp.libreforge.conditions.ConditionList
|
import com.willfp.libreforge.conditions.ConditionList
|
||||||
import com.willfp.libreforge.conditions.Conditions
|
import com.willfp.libreforge.conditions.Conditions
|
||||||
import com.willfp.libreforge.counters.Counters
|
import com.willfp.libreforge.counters.Counters
|
||||||
import com.willfp.libreforge.effects.EffectList
|
import com.willfp.libreforge.effects.EffectList
|
||||||
import com.willfp.libreforge.effects.Effects
|
import com.willfp.libreforge.effects.Effects
|
||||||
|
import com.willfp.libreforge.effects.executors.impl.NormalExecutorFactory
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.OfflinePlayer
|
import org.bukkit.OfflinePlayer
|
||||||
|
import org.bukkit.configuration.InvalidConfigurationException
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.UUID
|
||||||
import kotlin.math.max
|
|
||||||
|
|
||||||
class Job(
|
class Job(
|
||||||
val id: String,
|
val id: String,
|
||||||
@@ -49,8 +55,11 @@ class Job(
|
|||||||
.build<Int, LeaderboardCacheEntry?>()
|
.build<Int, LeaderboardCacheEntry?>()
|
||||||
|
|
||||||
val name = config.getFormattedString("name")
|
val name = config.getFormattedString("name")
|
||||||
|
|
||||||
val description = config.getFormattedString("description")
|
val description = config.getFormattedString("description")
|
||||||
|
|
||||||
val isUnlockedByDefault = config.getBool("unlocked-by-default")
|
val isUnlockedByDefault = config.getBool("unlocked-by-default")
|
||||||
|
|
||||||
val resetsOnQuit = config.getBool("reset-on-quit")
|
val resetsOnQuit = config.getBool("reset-on-quit")
|
||||||
|
|
||||||
val joinPrice = ConfiguredPrice.create(config.getSubsection("join-price")) ?: ConfiguredPrice(
|
val joinPrice = ConfiguredPrice.create(config.getSubsection("join-price")) ?: ConfiguredPrice(
|
||||||
@@ -71,9 +80,11 @@ class Job(
|
|||||||
EcoJobsPlugin.instance.namespacedKeyFactory.create("${id}_xp"), PersistentDataKeyType.DOUBLE, 0.0
|
EcoJobsPlugin.instance.namespacedKeyFactory.create("${id}_xp"), PersistentDataKeyType.DOUBLE, 0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val xpFormula = config.getStringOrNull("xp-formula")
|
||||||
|
|
||||||
private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements")
|
private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements")
|
||||||
|
|
||||||
val maxLevel = levelXpRequirements.size
|
val maxLevel = config.getIntOrNull("max-level") ?: levelXpRequirements?.size ?: Int.MAX_VALUE
|
||||||
|
|
||||||
val levelGUI = JobLevelGUI(plugin, this)
|
val levelGUI = JobLevelGUI(plugin, this)
|
||||||
|
|
||||||
@@ -106,6 +117,10 @@ class Job(
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
if (xpFormula == null && levelXpRequirements == null) {
|
||||||
|
throw InvalidConfigurationException("Skill $id has no requirements or xp formula")
|
||||||
|
}
|
||||||
|
|
||||||
config.injectPlaceholders(PlayerStaticPlaceholder(
|
config.injectPlaceholders(PlayerStaticPlaceholder(
|
||||||
"level"
|
"level"
|
||||||
) { p ->
|
) { p ->
|
||||||
@@ -122,24 +137,7 @@ class Job(
|
|||||||
ViolationContext(plugin, "Job $id")
|
ViolationContext(plugin, "Job $id")
|
||||||
)
|
)
|
||||||
|
|
||||||
for (string in config.getStrings("level-commands")) {
|
manageLevelCommands(config)
|
||||||
val split = string.split(":")
|
|
||||||
|
|
||||||
if (split.size == 1) {
|
|
||||||
for (level in 1..maxLevel) {
|
|
||||||
val commands = levelCommands[level] ?: mutableListOf()
|
|
||||||
commands.add(string)
|
|
||||||
levelCommands[level] = commands
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
val level = split[0].toInt()
|
|
||||||
|
|
||||||
val command = string.removePrefix("$level:")
|
|
||||||
val commands = levelCommands[level] ?: mutableListOf()
|
|
||||||
commands.add(command)
|
|
||||||
levelCommands[level] = commands
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerPlaceholder(
|
PlayerPlaceholder(
|
||||||
plugin, "${id}_percentage_progress"
|
plugin, "${id}_percentage_progress"
|
||||||
@@ -188,8 +186,59 @@ class Job(
|
|||||||
) {
|
) {
|
||||||
Bukkit.getOfflinePlayers().count { this in it.activeJobs }.toString()
|
Bukkit.getOfflinePlayers().count { this in it.activeJobs }.toString()
|
||||||
}.register()
|
}.register()
|
||||||
|
|
||||||
|
PlayerPlaceholder(
|
||||||
|
plugin, "${id}_leaderboard_rank"
|
||||||
|
) { player ->
|
||||||
|
val emptyPosition = plugin.langYml.getString("top.empty-position")
|
||||||
|
val position = getPosition(player.uniqueId)
|
||||||
|
position?.toString() ?: emptyPosition
|
||||||
|
}.register()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Use level-up-effects instead")
|
||||||
|
private fun manageLevelCommands(config: Config) {
|
||||||
|
if (config.getStrings("level-commands").isNotEmpty()) {
|
||||||
|
plugin.logger.warning("$id job: The `level-commands` key is deprecated and will be removed in future versions. Switch to `level-up-effects` instead. Refer to the wiki for more info.")
|
||||||
|
}
|
||||||
|
for (string in config.getStrings("level-commands")) {
|
||||||
|
val split = string.split(":")
|
||||||
|
|
||||||
|
if (split.size == 1) {
|
||||||
|
for (level in 1..maxLevel) {
|
||||||
|
val commands = levelCommands[level] ?: mutableListOf()
|
||||||
|
commands.add(string)
|
||||||
|
levelCommands[level] = commands
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val level = split[0].toInt()
|
||||||
|
|
||||||
|
val command = string.removePrefix("$level:")
|
||||||
|
val commands = levelCommands[level] ?: mutableListOf()
|
||||||
|
commands.add(command)
|
||||||
|
levelCommands[level] = commands
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val levelUpEffects = Effects.compileChain(
|
||||||
|
config.getSubsections("level-up-effects"),
|
||||||
|
NormalExecutorFactory.create(),
|
||||||
|
ViolationContext(plugin, "Job $id level-up-effects")
|
||||||
|
)
|
||||||
|
|
||||||
|
val joinEffects = Effects.compileChain(
|
||||||
|
config.getSubsections("join-effects"),
|
||||||
|
NormalExecutorFactory.create(),
|
||||||
|
ViolationContext(plugin, "Job $id join-effects")
|
||||||
|
)
|
||||||
|
|
||||||
|
val leaveEffects = Effects.compileChain(
|
||||||
|
config.getSubsections("leave-effects"),
|
||||||
|
NormalExecutorFactory.create(),
|
||||||
|
ViolationContext(plugin, "Job $id leave-effects")
|
||||||
|
)
|
||||||
|
|
||||||
override fun onRegister() {
|
override fun onRegister() {
|
||||||
jobXpGains.forEach { it.bind(JobXPAccumulator(this)) }
|
jobXpGains.forEach { it.bind(JobXPAccumulator(this)) }
|
||||||
}
|
}
|
||||||
@@ -272,20 +321,31 @@ class Job(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun injectPlaceholdersInto(lore: List<String>, player: Player, forceLevel: Int? = null): List<String> {
|
fun injectPlaceholdersInto(lore: List<String>, player: Player, forceLevel: Int? = null): List<String> {
|
||||||
val withPlaceholders = lore.map {
|
val withPlaceholders = lore.map { line ->
|
||||||
it.replace("%percentage_progress%", (player.getJobProgress(this) * 100).toNiceString())
|
var result = line
|
||||||
|
.replace("%percentage_progress%", (player.getJobProgress(this) * 100).toNiceString())
|
||||||
.replace("%current_xp%", player.getJobXP(this).toNiceString())
|
.replace("%current_xp%", player.getJobXP(this).toNiceString())
|
||||||
.replace("%required_xp%", this.getExpForLevel(player.getJobLevel(this) + 1).let { req ->
|
.replace("%required_xp%", this.getFormattedExpForLevel(player.getJobLevel(this) + 1))
|
||||||
if (req == Int.MAX_VALUE) {
|
.replace("%description%", this.description).replace("%job%", this.name)
|
||||||
plugin.langYml.getFormattedString("infinity")
|
|
||||||
} else {
|
|
||||||
req.toNiceString()
|
|
||||||
}
|
|
||||||
}).replace("%description%", this.description).replace("%job%", this.name)
|
|
||||||
.replace("%level%", (forceLevel ?: player.getJobLevel(this)).toString())
|
.replace("%level%", (forceLevel ?: player.getJobLevel(this)).toString())
|
||||||
.replace("%level_numeral%", NumberUtils.toNumeral(forceLevel ?: player.getJobLevel(this)))
|
.replace("%level_numeral%", NumberUtils.toNumeral(forceLevel ?: player.getJobLevel(this)))
|
||||||
.replace("%join_price%", this.joinPrice.getDisplay(player))
|
.replace("%join_price%", this.joinPrice.getDisplay(player))
|
||||||
.replace("%leave_price%", this.leavePrice.getDisplay(player))
|
.replace("%leave_price%", this.leavePrice.getDisplay(player))
|
||||||
|
.replace("%rank%", this.getPosition(player.uniqueId)?.toString() ?: plugin.langYml.getString("top.empty-position"))
|
||||||
|
|
||||||
|
val level = forceLevel ?: player.getJobLevel(this)
|
||||||
|
val regex = Regex("%level_(-?\\d+)(_numeral)?%")
|
||||||
|
|
||||||
|
// Handle dynamic %level_X% and %level_X_numeral%
|
||||||
|
result = regex.replace(result) { match ->
|
||||||
|
val offset = match.groupValues[1].toIntOrNull() ?: return@replace match.value
|
||||||
|
val isNumeral = match.groupValues[2].isNotEmpty()
|
||||||
|
val newLevel = level + offset
|
||||||
|
|
||||||
|
if (isNumeral) newLevel.toNumeral() else newLevel.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
|
|
||||||
val processed = mutableListOf<List<String>>()
|
val processed = mutableListOf<List<String>>()
|
||||||
@@ -347,14 +407,36 @@ class Job(
|
|||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getExpForLevel(level: Int): Int {
|
/**
|
||||||
|
* Get the XP required to reach the next level, if currently at [level].
|
||||||
|
*/
|
||||||
|
fun getExpForLevel(level: Int): Double {
|
||||||
if (level < 1 || level > maxLevel) {
|
if (level < 1 || level > maxLevel) {
|
||||||
return Int.MAX_VALUE
|
return Double.MAX_VALUE
|
||||||
}
|
}
|
||||||
|
|
||||||
return levelXpRequirements[level - 1]
|
if (xpFormula != null) {
|
||||||
|
return evaluateExpression(
|
||||||
|
xpFormula,
|
||||||
|
placeholderContext(
|
||||||
|
injectable = LevelInjectable(level - 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return levelXpRequirements[level - 1].toDouble()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getFormattedExpForLevel(level: Int): String {
|
||||||
|
val required = getExpForLevel(level)
|
||||||
|
return if (required.isInfinite()) {
|
||||||
|
plugin.langYml.getFormattedString("infinity")
|
||||||
|
} else {
|
||||||
|
required.toNiceString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("Use level-up-effects instead")
|
||||||
fun executeLevelCommands(player: Player, level: Int) {
|
fun executeLevelCommands(player: Player, level: Int) {
|
||||||
val commands = levelCommands[level] ?: emptyList()
|
val commands = levelCommands[level] ?: emptyList()
|
||||||
|
|
||||||
@@ -371,6 +453,14 @@ class Job(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getPosition(uuid: UUID): Int? {
|
||||||
|
val leaderboard = Bukkit.getOfflinePlayers().sortedByDescending { it.getJobLevel(this) }
|
||||||
|
.map { it.uniqueId }
|
||||||
|
|
||||||
|
val index = leaderboard.indexOf(uuid)
|
||||||
|
return if (index == -1) null else index + 1
|
||||||
|
}
|
||||||
|
|
||||||
override fun getID(): String {
|
override fun getID(): String {
|
||||||
return this.id
|
return this.id
|
||||||
}
|
}
|
||||||
@@ -394,11 +484,6 @@ private class LevelPlaceholder(
|
|||||||
operator fun invoke(level: Int) = function(level)
|
operator fun invoke(level: Int) = function(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class LeaderboardCacheEntry(
|
|
||||||
val player: OfflinePlayer,
|
|
||||||
val amount: Int
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun Collection<LevelPlaceholder>.format(string: String, level: Int): String {
|
private fun Collection<LevelPlaceholder>.format(string: String, level: Int): String {
|
||||||
var process = string
|
var process = string
|
||||||
for (placeholder in this) {
|
for (placeholder in this) {
|
||||||
@@ -408,44 +493,3 @@ private fun Collection<LevelPlaceholder>.format(string: String, level: Int): Str
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun OfflinePlayer.getJobLevelObject(job: Job): JobLevel = job.getLevel(this.getJobLevel(job))
|
fun OfflinePlayer.getJobLevelObject(job: Job): JobLevel = job.getLevel(this.getJobLevel(job))
|
||||||
|
|
||||||
private val expMultiplierCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.SECONDS).build<Player, Double> {
|
|
||||||
it.cacheJobExperienceMultiplier()
|
|
||||||
}
|
|
||||||
|
|
||||||
val Player.jobExperienceMultiplier: Double
|
|
||||||
get() = expMultiplierCache.get(this)
|
|
||||||
|
|
||||||
private fun Player.cacheJobExperienceMultiplier(): Double {
|
|
||||||
if (this.hasPermission("ecojobs.xpmultiplier.quadruple")) {
|
|
||||||
return 4.0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasPermission("ecojobs.xpmultiplier.triple")) {
|
|
||||||
return 3.0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasPermission("ecojobs.xpmultiplier.double")) {
|
|
||||||
return 2.0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasPermission("ecojobs.xpmultiplier.50percent")) {
|
|
||||||
return 1.5
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1 + getNumericalPermission("ecojobs.xpmultiplier", 0.0) / 100
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Player.getNumericalPermission(permission: String, default: Double): Double {
|
|
||||||
var highest: Double? = null
|
|
||||||
|
|
||||||
for (permissionAttachmentInfo in this.effectivePermissions) {
|
|
||||||
val perm = permissionAttachmentInfo.permission
|
|
||||||
if (perm.startsWith(permission)) {
|
|
||||||
val found = perm.substring(perm.lastIndexOf(".") + 1).toDoubleOrNull() ?: continue
|
|
||||||
highest = max(highest ?: Double.MIN_VALUE, found)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return highest ?: default
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.willfp.eco.core.gui.slot.MaskItems
|
|||||||
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.util.NumberUtils
|
import com.willfp.eco.util.NumberUtils
|
||||||
|
import com.willfp.eco.util.formatEco
|
||||||
import com.willfp.ecojobs.api.getJobLevel
|
import com.willfp.ecojobs.api.getJobLevel
|
||||||
import com.willfp.ecomponent.components.LevelComponent
|
import com.willfp.ecomponent.components.LevelComponent
|
||||||
import com.willfp.ecomponent.components.LevelState
|
import com.willfp.ecomponent.components.LevelState
|
||||||
@@ -65,7 +66,9 @@ class JobLevelGUI(
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu = menu(plugin.configYml.getInt("level-gui.rows")) {
|
menu = menu(plugin.configYml.getInt("level-gui.rows")) {
|
||||||
title = job.name
|
title = plugin.configYml.getString("level-gui.title")
|
||||||
|
.replace("%job%", job.name)
|
||||||
|
.formatEco()
|
||||||
|
|
||||||
maxPages(component.pages)
|
maxPages(component.pages)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.willfp.ecojobs.jobs
|
package com.willfp.ecojobs.jobs
|
||||||
|
|
||||||
|
import com.willfp.eco.util.SoundUtils
|
||||||
import com.willfp.ecojobs.EcoJobsPlugin
|
import com.willfp.ecojobs.EcoJobsPlugin
|
||||||
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import org.bukkit.Sound
|
import org.bukkit.Sound
|
||||||
import org.bukkit.event.EventHandler
|
import org.bukkit.event.EventHandler
|
||||||
import org.bukkit.event.EventPriority
|
import org.bukkit.event.EventPriority
|
||||||
@@ -16,18 +18,21 @@ class JobLevelListener(
|
|||||||
val player = event.player
|
val player = event.player
|
||||||
val level = event.level
|
val level = event.level
|
||||||
|
|
||||||
|
job.levelUpEffects?.trigger(player.toDispatcher())
|
||||||
job.executeLevelCommands(player, level)
|
job.executeLevelCommands(player, level)
|
||||||
|
|
||||||
if (this.plugin.configYml.getBool("level-up.sound.enabled")) {
|
if (this.plugin.configYml.getBool("level-up.sound.enabled")) {
|
||||||
val sound = Sound.valueOf(this.plugin.configYml.getString("level-up.sound.id").uppercase())
|
val sound = SoundUtils.getSound(this.plugin.configYml.getString("level-up.sound.id"))
|
||||||
val pitch = this.plugin.configYml.getDouble("level-up.sound.pitch")
|
val pitch = this.plugin.configYml.getDouble("level-up.sound.pitch")
|
||||||
|
|
||||||
player.playSound(
|
if (sound != null) {
|
||||||
player.location,
|
player.playSound(
|
||||||
sound,
|
player.location,
|
||||||
100f,
|
sound,
|
||||||
pitch.toFloat()
|
100f,
|
||||||
)
|
pitch.toFloat()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.plugin.configYml.getBool("level-up.message.enabled")) {
|
if (this.plugin.configYml.getBool("level-up.message.enabled")) {
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.willfp.ecojobs.jobs
|
package com.willfp.ecojobs.jobs
|
||||||
|
|
||||||
|
import com.github.benmanes.caffeine.cache.Caffeine
|
||||||
import com.willfp.ecojobs.api.giveJobExperience
|
import com.willfp.ecojobs.api.giveJobExperience
|
||||||
import com.willfp.ecojobs.api.hasJobActive
|
import com.willfp.ecojobs.api.hasJobActive
|
||||||
import com.willfp.libreforge.counters.Accumulator
|
import com.willfp.libreforge.counters.Accumulator
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
class JobXPAccumulator(
|
class JobXPAccumulator(
|
||||||
private val job: Job
|
private val job: Job
|
||||||
@@ -16,3 +19,44 @@ class JobXPAccumulator(
|
|||||||
player.giveJobExperience(job, count)
|
player.giveJobExperience(job, count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val expMultiplierCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.SECONDS).build<Player, Double> {
|
||||||
|
it.cacheJobExperienceMultiplier()
|
||||||
|
}
|
||||||
|
|
||||||
|
val Player.jobExperienceMultiplier: Double
|
||||||
|
get() = expMultiplierCache.get(this)
|
||||||
|
|
||||||
|
private fun Player.cacheJobExperienceMultiplier(): Double {
|
||||||
|
if (this.hasPermission("ecojobs.xpmultiplier.quadruple")) {
|
||||||
|
return 4.0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasPermission("ecojobs.xpmultiplier.triple")) {
|
||||||
|
return 3.0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasPermission("ecojobs.xpmultiplier.double")) {
|
||||||
|
return 2.0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasPermission("ecojobs.xpmultiplier.50percent")) {
|
||||||
|
return 1.5
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1 + getNumericalPermission("ecojobs.xpmultiplier", 0.0) / 100
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Player.getNumericalPermission(permission: String, default: Double): Double {
|
||||||
|
var highest: Double? = null
|
||||||
|
|
||||||
|
for (permissionAttachmentInfo in this.effectivePermissions) {
|
||||||
|
val perm = permissionAttachmentInfo.permission
|
||||||
|
if (perm.startsWith(permission)) {
|
||||||
|
val found = perm.substring(perm.lastIndexOf(".") + 1).toDoubleOrNull() ?: continue
|
||||||
|
highest = max(highest ?: Double.MIN_VALUE, found)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return highest ?: default
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.willfp.ecojobs.jobs
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList
|
import com.google.common.collect.ImmutableList
|
||||||
import com.willfp.eco.core.config.interfaces.Config
|
import com.willfp.eco.core.config.interfaces.Config
|
||||||
import com.willfp.eco.core.config.updating.ConfigUpdater
|
|
||||||
import com.willfp.eco.core.registry.Registry
|
import com.willfp.eco.core.registry.Registry
|
||||||
import com.willfp.ecojobs.EcoJobsPlugin
|
import com.willfp.ecojobs.EcoJobsPlugin
|
||||||
import com.willfp.ecojobs.api.getJobLevel
|
import com.willfp.ecojobs.api.getJobLevel
|
||||||
@@ -30,8 +29,8 @@ object Jobs : ConfigCategory("job", "jobs") {
|
|||||||
* @return The matching [Job], or null if not found.
|
* @return The matching [Job], or null if not found.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getByID(name: String): Job? {
|
fun getByID(name: String?): Job? {
|
||||||
return registry[name]
|
return name?.let { registry[it] }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun clear(plugin: LibreforgePlugin) {
|
override fun clear(plugin: LibreforgePlugin) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.willfp.ecojobs.jobs
|
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
|
||||||
import com.willfp.eco.core.gui.menu.Menu
|
import com.willfp.eco.core.gui.menu.Menu
|
||||||
import com.willfp.eco.core.gui.onLeftClick
|
import com.willfp.eco.core.gui.onLeftClick
|
||||||
@@ -13,6 +12,7 @@ import com.willfp.eco.core.gui.slot.MaskItems
|
|||||||
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.builder.SkullBuilder
|
import com.willfp.eco.core.items.builder.SkullBuilder
|
||||||
|
import com.willfp.eco.util.SoundUtils
|
||||||
import com.willfp.eco.util.formatEco
|
import com.willfp.eco.util.formatEco
|
||||||
import com.willfp.ecojobs.EcoJobsPlugin
|
import com.willfp.ecojobs.EcoJobsPlugin
|
||||||
import com.willfp.ecojobs.api.activeJobs
|
import com.willfp.ecojobs.api.activeJobs
|
||||||
@@ -27,16 +27,12 @@ import org.bukkit.entity.Player
|
|||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.inventory.meta.SkullMeta
|
import org.bukkit.inventory.meta.SkullMeta
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.max
|
|
||||||
import kotlin.math.min
|
|
||||||
|
|
||||||
object JobsGUI {
|
object JobsGUI {
|
||||||
private lateinit var menu: Menu
|
private lateinit var menu: Menu
|
||||||
private val jobAreaSlots = mutableListOf<Pair<Int, Int>>()
|
private val jobAreaSlots = mutableListOf<Pair<Int, Int>>()
|
||||||
|
|
||||||
@JvmStatic
|
internal fun update(plugin: EcoJobsPlugin) {
|
||||||
@ConfigUpdater
|
|
||||||
fun update(plugin: EcoJobsPlugin) {
|
|
||||||
val topLeftRow = plugin.configYml.getInt("gui.job-area.top-left.row")
|
val topLeftRow = plugin.configYml.getInt("gui.job-area.top-left.row")
|
||||||
val topLeftColumn = plugin.configYml.getInt("gui.job-area.top-left.column")
|
val topLeftColumn = plugin.configYml.getInt("gui.job-area.top-left.column")
|
||||||
val bottomRightRow = plugin.configYml.getInt("gui.job-area.bottom-right.row")
|
val bottomRightRow = plugin.configYml.getInt("gui.job-area.bottom-right.row")
|
||||||
@@ -150,12 +146,16 @@ object JobsGUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.playSound(
|
val sound = SoundUtils.getSound(plugin.configYml.getString("gui.job-icon.click.sound"))
|
||||||
player.location,
|
|
||||||
Sound.valueOf(plugin.configYml.getString("gui.job-icon.click.sound").uppercase()),
|
if (sound != null) {
|
||||||
1f,
|
player.playSound(
|
||||||
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
player.location,
|
||||||
)
|
sound,
|
||||||
|
1f,
|
||||||
|
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onRightClick { player, _, _, menu ->
|
onRightClick { player, _, _, menu ->
|
||||||
@@ -170,12 +170,16 @@ object JobsGUI {
|
|||||||
if (player.hasJobActive(job)) {
|
if (player.hasJobActive(job)) {
|
||||||
job.leaveGUI.open(player)
|
job.leaveGUI.open(player)
|
||||||
|
|
||||||
player.playSound(
|
val sound = SoundUtils.getSound(plugin.configYml.getString("gui.job-icon.click.sound"))
|
||||||
player.location,
|
|
||||||
Sound.valueOf(plugin.configYml.getString("gui.job-icon.click.sound").uppercase()),
|
if (sound != null) {
|
||||||
1f,
|
player.playSound(
|
||||||
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
player.location,
|
||||||
)
|
sound,
|
||||||
|
1f,
|
||||||
|
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -204,12 +208,14 @@ object JobsGUI {
|
|||||||
)
|
)
|
||||||
|
|
||||||
maxPages { player ->
|
maxPages { player ->
|
||||||
ceil(Jobs.values()
|
ceil(
|
||||||
.filter { player.getJobLevel(it) > 0 }
|
Jobs.values()
|
||||||
.size.toDouble() / jobAreaSlots.size).toInt()
|
.filter { player.getJobLevel(it) > 0 }
|
||||||
|
.size.toDouble() / jobAreaSlots.size).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
setSlot(plugin.configYml.getInt("gui.close.location.row"),
|
setSlot(
|
||||||
|
plugin.configYml.getInt("gui.close.location.row"),
|
||||||
plugin.configYml.getInt("gui.close.location.column"),
|
plugin.configYml.getInt("gui.close.location.column"),
|
||||||
slot(
|
slot(
|
||||||
ItemStackBuilder(Items.lookup(plugin.configYml.getString("gui.close.item")))
|
ItemStackBuilder(Items.lookup(plugin.configYml.getString("gui.close.item")))
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.willfp.ecojobs.jobs
|
|||||||
|
|
||||||
import com.willfp.ecojobs.api.event.PlayerJobJoinEvent
|
import com.willfp.ecojobs.api.event.PlayerJobJoinEvent
|
||||||
import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent
|
import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.event.EventHandler
|
import org.bukkit.event.EventHandler
|
||||||
import org.bukkit.event.EventPriority
|
import org.bukkit.event.EventPriority
|
||||||
@@ -23,6 +24,7 @@ object PriceHandler : Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
price.pay(player)
|
price.pay(player)
|
||||||
|
job.joinEffects?.trigger(player.toDispatcher())
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(
|
@EventHandler(
|
||||||
@@ -40,5 +42,6 @@ object PriceHandler : Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
price.pay(player)
|
price.pay(player)
|
||||||
|
job.leaveEffects?.trigger(player.toDispatcher())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ package com.willfp.ecojobs.libreforge
|
|||||||
|
|
||||||
import com.willfp.eco.core.config.interfaces.Config
|
import com.willfp.eco.core.config.interfaces.Config
|
||||||
import com.willfp.ecojobs.api.activeJobs
|
import com.willfp.ecojobs.api.activeJobs
|
||||||
|
import com.willfp.libreforge.Dispatcher
|
||||||
import com.willfp.libreforge.NoCompileData
|
import com.willfp.libreforge.NoCompileData
|
||||||
|
import com.willfp.libreforge.ProvidedHolder
|
||||||
import com.willfp.libreforge.arguments
|
import com.willfp.libreforge.arguments
|
||||||
import com.willfp.libreforge.conditions.Condition
|
import com.willfp.libreforge.conditions.Condition
|
||||||
|
import com.willfp.libreforge.get
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
|
|
||||||
object ConditionHasActiveJob : Condition<NoCompileData>("has_active_job") {
|
object ConditionHasActiveJob : Condition<NoCompileData>("has_active_job") {
|
||||||
@@ -12,7 +15,14 @@ object ConditionHasActiveJob : Condition<NoCompileData>("has_active_job") {
|
|||||||
require("job", "You must specify the job!")
|
require("job", "You must specify the job!")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
|
override fun isMet(
|
||||||
|
dispatcher: Dispatcher<*>,
|
||||||
|
config: Config,
|
||||||
|
holder: ProvidedHolder,
|
||||||
|
compileData: NoCompileData
|
||||||
|
): Boolean {
|
||||||
|
val player = dispatcher.get<Player>() ?: return false
|
||||||
|
|
||||||
return player.activeJobs.any { it.id == config.getString("job").lowercase() }
|
return player.activeJobs.any { it.id == config.getString("job").lowercase() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,13 @@ import com.willfp.eco.core.config.interfaces.Config
|
|||||||
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
||||||
import com.willfp.ecojobs.api.getJobLevel
|
import com.willfp.ecojobs.api.getJobLevel
|
||||||
import com.willfp.ecojobs.jobs.Jobs
|
import com.willfp.ecojobs.jobs.Jobs
|
||||||
|
import com.willfp.libreforge.Dispatcher
|
||||||
import com.willfp.libreforge.NoCompileData
|
import com.willfp.libreforge.NoCompileData
|
||||||
|
import com.willfp.libreforge.ProvidedHolder
|
||||||
import com.willfp.libreforge.arguments
|
import com.willfp.libreforge.arguments
|
||||||
import com.willfp.libreforge.conditions.Condition
|
import com.willfp.libreforge.conditions.Condition
|
||||||
|
import com.willfp.libreforge.get
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import com.willfp.libreforge.updateEffects
|
import com.willfp.libreforge.updateEffects
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.event.EventHandler
|
import org.bukkit.event.EventHandler
|
||||||
@@ -18,7 +22,14 @@ object ConditionHasJobLevel : Condition<NoCompileData>("has_job_level") {
|
|||||||
require("level", "You must specify the level!")
|
require("level", "You must specify the level!")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isMet(player: Player, config: Config, compileData: NoCompileData): Boolean {
|
override fun isMet(
|
||||||
|
dispatcher: Dispatcher<*>,
|
||||||
|
config: Config,
|
||||||
|
holder: ProvidedHolder,
|
||||||
|
compileData: NoCompileData
|
||||||
|
): Boolean {
|
||||||
|
val player = dispatcher.get<Player>() ?: return false
|
||||||
|
|
||||||
return player.getJobLevel(
|
return player.getJobLevel(
|
||||||
Jobs.getByID(config.getString("job").lowercase()) ?: return false
|
Jobs.getByID(config.getString("job").lowercase()) ?: return false
|
||||||
) >= config.getIntFromExpression("level", player)
|
) >= config.getIntFromExpression("level", player)
|
||||||
@@ -26,6 +37,6 @@ object ConditionHasJobLevel : Condition<NoCompileData>("has_job_level") {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
fun handle(event: PlayerJobLevelUpEvent) {
|
fun handle(event: PlayerJobLevelUpEvent) {
|
||||||
event.player.updateEffects()
|
event.player.toDispatcher().updateEffects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.willfp.ecojobs.api.event.PlayerJobExpGainEvent
|
|||||||
import com.willfp.ecojobs.jobs.Job
|
import com.willfp.ecojobs.jobs.Job
|
||||||
import com.willfp.ecojobs.jobs.Jobs
|
import com.willfp.ecojobs.jobs.Jobs
|
||||||
import com.willfp.libreforge.effects.templates.MultiMultiplierEffect
|
import com.willfp.libreforge.effects.templates.MultiMultiplierEffect
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import org.bukkit.event.EventHandler
|
import org.bukkit.event.EventHandler
|
||||||
|
|
||||||
object EffectJobXpMultiplier : MultiMultiplierEffect<Job>("job_xp_multiplier") {
|
object EffectJobXpMultiplier : MultiMultiplierEffect<Job>("job_xp_multiplier") {
|
||||||
@@ -19,6 +20,6 @@ object EffectJobXpMultiplier : MultiMultiplierEffect<Job>("job_xp_multiplier") {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
fun handle(event: PlayerJobExpGainEvent) {
|
fun handle(event: PlayerJobExpGainEvent) {
|
||||||
event.amount *= getMultiplier(event.player, event.job)
|
event.amount *= getMultiplier(event.player.toDispatcher(), event.job)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecojobs.libreforge
|
package com.willfp.ecojobs.libreforge
|
||||||
|
|
||||||
import com.willfp.ecojobs.api.event.PlayerJobExpGainEvent
|
import com.willfp.ecojobs.api.event.PlayerJobExpGainEvent
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import com.willfp.libreforge.triggers.Trigger
|
import com.willfp.libreforge.triggers.Trigger
|
||||||
import com.willfp.libreforge.triggers.TriggerData
|
import com.willfp.libreforge.triggers.TriggerData
|
||||||
import com.willfp.libreforge.triggers.TriggerParameter
|
import com.willfp.libreforge.triggers.TriggerParameter
|
||||||
@@ -18,7 +19,7 @@ object TriggerGainJobXp : Trigger("gain_job_xp") {
|
|||||||
val player = event.player
|
val player = event.player
|
||||||
|
|
||||||
this.dispatch(
|
this.dispatch(
|
||||||
player,
|
player.toDispatcher(),
|
||||||
TriggerData(
|
TriggerData(
|
||||||
player = player,
|
player = player,
|
||||||
location = player.location,
|
location = player.location,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.willfp.ecojobs.libreforge
|
|||||||
|
|
||||||
import com.willfp.ecojobs.api.event.PlayerJobJoinEvent
|
import com.willfp.ecojobs.api.event.PlayerJobJoinEvent
|
||||||
import com.willfp.ecojobs.api.getJobLevel
|
import com.willfp.ecojobs.api.getJobLevel
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import com.willfp.libreforge.triggers.Trigger
|
import com.willfp.libreforge.triggers.Trigger
|
||||||
import com.willfp.libreforge.triggers.TriggerData
|
import com.willfp.libreforge.triggers.TriggerData
|
||||||
import com.willfp.libreforge.triggers.TriggerParameter
|
import com.willfp.libreforge.triggers.TriggerParameter
|
||||||
@@ -20,7 +21,7 @@ object TriggerJoinJob : Trigger("join_job") {
|
|||||||
val player = event.player as? Player ?: return
|
val player = event.player as? Player ?: return
|
||||||
|
|
||||||
this.dispatch(
|
this.dispatch(
|
||||||
player,
|
player.toDispatcher(),
|
||||||
TriggerData(
|
TriggerData(
|
||||||
player = player,
|
player = player,
|
||||||
location = player.location,
|
location = player.location,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.willfp.ecojobs.libreforge
|
|||||||
|
|
||||||
import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent
|
import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent
|
||||||
import com.willfp.ecojobs.api.getJobLevel
|
import com.willfp.ecojobs.api.getJobLevel
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import com.willfp.libreforge.triggers.Trigger
|
import com.willfp.libreforge.triggers.Trigger
|
||||||
import com.willfp.libreforge.triggers.TriggerData
|
import com.willfp.libreforge.triggers.TriggerData
|
||||||
import com.willfp.libreforge.triggers.TriggerParameter
|
import com.willfp.libreforge.triggers.TriggerParameter
|
||||||
@@ -19,7 +20,7 @@ object TriggerLeaveJob : Trigger("leave_job") {
|
|||||||
val player = event.player as? Player ?: return
|
val player = event.player as? Player ?: return
|
||||||
|
|
||||||
this.dispatch(
|
this.dispatch(
|
||||||
player,
|
player.toDispatcher(),
|
||||||
TriggerData(
|
TriggerData(
|
||||||
player = player,
|
player = player,
|
||||||
location = player.location,
|
location = player.location,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecojobs.libreforge
|
package com.willfp.ecojobs.libreforge
|
||||||
|
|
||||||
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
||||||
|
import com.willfp.libreforge.toDispatcher
|
||||||
import com.willfp.libreforge.triggers.Trigger
|
import com.willfp.libreforge.triggers.Trigger
|
||||||
import com.willfp.libreforge.triggers.TriggerData
|
import com.willfp.libreforge.triggers.TriggerData
|
||||||
import com.willfp.libreforge.triggers.TriggerParameter
|
import com.willfp.libreforge.triggers.TriggerParameter
|
||||||
@@ -18,7 +19,7 @@ object TriggerLevelUpJob : Trigger("level_up_job") {
|
|||||||
val player = event.player
|
val player = event.player
|
||||||
|
|
||||||
this.dispatch(
|
this.dispatch(
|
||||||
player,
|
player.toDispatcher(),
|
||||||
TriggerData(
|
TriggerData(
|
||||||
player = player,
|
player = player,
|
||||||
location = player.location,
|
location = player.location,
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.willfp.ecojobs.util
|
||||||
|
|
||||||
|
import org.bukkit.OfflinePlayer
|
||||||
|
|
||||||
|
data class LeaderboardCacheEntry(
|
||||||
|
val player: OfflinePlayer,
|
||||||
|
val level: Int
|
||||||
|
)
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.willfp.ecojobs.util
|
||||||
|
|
||||||
|
import com.willfp.eco.core.placeholder.InjectablePlaceholder
|
||||||
|
import com.willfp.eco.core.placeholder.PlaceholderInjectable
|
||||||
|
import com.willfp.eco.core.placeholder.StaticPlaceholder
|
||||||
|
|
||||||
|
class LevelInjectable(
|
||||||
|
level: Int
|
||||||
|
) : PlaceholderInjectable {
|
||||||
|
private val placeholders = listOf(
|
||||||
|
StaticPlaceholder(
|
||||||
|
"level"
|
||||||
|
) { level.toString() }
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun getPlaceholderInjections(): List<InjectablePlaceholder> {
|
||||||
|
return placeholders
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun addInjectablePlaceholder(p0: Iterable<InjectablePlaceholder>) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun clearInjectedPlaceholders() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,11 @@
|
|||||||
# by Auxilor
|
# by Auxilor
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Even if eco is set up to use a database, you can
|
||||||
|
# force EcoJobs to save to local storage to disable
|
||||||
|
# cross-server sync.
|
||||||
|
use-local-storage: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
limit: 3 # The most jobs a player can have at once.
|
limit: 3 # The most jobs a player can have at once.
|
||||||
# You can set custom limits with the ecojobs.limit.<number> permission
|
# You can set custom limits with the ecojobs.limit.<number> permission
|
||||||
@@ -119,6 +124,7 @@ gui:
|
|||||||
|
|
||||||
level-gui:
|
level-gui:
|
||||||
rows: 6
|
rows: 6
|
||||||
|
title: "%job%"
|
||||||
|
|
||||||
mask:
|
mask:
|
||||||
# The way the mask works is by having a list of materials
|
# The way the mask works is by having a list of materials
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ join-price:
|
|||||||
# Reference with %join_lore%
|
# Reference with %join_lore%
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
|
# A list of effects to run when the player joins the job.
|
||||||
|
# Read https://plugins.auxilor.io/effects/configuring-an-effect
|
||||||
|
join-effects:
|
||||||
|
- id: broadcast
|
||||||
|
args:
|
||||||
|
message: "&8» &a%player% &8joined the &6Miner &8job!"
|
||||||
|
|
||||||
# The price to leave this job (set to 0 to disable)
|
# The price to leave this job (set to 0 to disable)
|
||||||
# Read here for more: https://plugins.auxilor.io/all-plugins/prices
|
# Read here for more: https://plugins.auxilor.io/all-plugins/prices
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -39,7 +46,22 @@ leave-price:
|
|||||||
leave-lore:
|
leave-lore:
|
||||||
- " &8» This will cost %leave_price%"
|
- " &8» This will cost %leave_price%"
|
||||||
|
|
||||||
# The xp requirements for each job level - add new levels by adding more to this list
|
# A list of effects to run when the player leaves the job.
|
||||||
|
# Read https://plugins.auxilor.io/effects/configuring-an-effect
|
||||||
|
leave-effects:
|
||||||
|
- id: send_message
|
||||||
|
args:
|
||||||
|
message: "&8» &8You left the &6Miner &8job!"
|
||||||
|
|
||||||
|
# There are two ways to specify level XP requirements:
|
||||||
|
# 1. A formula to calculate for infinite levels
|
||||||
|
# 2. A list of XP requirements for each level
|
||||||
|
|
||||||
|
# Formula
|
||||||
|
# xp-formula: (2 ^ %level%) * 25
|
||||||
|
# max-level: 100 # The max level of the job
|
||||||
|
|
||||||
|
# List
|
||||||
level-xp-requirements:
|
level-xp-requirements:
|
||||||
- 100
|
- 100
|
||||||
- 120
|
- 120
|
||||||
@@ -133,10 +155,13 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks mined"
|
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks mined"
|
||||||
|
|
||||||
# Commands to be sent on levelup, can be formatted two ways:
|
# Effects to run when the skill levels up
|
||||||
# level:command (e.g. 10:eco give %player% 1000), which would execute that command for level 10
|
# %level% is the level the skill leveled up to.
|
||||||
# command (e.g. eco give %player% 5000), which would execute that command for all levels
|
# If you want to restrict this to certain levels, you can use
|
||||||
level-commands: [ ]
|
# require: %level% = 20, or require: %level% < 50, etc.
|
||||||
|
# If you want a reward to run every x levels, you can use
|
||||||
|
# every: 1, or every: 12, etc
|
||||||
|
level-up-effects: [ ]
|
||||||
|
|
||||||
# The effects for the job, has %level% as a placeholder
|
# The effects for the job, has %level% as a placeholder
|
||||||
effects:
|
effects:
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -95,7 +99,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each bee you breed"
|
- "&8» &8Earn &a$%money%&8 for each bee you breed"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -94,7 +98,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks placed"
|
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks placed"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -92,7 +96,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each enchanted item"
|
- "&8» &8Earn &a$%money%&8 for each enchanted item"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -107,7 +111,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each crop farmed"
|
- "&8» &8Earn &a$%money%&8 for each crop farmed"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -92,7 +96,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each fish caught"
|
- "&8» &8Earn &a$%money%&8 for each fish caught"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -104,7 +108,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &7Earn &a$%money%&7 for each log chopped."
|
- "&8» &7Earn &a$%money%&7 for each log chopped."
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -74,15 +78,17 @@ level-xp-requirements:
|
|||||||
xp-gain-methods:
|
xp-gain-methods:
|
||||||
- trigger: mine_block
|
- trigger: mine_block
|
||||||
multiplier: 0.5
|
multiplier: 0.5
|
||||||
conditions: [ ]
|
filters: [ ]
|
||||||
filters:
|
conditions:
|
||||||
items:
|
- id: in_mainhand
|
||||||
- "*wooden_pickaxe"
|
args:
|
||||||
- "*stone_pickaxe"
|
items:
|
||||||
- "*iron_pickaxe"
|
- "*wooden_pickaxe"
|
||||||
- "*golden_pickaxe"
|
- "*stone_pickaxe"
|
||||||
- "*diamond_pickaxe"
|
- "*iron_pickaxe"
|
||||||
- "*netherite_pickaxe"
|
- "*golden_pickaxe"
|
||||||
|
- "*diamond_pickaxe"
|
||||||
|
- "*netherite_pickaxe"
|
||||||
|
|
||||||
level-placeholders:
|
level-placeholders:
|
||||||
- id: "money"
|
- id: "money"
|
||||||
@@ -102,21 +108,23 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks mined"
|
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks mined"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
args:
|
args:
|
||||||
every: "ceil(10 - %level% / 10)"
|
every: "ceil(10 - %level% / 10)"
|
||||||
amount: "0.4 * %level%"
|
amount: "0.4 * %level%"
|
||||||
filters:
|
conditions:
|
||||||
items:
|
- id: in_mainhand
|
||||||
- "*wooden_pickaxe"
|
args:
|
||||||
- "*stone_pickaxe"
|
items:
|
||||||
- "*iron_pickaxe"
|
- "*wooden_pickaxe"
|
||||||
- "*golden_pickaxe"
|
- "*stone_pickaxe"
|
||||||
- "*diamond_pickaxe"
|
- "*iron_pickaxe"
|
||||||
- "*netherite_pickaxe"
|
- "*golden_pickaxe"
|
||||||
|
- "*diamond_pickaxe"
|
||||||
|
- "*netherite_pickaxe"
|
||||||
triggers:
|
triggers:
|
||||||
- mine_block
|
- mine_block
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -95,7 +99,7 @@ level-up-messages:
|
|||||||
- "&8» &8Earn &a$%money%&8 per heart of health that"
|
- "&8» &8Earn &a$%money%&8 per heart of health that"
|
||||||
- " &8mobs you kill have"
|
- " &8mobs you kill have"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -17,6 +19,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -92,7 +96,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each smelted item"
|
- "&8» &8Earn &a$%money%&8 for each smelted item"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ join-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
join-effects: []
|
||||||
|
|
||||||
join-lore: []
|
join-lore: []
|
||||||
|
|
||||||
leave-price:
|
leave-price:
|
||||||
@@ -25,6 +27,8 @@ leave-price:
|
|||||||
type: coins
|
type: coins
|
||||||
display: "&a$%value%"
|
display: "&a$%value%"
|
||||||
|
|
||||||
|
leave-effects: []
|
||||||
|
|
||||||
leave-lore:
|
leave-lore:
|
||||||
- ""
|
- ""
|
||||||
|
|
||||||
@@ -133,7 +137,7 @@ level-up-messages:
|
|||||||
1:
|
1:
|
||||||
- "&8» &8Earn &a$%money%&8 for each tool crafted"
|
- "&8» &8Earn &a$%money%&8 for each tool crafted"
|
||||||
|
|
||||||
level-commands: [ ]
|
level-up-effects: [ ]
|
||||||
|
|
||||||
effects:
|
effects:
|
||||||
- id: give_money
|
- id: give_money
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ messages:
|
|||||||
needs-player: "&cYou must specify a player!"
|
needs-player: "&cYou must specify a player!"
|
||||||
gave-xp: "&fYou have given &a%xp% &fXP to %player%&f's %job%&f!"
|
gave-xp: "&fYou have given &a%xp% &fXP to %player%&f's %job%&f!"
|
||||||
reset-xp: "&fYou have reset %player%&f's %job%&f XP!"
|
reset-xp: "&fYou have reset %player%&f's %job%&f XP!"
|
||||||
|
reset-all-players: "&fYou have reset all players' %job%&f XP!"
|
||||||
|
reset-all-jobs: "&fYou have reset %player%&f's XP for all jobs!"
|
||||||
|
reset-all-players-all-jobs: "&fYou have reset all players' XP for all jobs!"
|
||||||
needs-job: "&cYou must specify a job!"
|
needs-job: "&cYou must specify a job!"
|
||||||
need-amount: "&cYou must specify a amount!"
|
need-amount: "&cYou must specify a amount!"
|
||||||
invalid-player: "&cInvalid player!"
|
invalid-player: "&cInvalid player!"
|
||||||
@@ -31,6 +34,9 @@ menu:
|
|||||||
|
|
||||||
infinity: "∞"
|
infinity: "∞"
|
||||||
|
|
||||||
|
top-line-format: "%rank%. %player% - %level%"
|
||||||
top:
|
top:
|
||||||
name-empty: "&cEmpty"
|
empty-position: "&cN/A"
|
||||||
amount-empty: "0"
|
format:
|
||||||
|
- "---- Jobs Leaderboard ----"
|
||||||
|
- "%lines%"
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
name: ${pluginName}
|
|
||||||
version: ${version}
|
|
||||||
main: com.willfp.ecojobs.EcoJobsPlugin
|
|
||||||
api-version: 1.19
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- name: eco
|
|
||||||
required: true
|
|
||||||
bootstrap: false
|
|
||||||
|
|
||||||
- name: libreforge
|
|
||||||
required: false
|
|
||||||
bootstrap: false
|
|
||||||
|
|
||||||
load-after:
|
|
||||||
- name: eco
|
|
||||||
bootstrap: false
|
|
||||||
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
ecojobs.*:
|
|
||||||
description: All EcoJobs permissions
|
|
||||||
default: op
|
|
||||||
children:
|
|
||||||
ecojobs.command.*: true
|
|
||||||
ecojobs.command.*:
|
|
||||||
description: All commands
|
|
||||||
default: op
|
|
||||||
children:
|
|
||||||
ecojobs.command.ecojobs: true
|
|
||||||
ecojobs.command.reload: true
|
|
||||||
ecojobs.command.jobs: true
|
|
||||||
ecojobs.command.unlock: true
|
|
||||||
ecojobs.command.givexp: true
|
|
||||||
ecojobs.command.join: true
|
|
||||||
ecojobs.command.leave: true
|
|
||||||
ecojobs.command.reset: true
|
|
||||||
|
|
||||||
ecojobs.command.reload:
|
|
||||||
description: Allows reloading the config
|
|
||||||
default: op
|
|
||||||
ecojobs.command.ecojobs:
|
|
||||||
description: Allows the use of /ecojobs.
|
|
||||||
default: true
|
|
||||||
ecojobs.command.jobs:
|
|
||||||
description: Allows the use of /jobs.
|
|
||||||
default: true
|
|
||||||
ecojobs.command.unlock:
|
|
||||||
description: Allows the use of /ecojobs unlock.
|
|
||||||
default: op
|
|
||||||
ecojobs.command.givexp:
|
|
||||||
description: Allows the use of /ecojobs givexp.
|
|
||||||
default: op
|
|
||||||
ecojobs.command.reset:
|
|
||||||
description: Allows the use of /ecojobs reset.
|
|
||||||
default: op
|
|
||||||
ecojobs.command.join:
|
|
||||||
description: Allows the use of /jobs join.
|
|
||||||
default: true
|
|
||||||
ecojobs.command.leave:
|
|
||||||
description: Allows the use of /jobs leave.
|
|
||||||
default: true
|
|
||||||
|
|
||||||
ecojobs.xpmultiplier.50percent:
|
|
||||||
description: Gives the player 50% more job experience
|
|
||||||
default: false
|
|
||||||
ecojobs.xpmultiplier.double:
|
|
||||||
description: Gives the player 2x job experience
|
|
||||||
default: false
|
|
||||||
ecojobs.xpmultiplier.triple:
|
|
||||||
description: Gives the player 3x job experience
|
|
||||||
default: false
|
|
||||||
ecojobs.xpmultiplier.quadruple:
|
|
||||||
description: Gives the player 4x job experience
|
|
||||||
default: false
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#libreforge-updater
|
#libreforge-updater
|
||||||
#Sat Jun 03 15:44:50 BST 2023
|
#Mon Oct 06 08:56:29 BST 2025
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
libreforge-version=4.17.2
|
libreforge-version=4.79.0
|
||||||
version=3.16.2
|
version=3.77.2
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
jdk: openjdk17
|
|
||||||
before_install:
|
|
||||||
- source "$HOME/.sdkman/bin/sdkman-init.sh"
|
|
||||||
- sdk update
|
|
||||||
- sdk install java 17.0.1-tem
|
|
||||||
- sdk use java 17.0.1-tem
|
|
||||||
@@ -2,11 +2,15 @@ pluginManagement {
|
|||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven("https://repo.jpenilla.xyz/snapshots/")
|
|
||||||
maven("https://repo.auxilor.io/repository/maven-public/")
|
maven("https://repo.auxilor.io/repository/maven-public/")
|
||||||
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||||
|
}
|
||||||
|
|
||||||
rootProject.name = "EcoJobs"
|
rootProject.name = "EcoJobs"
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
|
|||||||
Reference in New Issue
Block a user