Skip to content

集成 API

QueDPAPI.integrations() 提供第三方插件集成功能。


MythicMobs

检查是否加载

kotlin
if (QueDPAPI.integrations().isMythicMobsLoaded()) {
    logger.info("MythicMobs 已加载")
}

生成 MythicMob

kotlin
val mob: ActiveMob? = QueDPAPI.integrations().spawnMythicMob(
    mobId = "SkeletonKing",
    location = location,
    level = 5.0
)

if (mob != null) {
    logger.info("已生成: ${mob.displayName}")
} else {
    logger.warning("生成失败")
}

访问集成对象

kotlin
val integration = QueDPAPI.integrations().mythicMobs()
// 使用 MythicMobsIntegration 的其他方法

完整示例

kotlin
fun spawnCustomBoss(location: Location) {
    // 检查 MythicMobs
    if (!QueDPAPI.integrations().isMythicMobsLoaded()) {
        logger.warning("MythicMobs 未加载")
        return
    }
    
    // 生成Boss
    val boss = QueDPAPI.integrations().spawnMythicMob(
        mobId = "DragonBoss",
        location = location,
        level = 10.0
    )
    
    if (boss != null) {
        // Boss生成成功
        location.world.players.forEach {
            it.sendMessage("§c§lDragon Boss 已出现!")
            it.playSound(location, Sound.ENTITY_ENDER_DRAGON_GROWL, 1.0f, 0.8f)
        }
    }
}

注意事项

  • 需要安装 MythicMobs 插件
  • 怪物ID必须在 MythicMobs 配置中存在
  • level 参数会传递给 MythicMobs

返回值说明

  • isMythicMobsLoaded() 返回 Boolean
  • spawnMythicMob() 返回 ActiveMob?(失败返回 null

基于 MIT 许可发布