Skip to content

Releases: Sub4ikGG/switchmob-minecraft-plugin

1.0.1 - Release!

07 May 19:36
Compare
Choose a tag to compare
IMG_6102.MP4

New commands:

Toggle plugin:

/switchmobtoggle [true, false]
alias: /smtoggle

Change spawn chance:

/switchmobchance [spawn, lightning, explosion, fireworks] [0-100]
alias - /smchance

Migrated to SwitchMobEffect's

For easier and more standardized creation of spawn effects

interface SwitchMobEffect {
    /**
     * Creates effect on [location]
     */
    fun createEffect(location: Location)
}

Example SwitchMobSpawnEffect:

class SwitchMobSpawnEffect(
    private val world: World,
    private val damager: Entity,
    private val entityTypeFilter: EntityTypeFilter = DefaultEntityTypeFilter(world = world)
) : SwitchMobEffect {
    override fun createEffect(location: Location) {
        val randomEntityType =
            EntityType.entries.filter(entityTypeFilter::filter).random()

        val entity = world.spawnEntity(location, randomEntityType)
        if (entity is Mob && damager is LivingEntity) {
            entity.target = damager
            entity.isAggressive = true
        }
    }
}

And SwitchMobEffectType enumerator:

enum class SwitchMobEffectType(val argument: String, val baseChance: Int) {
    SPAWN("spawn", 70),

    // Default SwitchMobEffectTypes
    LIGHTNING("lightning", 90),
    EXPLOSION("explosion", 50),
    FIREWORKS("fireworks", 1);

    companion object {
        fun fromArgument(argument: String): SwitchMobEffectType? {
            return entries.find { it.argument == argument }
        }
    }
}

1.0-SNAPSHOT

05 May 19:04
e274b44
Compare
Choose a tag to compare
1.0-SNAPSHOT Pre-release
Pre-release
Create README.md