enchanting: check level

This commit is contained in:
Bixilon 2023-01-13 14:17:15 +01:00
parent 90c8095624
commit 784453a754
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -72,12 +72,16 @@ class EnchantingContainer(connection: PlayConnection, type: ContainerType, title
}
fun canEnchant(index: Int): Boolean {
if (costs[index] < 0) {
val cost = costs[index]
if (cost < 0) {
return false
}
if (connection.player.gamemode == Gamemodes.CREATIVE) {
return true
}
if (connection.player.experienceCondition.level < cost) {
return false
}
val lapislazuli = this.lapislazuli
if (lapislazuli < index + 1) {
return false