mirror of
https://github.com/Auxilor/EcoJobs.git
synced 2025-12-20 15:39:26 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e67717cf84 | ||
|
|
16798df570 | ||
|
|
d0eaee3ad0 | ||
|
|
4e076680aa |
@@ -39,7 +39,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("com.willfp:eco:6.56.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:2.1.0")
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.willfp.ecojobs.commands.CommandJobs
|
|||||||
import com.willfp.ecojobs.jobs.EcoJobsJobTopPlaceholder
|
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
|
||||||
@@ -89,6 +90,10 @@ class EcoJobsPlugin : LibreforgePlugin() {
|
|||||||
}.register()
|
}.register()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun handleReload() {
|
||||||
|
JobsGUI.update(this)
|
||||||
|
}
|
||||||
|
|
||||||
override fun loadPluginCommands(): List<PluginCommand> {
|
override fun loadPluginCommands(): List<PluginCommand> {
|
||||||
return listOf(
|
return listOf(
|
||||||
CommandEcoJobs(this),
|
CommandEcoJobs(this),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
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 com.willfp.libreforge.toDispatcher
|
||||||
@@ -21,9 +22,10 @@ class JobLevelListener(
|
|||||||
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")
|
||||||
|
|
||||||
|
if (sound != null) {
|
||||||
player.playSound(
|
player.playSound(
|
||||||
player.location,
|
player.location,
|
||||||
sound,
|
sound,
|
||||||
@@ -31,6 +33,7 @@ class JobLevelListener(
|
|||||||
pitch.toFloat()
|
pitch.toFloat()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.plugin.configYml.getBool("level-up.message.enabled")) {
|
if (this.plugin.configYml.getBool("level-up.message.enabled")) {
|
||||||
for (message in job.injectPlaceholdersInto(
|
for (message in job.injectPlaceholdersInto(
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,13 +146,17 @@ object JobsGUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val sound = SoundUtils.getSound(plugin.configYml.getString("gui.job-icon.click.sound"))
|
||||||
|
|
||||||
|
if (sound != null) {
|
||||||
player.playSound(
|
player.playSound(
|
||||||
player.location,
|
player.location,
|
||||||
Sound.valueOf(plugin.configYml.getString("gui.job-icon.click.sound").uppercase()),
|
sound,
|
||||||
1f,
|
1f,
|
||||||
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onRightClick { player, _, _, menu ->
|
onRightClick { player, _, _, menu ->
|
||||||
val page = menu.getPage(player)
|
val page = menu.getPage(player)
|
||||||
@@ -170,14 +170,18 @@ object JobsGUI {
|
|||||||
if (player.hasJobActive(job)) {
|
if (player.hasJobActive(job)) {
|
||||||
job.leaveGUI.open(player)
|
job.leaveGUI.open(player)
|
||||||
|
|
||||||
|
val sound = SoundUtils.getSound(plugin.configYml.getString("gui.job-icon.click.sound"))
|
||||||
|
|
||||||
|
if (sound != null) {
|
||||||
player.playSound(
|
player.playSound(
|
||||||
player.location,
|
player.location,
|
||||||
Sound.valueOf(plugin.configYml.getString("gui.job-icon.click.sound").uppercase()),
|
sound,
|
||||||
1f,
|
1f,
|
||||||
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
plugin.configYml.getDouble("gui.job-icon.click.pitch").toFloat()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,12 +208,14 @@ object JobsGUI {
|
|||||||
)
|
)
|
||||||
|
|
||||||
maxPages { player ->
|
maxPages { player ->
|
||||||
ceil(Jobs.values()
|
ceil(
|
||||||
|
Jobs.values()
|
||||||
.filter { player.getJobLevel(it) > 0 }
|
.filter { player.getJobLevel(it) > 0 }
|
||||||
.size.toDouble() / jobAreaSlots.size).toInt()
|
.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,4 +2,4 @@
|
|||||||
#Mon Oct 06 08:56:29 BST 2025
|
#Mon Oct 06 08:56:29 BST 2025
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
libreforge-version=4.79.0
|
libreforge-version=4.79.0
|
||||||
version=3.77.0
|
version=3.77.2
|
||||||
|
|||||||
Reference in New Issue
Block a user