Skip to content

Commit

Permalink
fix fireworks
Browse files Browse the repository at this point in the history
  • Loading branch information
l4zs committed Jun 13, 2022
1 parent cceebaf commit 1bd3e2e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/kotlin/de/stckoverflw/stckutils/minecraft/goal/Goal.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import de.stckoverflw.stckutils.minecraft.timer.Timer
import net.axay.kspigot.chat.KColors
import net.axay.kspigot.extensions.bukkit.bukkitColor
import net.axay.kspigot.extensions.onlinePlayers
import net.axay.kspigot.runnables.sync
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.Component.text
import net.kyori.adventure.text.Component.translatable
Expand Down Expand Up @@ -94,18 +95,21 @@ val Goal.winKey: String
get() = "$id.win"

private fun spawnFireworks() {

onlinePlayers.forEach {
val loc = it.location
val firework = loc.world.spawnEntity(loc, EntityType.FIREWORK) as Firework
val fireworkMeta = firework.fireworkMeta
sync {
val loc = it.location
val firework = loc.world.spawnEntity(loc, EntityType.FIREWORK) as Firework
val fireworkMeta = firework.fireworkMeta

fireworkMeta.power = 1
fireworkMeta.addEffect(FireworkEffect.builder().withColor(KColors.BLUE.bukkitColor).flicker(true).build())
fireworkMeta.power = 1
fireworkMeta.addEffect(FireworkEffect.builder().withColor(KColors.BLUE.bukkitColor).flicker(true).build())

firework.fireworkMeta = fireworkMeta
firework.detonate()
firework.fireworkMeta = fireworkMeta
firework.detonate()

firework.fireworkMeta = fireworkMeta
it.gameMode = GameMode.SPECTATOR
firework.fireworkMeta = fireworkMeta
it.gameMode = GameMode.SPECTATOR
}
}
}

0 comments on commit 1bd3e2e

Please sign in to comment.