Skip to content

Commit

Permalink
adjustable beacon radius
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Sep 27, 2024
1 parent 33c1c39 commit 6293308
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "1.15.2+6.17.1"
version = "1.15.2+6.17.2"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ class BeaconCustomBlock(
lore: List<String>? = 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))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 6293308

Please sign in to comment.