Skip to content

Commit

Permalink
Merge pull request #8 from YsGqHY/master
Browse files Browse the repository at this point in the history
新增根据实体 UUID 获取 ActiveMob 实例
  • Loading branch information
FxRayHughes authored Jul 29, 2024
2 parents 246db5e + a0601a3 commit 9c0c07e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions project/common/src/main/kotlin/ink/ptms/um/Mythic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import java.io.File
import java.util.*

interface Mythic {

Expand All @@ -30,6 +31,9 @@ interface Mythic {
/** 获取 ActiveMob 实例 */
fun getMob(entity: Entity): Mob?

/** 根据实体 UUID 获取 ActiveMob 实例 */
fun getMob(uuid: UUID): Mob?

/** 获取所有 Mob ID 列表 */
fun getMobIDList(): List<String>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ink.ptms.um.impl4

import ink.ptms.um.Mythic
import ink.ptms.um.*
import ink.ptms.um.Skill
import io.lumine.xikage.mythicmobs.MythicMobs
import io.lumine.xikage.mythicmobs.io.MythicConfig
Expand All @@ -24,7 +24,9 @@ import taboolib.common.util.unsafeLazy
import taboolib.library.reflex.Reflex.Companion.getProperty
import taboolib.module.nms.getName
import java.io.File
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.jvm.optionals.getOrNull

/**
* universal-mythic ink.ptms.um.impl4.Mythic4
Expand Down Expand Up @@ -76,6 +78,10 @@ internal class Mythic4 : Mythic {
return Mob(mobManager.getMythicMobInstance(entity) ?: return null)
}

override fun getMob(uuid: UUID): ink.ptms.um.Mob? {
return Mob(mobManager.getActiveMob(uuid).getOrNull() ?: return null)
}

override fun getMobIDList(): List<String> {
return mobManager.mobNames.toList()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ink.ptms.um.impl5

import ink.ptms.um.Mythic
import ink.ptms.um.*
import ink.ptms.um.Skill
import io.lumine.mythic.api.MythicProvider
import io.lumine.mythic.api.mobs.MythicMob
Expand All @@ -23,6 +23,8 @@ import taboolib.common.util.orNull
import taboolib.library.reflex.Reflex.Companion.getProperty
import taboolib.module.nms.getItemTag
import java.io.File
import java.util.*
import kotlin.jvm.optionals.getOrNull

/**
* universal-mythic ink.ptms.um.impl4.Mythic4
Expand Down Expand Up @@ -63,6 +65,10 @@ internal class Mythic5 : Mythic {
return Mob((MythicProvider.get().mobManager as MobExecutor).getMythicMobInstance(entity) ?: return null)
}

override fun getMob(uuid: UUID): ink.ptms.um.Mob? {
return Mob((MythicProvider.get().mobManager as MobExecutor).getActiveMob(uuid).getOrNull() ?: return null)
}

override fun getMobIDList(): List<String> {
return api.mobManager.mobNames.toList()
}
Expand Down

0 comments on commit 9c0c07e

Please sign in to comment.