跳到主要内容

on_corruption_spread

On Corruption Spread — misc entry.

Entry Information

PropertyValue
Entry IDon_corruption_spread
TypeMisc
ColorDark_purple
Iconfa6-solid:expand

Description

Creates a dynamic corruption zone at a specific location. / @Entry("create_corruption_zone", "Create Corruption Zone", Colors.DARK_PURPLE, "fa6-solid:biohazard") class CreateCorruptionZoneActionEntry( @Help("Center position of the zone") val center: Position = Position.ORIGIN, @Help("Radius of the zone in blocks") val radius: Double = 10.0, @Help("Corruption level (1-10)") val level: Int = 1, @Help("Source of corruption") val source: String = "ENVIRONMENTAL", override val id: String = "", override val name: String = "", override val criteria: List<Criteria> = emptyList(), override val modifiers: List<Modifier> = emptyList(), override val triggers: List<Ref<TriggerableEntry>> = emptyList(), ) : ActionEntry { override fun ActionTrigger.execute() { val manager = KoinJavaComponent.get<CorruptionManager>(CorruptionManager::class.java) val corruptionSource = try { CorruptionSource.valueOf(source.uppercase()) } catch (_: Exception) { CorruptionSource.ENVIRONMENTAL } manager.createZone(center, radius, level, corruptionSource) } } /** Purifies a corruption zone at a specific location. / @Entry("purify_corruption_zone", "Purify Corruption Zone", Colors.GREEN, "fa6-solid:sparkles") class PurifyZoneActionEntry( @Help("Position to purify (finds nearest zone)") val position: Position = Position.ORIGIN, @Help("Purification amount (0-100)") val amount: Double = 10.0, override val id: String = "", override val name: String = "", override val criteria: List<Criteria> = emptyList(), override val modifiers: List<Modifier> = emptyList(), override val triggers: List<Ref<TriggerableEntry>> = emptyList(), ) : ActionEntry { override fun ActionTrigger.execute() { val manager = KoinJavaComponent.get<CorruptionManager>(CorruptionManager::class.java) val location = org.bukkit.Location( org.bukkit.Bukkit.getWorld(position.world.identifier) ?: return, position.x, position.y, position.z ) val zone = manager.getZoneAt(location) ?: return zone.purificationProgress = (zone.purificationProgress + amount).coerceIn(0.0, 100.0) } } /** Spawns a corrupted mob from BTC Mobs. / @Entry("spawn_corrupted_mob", "Spawn Corrupted Mob", Colors.RED, "fa6-solid:skull") class SpawnCorruptedMobActionEntry( @Help("Mob type to spawn (BTCMobs internal name)") val mobType: String = "", @Help("Corruption level (affects stats)") val corruptionLevel: Int = 1, override val id: String = "", override val name: String = "", override val criteria: List<Criteria> = emptyList(), override val modifiers: List<Modifier> = emptyList(), override val triggers: List<Ref<TriggerableEntry>> = emptyList(), ) : ActionEntry { override fun ActionTrigger.execute() { try { val btcPlugin = com.borntocraft.btcmobs.api.BtcProvider.get() as? com.borntocraft.btcmobs.api.BtcPlugin ?: return val mob = btcPlugin.mobManager.getBtcMob(mobType).orElse(null) ?: return val loc = player.location val activeMob = btcPlugin.mobManager.spawnMob(mob, loc, com.borntocraft.btcmobs.api.core.mobs.MobSpawnOptions(level = corruptionLevel.toDouble())) // Apply corruption visual effects activeMob.entity.isGlowing = true activeMob.entity.world.spawnParticle(org.bukkit.Particle.WITCH, activeMob.entity.location, 20, 0.5, 1.0, 0.5, 0.1) } catch (e: Exception) { com.typewritermc.engine.paper.logger.warning("[Corruption] Failed to spawn corrupted mob: ${e.message}") } } } // --- Events --- /** Triggered when corruption spreads to a new area.