mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Renamed WrappedEnchantment to CAEnchantment (CustomAnvilEnchantment).
created an interface out of CAEnchantment and moved the implementation to CAEnchantmentBase.
This commit is contained in:
parent
fa4752ea67
commit
dafe595c5b
20 changed files with 575 additions and 463 deletions
|
|
@ -4,7 +4,7 @@ import io.delilaheve.CustomAnvil
|
|||
import org.bukkit.Material
|
||||
import org.bukkit.entity.HumanEntity
|
||||
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
||||
import xyz.alexcrea.cuanvil.enchant.WrappedEnchantment
|
||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment
|
||||
import xyz.alexcrea.cuanvil.group.ConflictType
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
|
@ -17,17 +17,17 @@ object EnchantmentUtil {
|
|||
/**
|
||||
* Enchantment name without namespace
|
||||
*/
|
||||
val WrappedEnchantment.enchantmentName: String
|
||||
val CAEnchantment.enchantmentName: String
|
||||
get() = key.key
|
||||
|
||||
/**
|
||||
* Combine 2 sets of enchantments according to our configuration
|
||||
*/
|
||||
fun Map<WrappedEnchantment, Int>.combineWith(
|
||||
other: Map<WrappedEnchantment, Int>,
|
||||
fun Map<CAEnchantment, Int>.combineWith(
|
||||
other: Map<CAEnchantment, Int>,
|
||||
mat: Material,
|
||||
player: HumanEntity
|
||||
) = mutableMapOf<WrappedEnchantment, Int>().apply {
|
||||
) = mutableMapOf<CAEnchantment, Int>().apply {
|
||||
putAll(this@combineWith)
|
||||
other.forEach { (enchantment, level) ->
|
||||
if(!enchantment.isAllowed(player)) return@forEach
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue