Fixed books being enchanted

This commit is contained in:
Auxilor 2022-09-11 10:15:20 +01:00
parent 0ec4385a29
commit 991004236d
4 changed files with 10 additions and 5 deletions

View File

@ -241,7 +241,7 @@ abstract class EcoEnchant(
return false return false
} }
if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) { if (item.type == Material.ENCHANTED_BOOK) {
return true return true
} }

View File

@ -67,8 +67,12 @@ class EnchantingTableSupport(
} }
} }
if (item.type == Material.BOOK) {
item.type = Material.ENCHANTED_BOOK
}
var multiplier = 0.01 var multiplier = 0.01
if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) { if (item.type == Material.ENCHANTED_BOOK) {
multiplier *= plugin.configYml.getDouble("enchanting-table.book-multiplier") multiplier *= plugin.configYml.getDouble("enchanting-table.book-multiplier")
} }
@ -163,7 +167,8 @@ class EnchantingTableSupport(
val levelScale = ceil(maxObtainableLevel / 30.0).toInt() val levelScale = ceil(maxObtainableLevel / 30.0).toInt()
val bottomEnchantLevel = (ceil((baseLevel / 3).coerceAtLeast(1.0)).toInt() * levelScale).coerceAtMost(maxObtainableLevel) val bottomEnchantLevel =
(ceil((baseLevel / 3).coerceAtLeast(1.0)).toInt() * levelScale).coerceAtMost(maxObtainableLevel)
val midEnchantLevel = ((baseLevel * 2 / 3).toInt() + 1) * levelScale val midEnchantLevel = ((baseLevel * 2 / 3).toInt() + 1) * levelScale
val topEnchantLevel = baseLevel.coerceAtLeast(bonus * 2.0).toInt() * levelScale val topEnchantLevel = baseLevel.coerceAtLeast(bonus * 2.0).toInt() * levelScale

View File

@ -38,7 +38,7 @@ class LootSupport(
var multiplier = 0.01 var multiplier = 0.01
if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) { if (item.type == Material.ENCHANTED_BOOK) {
multiplier *= plugin.configYml.getDouble("loot.book-multiplier") multiplier *= plugin.configYml.getDouble("loot.book-multiplier")
} }

View File

@ -35,7 +35,7 @@ class VillagerSupport(
var multiplier = 0.01 var multiplier = 0.01
if (result.type == Material.BOOK || result.type == Material.ENCHANTED_BOOK) { if (result.type == Material.ENCHANTED_BOOK) {
multiplier *= plugin.configYml.getDouble("villager.book-multiplier") multiplier *= plugin.configYml.getDouble("villager.book-multiplier")
} }