diff --git a/build.gradle.kts b/build.gradle.kts index 91b4b7b..da841f4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ plugins { } group = "net.azisaba" -version = "1.20.2+6.17.1" +version = "1.20.2+6.17.2" java { toolchain.languageVersion.set(JavaLanguageVersion.of(17)) diff --git a/src/main/java/com/github/mori01231/lifecore/block/BeaconCustomBlock.kt b/src/main/java/com/github/mori01231/lifecore/block/BeaconCustomBlock.kt index 0306a96..d57d056 100644 --- a/src/main/java/com/github/mori01231/lifecore/block/BeaconCustomBlock.kt +++ b/src/main/java/com/github/mori01231/lifecore/block/BeaconCustomBlock.kt @@ -17,13 +17,14 @@ class BeaconCustomBlock( lore: List? = null, private val effect: PotionEffectType, private val amplifier: Int, + private val radius: Double = 250.0, private val destroyWithoutWrench: Boolean, ) : CustomBlock(material, displayName, lore) { var ticks = 0 override fun tick(manager: CustomBlockManager, pos: WorldLocation, state: CustomBlockState): CustomBlockState? { if (ticks++ % 80 == 0) { - pos.toBukkitLocation().getNearbyEntitiesByType(Player::class.java, 250.0).forEach { player -> + pos.toBukkitLocation().getNearbyEntitiesByType(Player::class.java, radius).forEach { player -> player.addPotionEffect(effect.createEffect(20 * 60, amplifier)) } } diff --git a/src/main/java/com/github/mori01231/lifecore/block/CustomBlockManager.kt b/src/main/java/com/github/mori01231/lifecore/block/CustomBlockManager.kt index 74081e9..32fdecf 100644 --- a/src/main/java/com/github/mori01231/lifecore/block/CustomBlockManager.kt +++ b/src/main/java/com/github/mori01231/lifecore/block/CustomBlockManager.kt @@ -145,7 +145,8 @@ class CustomBlockManager(val plugin: LifeCore) { val effect = PotionEffectType.getByName(map["effect"]?.toString() ?: return plugin.logger.warning("effect is required @ $blockName")) ?: return plugin.logger.warning("Unknown effect: ${map["effect"]} @ $blockName") val amplifier = map["amplifier"]?.toString()?.toIntOrNull() ?: 0 - BeaconCustomBlock(blockName, lockFacing, axisShift, backgroundBlock, material, displayName, lore, effect, amplifier, destroyWithoutWrench) + val radius = map["radius"]?.toString()?.toDouble() ?: 250.0 + BeaconCustomBlock(blockName, lockFacing, axisShift, backgroundBlock, material, displayName, lore, effect, amplifier, radius, destroyWithoutWrench) } else { error("Unknown block type: $type") }