9
0
mirror of https://github.com/Auxilor/EcoJobs.git synced 2025-12-19 15:09:24 +00:00

Fixed GUI

This commit is contained in:
Will FP
2025-10-26 13:38:27 +00:00
parent d0eaee3ad0
commit 16798df570
4 changed files with 39 additions and 25 deletions

View File

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

View File

@@ -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,15 +22,17 @@ 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")
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")) {

View File

@@ -12,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
@@ -145,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 ->
@@ -165,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()
)
}
} }
} }
}) })
@@ -199,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")))

View File

@@ -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.1 version=3.77.2