mirror of
https://github.com/Auxilor/EcoJobs.git
synced 2025-12-19 23:19:16 +00:00
Compare commits
139 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
ee3298d260 | ||
|
|
65dcbf2d98 |
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
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up JDK 17
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
java-version: 21
|
||||
|
||||
- name: Change wrapper permissions
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
java
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
kotlin("jvm") version "1.7.10"
|
||||
id("com.github.johnrengelman.shadow") version "8.0.0"
|
||||
kotlin("jvm") version "2.1.0"
|
||||
id("com.gradleup.shadow") version "8.3.0"
|
||||
id("com.willfp.libreforge-gradle-plugin") version "1.0.0"
|
||||
}
|
||||
|
||||
@@ -25,7 +27,7 @@ allprojects {
|
||||
apply(plugin = "java")
|
||||
apply(plugin = "kotlin")
|
||||
apply(plugin = "maven-publish")
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
apply(plugin = "com.gradleup.shadow")
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
@@ -37,9 +39,9 @@ allprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.willfp:eco:6.55.0")
|
||||
compileOnly("com.willfp:eco:6.56.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 {
|
||||
@@ -54,8 +56,8 @@ allprojects {
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,12 @@ dependencies {
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
register("maven", MavenPublication::class) {
|
||||
from(components["java"])
|
||||
register<MavenPublication>("maven") {
|
||||
groupId = project.group.toString()
|
||||
version = project.version.toString()
|
||||
artifactId = rootProject.name
|
||||
|
||||
artifact(rootProject.tasks.shadowJar.get().archiveFile)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,9 @@ import com.willfp.libreforge.filters.Filters
|
||||
import com.willfp.libreforge.loader.LibreforgePlugin
|
||||
import com.willfp.libreforge.loader.configs.ConfigCategory
|
||||
import com.willfp.libreforge.registerHolderProvider
|
||||
import com.willfp.libreforge.registerSpecificHolderProvider
|
||||
import com.willfp.libreforge.triggers.Triggers
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.Listener
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@@ -56,7 +58,7 @@ class EcoJobsPlugin : LibreforgePlugin() {
|
||||
Triggers.register(TriggerLeaveJob)
|
||||
Filters.register(FilterJob)
|
||||
|
||||
registerHolderProvider { player ->
|
||||
registerSpecificHolderProvider<Player> { player ->
|
||||
player.activeJobs.map { it.getLevel(player.getJobLevel(it)) }.map {
|
||||
SimpleProvidedHolder(it)
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ fun OfflinePlayer.resetJob(job: Job) {
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.willfp.ecojobs.api.resetJob
|
||||
import com.willfp.ecojobs.jobs.Jobs
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.util.StringUtil
|
||||
|
||||
class CommandReset(plugin: EcoPlugin) : Subcommand(plugin, "reset", "ecojobs.command.reset", false) {
|
||||
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 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)
|
||||
|
||||
if (player == null) {
|
||||
sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
|
||||
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) {
|
||||
sender.sendMessage(plugin.langYml.getMessage("invalid-job"))
|
||||
return
|
||||
@@ -55,12 +108,23 @@ class CommandReset(plugin: EcoPlugin) : Subcommand(plugin, "reset", "ecojobs.com
|
||||
}
|
||||
|
||||
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||
val completions = mutableListOf<String>()
|
||||
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) {
|
||||
return Jobs.values().map { it.id }
|
||||
StringUtil.copyPartialMatches(
|
||||
args[1],
|
||||
listOf("all") union Jobs.values().map { it.id },
|
||||
completions
|
||||
)
|
||||
return completions
|
||||
}
|
||||
|
||||
return emptyList()
|
||||
|
||||
@@ -9,10 +9,12 @@ import com.willfp.eco.core.items.builder.ItemStackBuilder
|
||||
import com.willfp.eco.core.placeholder.PlayerPlaceholder
|
||||
import com.willfp.eco.core.placeholder.PlayerStaticPlaceholder
|
||||
import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
|
||||
import com.willfp.eco.core.placeholder.context.placeholderContext
|
||||
import com.willfp.eco.core.price.ConfiguredPrice
|
||||
import com.willfp.eco.core.price.impl.PriceEconomy
|
||||
import com.willfp.eco.core.registry.Registrable
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.eco.util.NumberUtils.evaluateExpression
|
||||
import com.willfp.eco.util.formatEco
|
||||
import com.willfp.eco.util.toNiceString
|
||||
import com.willfp.ecojobs.EcoJobsPlugin
|
||||
@@ -24,20 +26,21 @@ import com.willfp.ecojobs.api.getJobXP
|
||||
import com.willfp.ecojobs.api.getJobXPRequired
|
||||
import com.willfp.ecojobs.api.hasJobActive
|
||||
import com.willfp.ecojobs.api.jobLimit
|
||||
import com.willfp.ecojobs.util.LevelInjectable
|
||||
import com.willfp.libreforge.ViolationContext
|
||||
import com.willfp.libreforge.conditions.ConditionList
|
||||
import com.willfp.libreforge.conditions.Conditions
|
||||
import com.willfp.libreforge.counters.Counters
|
||||
import com.willfp.libreforge.effects.EffectList
|
||||
import com.willfp.libreforge.effects.Effects
|
||||
import com.willfp.libreforge.effects.executors.impl.NormalExecutorFactory
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.configuration.InvalidConfigurationException
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import java.time.Duration
|
||||
import java.util.Objects
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.max
|
||||
|
||||
class Job(
|
||||
val id: String,
|
||||
@@ -49,8 +52,11 @@ class Job(
|
||||
.build<Int, LeaderboardCacheEntry?>()
|
||||
|
||||
val name = config.getFormattedString("name")
|
||||
|
||||
val description = config.getFormattedString("description")
|
||||
|
||||
val isUnlockedByDefault = config.getBool("unlocked-by-default")
|
||||
|
||||
val resetsOnQuit = config.getBool("reset-on-quit")
|
||||
|
||||
val joinPrice = ConfiguredPrice.create(config.getSubsection("join-price")) ?: ConfiguredPrice(
|
||||
@@ -71,9 +77,11 @@ class Job(
|
||||
EcoJobsPlugin.instance.namespacedKeyFactory.create("${id}_xp"), PersistentDataKeyType.DOUBLE, 0.0
|
||||
)
|
||||
|
||||
private val levelXpRequirements = listOf(0) + config.getInts("level-xp-requirements")
|
||||
private val xpFormula = config.getStringOrNull("xp-formula")
|
||||
|
||||
val maxLevel = levelXpRequirements.size
|
||||
private val levelXpRequirements = config.getDoublesOrNull("level-xp-requirements")
|
||||
|
||||
val maxLevel = config.getIntOrNull("max-level") ?: levelXpRequirements?.size ?: Int.MAX_VALUE
|
||||
|
||||
val levelGUI = JobLevelGUI(plugin, this)
|
||||
|
||||
@@ -106,6 +114,10 @@ class Job(
|
||||
}
|
||||
|
||||
init {
|
||||
if (xpFormula == null && levelXpRequirements == null) {
|
||||
throw InvalidConfigurationException("Skill $id has no requirements or xp formula")
|
||||
}
|
||||
|
||||
config.injectPlaceholders(PlayerStaticPlaceholder(
|
||||
"level"
|
||||
) { p ->
|
||||
@@ -122,24 +134,7 @@ class Job(
|
||||
ViolationContext(plugin, "Job $id")
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
manageLevelCommands(config)
|
||||
|
||||
PlayerPlaceholder(
|
||||
plugin, "${id}_percentage_progress"
|
||||
@@ -190,6 +185,49 @@ class Job(
|
||||
}.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() {
|
||||
jobXpGains.forEach { it.bind(JobXPAccumulator(this)) }
|
||||
}
|
||||
@@ -275,13 +313,8 @@ class Job(
|
||||
val withPlaceholders = lore.map {
|
||||
it.replace("%percentage_progress%", (player.getJobProgress(this) * 100).toNiceString())
|
||||
.replace("%current_xp%", player.getJobXP(this).toNiceString())
|
||||
.replace("%required_xp%", this.getExpForLevel(player.getJobLevel(this) + 1).let { req ->
|
||||
if (req == Int.MAX_VALUE) {
|
||||
plugin.langYml.getFormattedString("infinity")
|
||||
} else {
|
||||
req.toNiceString()
|
||||
}
|
||||
}).replace("%description%", this.description).replace("%job%", this.name)
|
||||
.replace("%required_xp%", this.getFormattedExpForLevel(player.getJobLevel(this) + 1))
|
||||
.replace("%description%", this.description).replace("%job%", this.name)
|
||||
.replace("%level%", (forceLevel ?: player.getJobLevel(this)).toString())
|
||||
.replace("%level_numeral%", NumberUtils.toNumeral(forceLevel ?: player.getJobLevel(this)))
|
||||
.replace("%join_price%", this.joinPrice.getDisplay(player))
|
||||
@@ -347,14 +380,36 @@ class Job(
|
||||
}.build()
|
||||
}
|
||||
|
||||
fun getExpForLevel(level: Int): Int {
|
||||
if (level < 1 || level > maxLevel) {
|
||||
return Int.MAX_VALUE
|
||||
/**
|
||||
* Get the XP required to reach the next level, if currently at [level].
|
||||
*/
|
||||
fun getExpForLevel(level: Int): Double {
|
||||
if (xpFormula != null) {
|
||||
return evaluateExpression(
|
||||
xpFormula,
|
||||
placeholderContext(
|
||||
injectable = LevelInjectable(level)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return levelXpRequirements[level - 1]
|
||||
if (levelXpRequirements != null) {
|
||||
return levelXpRequirements.getOrNull(level) ?: Double.POSITIVE_INFINITY
|
||||
}
|
||||
|
||||
return Double.POSITIVE_INFINITY
|
||||
}
|
||||
|
||||
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) {
|
||||
val commands = levelCommands[level] ?: emptyList()
|
||||
|
||||
@@ -409,43 +464,3 @@ private fun Collection<LevelPlaceholder>.format(string: String, level: Int): Str
|
||||
|
||||
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.builder.ItemStackBuilder
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.eco.util.formatEco
|
||||
import com.willfp.ecojobs.api.getJobLevel
|
||||
import com.willfp.ecomponent.components.LevelComponent
|
||||
import com.willfp.ecomponent.components.LevelState
|
||||
@@ -65,7 +66,9 @@ class JobLevelGUI(
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.willfp.ecojobs.jobs
|
||||
|
||||
import com.willfp.ecojobs.EcoJobsPlugin
|
||||
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import org.bukkit.Sound
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
@@ -16,6 +17,7 @@ class JobLevelListener(
|
||||
val player = event.player
|
||||
val level = event.level
|
||||
|
||||
job.levelUpEffects?.trigger(player.toDispatcher())
|
||||
job.executeLevelCommands(player, level)
|
||||
|
||||
if (this.plugin.configYml.getBool("level-up.sound.enabled")) {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.willfp.ecojobs.jobs
|
||||
|
||||
import com.github.benmanes.caffeine.cache.Caffeine
|
||||
import com.willfp.ecojobs.api.giveJobExperience
|
||||
import com.willfp.ecojobs.api.hasJobActive
|
||||
import com.willfp.libreforge.counters.Accumulator
|
||||
import org.bukkit.entity.Player
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.math.max
|
||||
|
||||
class JobXPAccumulator(
|
||||
private val job: Job
|
||||
@@ -16,3 +19,44 @@ class JobXPAccumulator(
|
||||
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,6 +2,7 @@ package com.willfp.ecojobs.jobs
|
||||
|
||||
import com.willfp.ecojobs.api.event.PlayerJobJoinEvent
|
||||
import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
@@ -23,6 +24,7 @@ object PriceHandler : Listener {
|
||||
}
|
||||
|
||||
price.pay(player)
|
||||
job.joinEffects?.trigger(player.toDispatcher())
|
||||
}
|
||||
|
||||
@EventHandler(
|
||||
@@ -40,5 +42,6 @@ object PriceHandler : Listener {
|
||||
}
|
||||
|
||||
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.ecojobs.api.activeJobs
|
||||
import com.willfp.libreforge.Dispatcher
|
||||
import com.willfp.libreforge.NoCompileData
|
||||
import com.willfp.libreforge.ProvidedHolder
|
||||
import com.willfp.libreforge.arguments
|
||||
import com.willfp.libreforge.conditions.Condition
|
||||
import com.willfp.libreforge.get
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
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!")
|
||||
}
|
||||
|
||||
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() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,13 @@ import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
||||
import com.willfp.ecojobs.api.getJobLevel
|
||||
import com.willfp.ecojobs.jobs.Jobs
|
||||
import com.willfp.libreforge.Dispatcher
|
||||
import com.willfp.libreforge.NoCompileData
|
||||
import com.willfp.libreforge.ProvidedHolder
|
||||
import com.willfp.libreforge.arguments
|
||||
import com.willfp.libreforge.conditions.Condition
|
||||
import com.willfp.libreforge.get
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.updateEffects
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
@@ -18,7 +22,14 @@ object ConditionHasJobLevel : Condition<NoCompileData>("has_job_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(
|
||||
Jobs.getByID(config.getString("job").lowercase()) ?: return false
|
||||
) >= config.getIntFromExpression("level", player)
|
||||
@@ -26,6 +37,6 @@ object ConditionHasJobLevel : Condition<NoCompileData>("has_job_level") {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
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.Jobs
|
||||
import com.willfp.libreforge.effects.templates.MultiMultiplierEffect
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import org.bukkit.event.EventHandler
|
||||
|
||||
object EffectJobXpMultiplier : MultiMultiplierEffect<Job>("job_xp_multiplier") {
|
||||
@@ -19,6 +20,6 @@ object EffectJobXpMultiplier : MultiMultiplierEffect<Job>("job_xp_multiplier") {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
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
|
||||
|
||||
import com.willfp.ecojobs.api.event.PlayerJobExpGainEvent
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import com.willfp.libreforge.triggers.TriggerData
|
||||
import com.willfp.libreforge.triggers.TriggerParameter
|
||||
@@ -18,7 +19,7 @@ object TriggerGainJobXp : Trigger("gain_job_xp") {
|
||||
val player = event.player
|
||||
|
||||
this.dispatch(
|
||||
player,
|
||||
player.toDispatcher(),
|
||||
TriggerData(
|
||||
player = player,
|
||||
location = player.location,
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.willfp.ecojobs.libreforge
|
||||
|
||||
import com.willfp.ecojobs.api.event.PlayerJobJoinEvent
|
||||
import com.willfp.ecojobs.api.getJobLevel
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import com.willfp.libreforge.triggers.TriggerData
|
||||
import com.willfp.libreforge.triggers.TriggerParameter
|
||||
@@ -20,7 +21,7 @@ object TriggerJoinJob : Trigger("join_job") {
|
||||
val player = event.player as? Player ?: return
|
||||
|
||||
this.dispatch(
|
||||
player,
|
||||
player.toDispatcher(),
|
||||
TriggerData(
|
||||
player = player,
|
||||
location = player.location,
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.willfp.ecojobs.libreforge
|
||||
|
||||
import com.willfp.ecojobs.api.event.PlayerJobLeaveEvent
|
||||
import com.willfp.ecojobs.api.getJobLevel
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import com.willfp.libreforge.triggers.TriggerData
|
||||
import com.willfp.libreforge.triggers.TriggerParameter
|
||||
@@ -19,7 +20,7 @@ object TriggerLeaveJob : Trigger("leave_job") {
|
||||
val player = event.player as? Player ?: return
|
||||
|
||||
this.dispatch(
|
||||
player,
|
||||
player.toDispatcher(),
|
||||
TriggerData(
|
||||
player = player,
|
||||
location = player.location,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.willfp.ecojobs.libreforge
|
||||
|
||||
import com.willfp.ecojobs.api.event.PlayerJobLevelUpEvent
|
||||
import com.willfp.libreforge.toDispatcher
|
||||
import com.willfp.libreforge.triggers.Trigger
|
||||
import com.willfp.libreforge.triggers.TriggerData
|
||||
import com.willfp.libreforge.triggers.TriggerParameter
|
||||
@@ -18,7 +19,7 @@ object TriggerLevelUpJob : Trigger("level_up_job") {
|
||||
val player = event.player
|
||||
|
||||
this.dispatch(
|
||||
player,
|
||||
player.toDispatcher(),
|
||||
TriggerData(
|
||||
player = player,
|
||||
location = player.location,
|
||||
|
||||
@@ -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
|
||||
#
|
||||
|
||||
# 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:
|
||||
limit: 3 # The most jobs a player can have at once.
|
||||
# You can set custom limits with the ecojobs.limit.<number> permission
|
||||
@@ -119,6 +124,7 @@ gui:
|
||||
|
||||
level-gui:
|
||||
rows: 6
|
||||
title: "%job%"
|
||||
|
||||
mask:
|
||||
# The way the mask works is by having a list of materials
|
||||
|
||||
@@ -27,6 +27,13 @@ join-price:
|
||||
# Reference with %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)
|
||||
# Read here for more: https://plugins.auxilor.io/all-plugins/prices
|
||||
leave-price:
|
||||
@@ -39,7 +46,22 @@ leave-price:
|
||||
leave-lore:
|
||||
- " &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:
|
||||
- 100
|
||||
- 120
|
||||
@@ -133,10 +155,13 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks mined"
|
||||
|
||||
# Commands to be sent on levelup, can be formatted two ways:
|
||||
# level:command (e.g. 10:eco give %player% 1000), which would execute that command for level 10
|
||||
# command (e.g. eco give %player% 5000), which would execute that command for all levels
|
||||
level-commands: [ ]
|
||||
# Effects to run when the skill levels up
|
||||
# %level% is the level the skill leveled up to.
|
||||
# If you want to restrict this to certain levels, you can use
|
||||
# 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
|
||||
effects:
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -95,7 +99,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each bee you breed"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -94,7 +98,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks placed"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -92,7 +96,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each enchanted item"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -107,7 +111,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each crop farmed"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -92,7 +96,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each fish caught"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -104,7 +108,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &7Earn &a$%money%&7 for each log chopped."
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -74,15 +78,17 @@ level-xp-requirements:
|
||||
xp-gain-methods:
|
||||
- trigger: mine_block
|
||||
multiplier: 0.5
|
||||
conditions: [ ]
|
||||
filters:
|
||||
items:
|
||||
- "*wooden_pickaxe"
|
||||
- "*stone_pickaxe"
|
||||
- "*iron_pickaxe"
|
||||
- "*golden_pickaxe"
|
||||
- "*diamond_pickaxe"
|
||||
- "*netherite_pickaxe"
|
||||
filters: [ ]
|
||||
conditions:
|
||||
- id: in_mainhand
|
||||
args:
|
||||
items:
|
||||
- "*wooden_pickaxe"
|
||||
- "*stone_pickaxe"
|
||||
- "*iron_pickaxe"
|
||||
- "*golden_pickaxe"
|
||||
- "*diamond_pickaxe"
|
||||
- "*netherite_pickaxe"
|
||||
|
||||
level-placeholders:
|
||||
- id: "money"
|
||||
@@ -102,21 +108,23 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each &a%blocks%&8 blocks mined"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
args:
|
||||
every: "ceil(10 - %level% / 10)"
|
||||
amount: "0.4 * %level%"
|
||||
filters:
|
||||
items:
|
||||
- "*wooden_pickaxe"
|
||||
- "*stone_pickaxe"
|
||||
- "*iron_pickaxe"
|
||||
- "*golden_pickaxe"
|
||||
- "*diamond_pickaxe"
|
||||
- "*netherite_pickaxe"
|
||||
conditions:
|
||||
- id: in_mainhand
|
||||
args:
|
||||
items:
|
||||
- "*wooden_pickaxe"
|
||||
- "*stone_pickaxe"
|
||||
- "*iron_pickaxe"
|
||||
- "*golden_pickaxe"
|
||||
- "*diamond_pickaxe"
|
||||
- "*netherite_pickaxe"
|
||||
triggers:
|
||||
- mine_block
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -95,7 +99,7 @@ level-up-messages:
|
||||
- "&8» &8Earn &a$%money%&8 per heart of health that"
|
||||
- " &8mobs you kill have"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -10,6 +10,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -17,6 +19,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -92,7 +96,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each smelted item"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -18,6 +18,8 @@ join-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
join-effects: []
|
||||
|
||||
join-lore: []
|
||||
|
||||
leave-price:
|
||||
@@ -25,6 +27,8 @@ leave-price:
|
||||
type: coins
|
||||
display: "&a$%value%"
|
||||
|
||||
leave-effects: []
|
||||
|
||||
leave-lore:
|
||||
- ""
|
||||
|
||||
@@ -133,7 +137,7 @@ level-up-messages:
|
||||
1:
|
||||
- "&8» &8Earn &a$%money%&8 for each tool crafted"
|
||||
|
||||
level-commands: [ ]
|
||||
level-up-effects: [ ]
|
||||
|
||||
effects:
|
||||
- id: give_money
|
||||
|
||||
@@ -8,6 +8,9 @@ messages:
|
||||
needs-player: "&cYou must specify a player!"
|
||||
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-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!"
|
||||
need-amount: "&cYou must specify a amount!"
|
||||
invalid-player: "&cInvalid player!"
|
||||
|
||||
@@ -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
|
||||
#Tue May 30 16:09:51 BST 2023
|
||||
#Sat Mar 29 14:21:51 GMT 2025
|
||||
kotlin.code.style=official
|
||||
libreforge-version=4.17.0
|
||||
version=3.16.0
|
||||
libreforge-version=4.75.0
|
||||
version=3.73.0
|
||||
|
||||
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
|
||||
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
|
||||
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 {
|
||||
gradlePluginPortal()
|
||||
mavenLocal()
|
||||
maven("https://repo.jpenilla.xyz/snapshots/")
|
||||
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"
|
||||
|
||||
// Core
|
||||
|
||||
Reference in New Issue
Block a user