feat: Enhance double jump feedback with new particle effects, layered sounds, and styled action bar messages.

This commit is contained in:
Kariya 2025-12-11 16:58:58 +00:00
parent 03080fbd48
commit 9a77176a53

View File

@ -8,6 +8,7 @@ import net.hareworks.hcu.items.api.component.AbstractComponent
import net.hareworks.hcu.items.api.component.EquippableComponent
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.NamedTextColor
import net.kyori.adventure.text.format.TextColor
import org.bukkit.GameMode
import org.bukkit.Material
import org.bukkit.Particle
@ -30,6 +31,12 @@ class DoubleJumpComponent(private val plugin: App) : AbstractComponent(plugin, "
companion object {
// Track players who have used their double jump (GLIDER is removed)
private val usedDoubleJump = ConcurrentHashMap.newKeySet<UUID>()
// Color scheme
private val PRIMARY_COLOR = TextColor.color(0x7DF9FF) // Electric Cyan
private val SECONDARY_COLOR = TextColor.color(0xE0FFFF) // Light Cyan
private val READY_COLOR = NamedTextColor.GREEN
private val COOLDOWN_COLOR = NamedTextColor.GRAY
}
override fun apply(item: ItemStack, tier: Tier?) {
@ -58,11 +65,14 @@ class DoubleJumpComponent(private val plugin: App) : AbstractComponent(plugin, "
if (!item.hasData(DataComponentTypes.GLIDER)) {
item.setData(DataComponentTypes.GLIDER)
}
// Landing feedback
showReadyMessage(player)
player.playSound(player.location, Sound.BLOCK_NOTE_BLOCK_CHIME, 0.5f, 1.5f)
}
}
override fun onToggleGlide(player: Player, item: ItemStack, event: EntityToggleGlideEvent) {
if (player.gameMode == GameMode.CREATIVE || player.gameMode == GameMode.SPECTATOR) return
// Only handle glide start events
if (!event.isGliding) return
@ -99,10 +109,51 @@ class DoubleJumpComponent(private val plugin: App) : AbstractComponent(plugin, "
player.velocity = currentVelocity.add(direction.multiply(forwardPower)).setY(verticalPower)
// Effects
player.world.spawnParticle(Particle.CLOUD, player.location, 10, 0.5, 0.1, 0.5, 0.05)
player.playSound(player.location, Sound.ENTITY_BAT_TAKEOFF, 1.0f, 1.2f)
// Visual Effects
spawnDoubleJumpParticles(player)
player.sendActionBar(Component.text("Double Jump!", NamedTextColor.GREEN))
// Sound Effects - layered for impact
player.playSound(player.location, Sound.ENTITY_PLAYER_ATTACK_SWEEP, 1.0f, 1.5f)
player.playSound(player.location, Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, 0.5f, 1.8f)
player.playSound(player.location, Sound.ENTITY_BREEZE_JUMP, 0.8f, 1.2f)
// Action Bar with styled message
showJumpMessage(player)
}
private fun spawnDoubleJumpParticles(player: Player) {
val loc = player.location
val world = player.world
// Ring of particles at feet
for (i in 0 until 12) {
val angle = (i * 30) * Math.PI / 180
val x = Math.cos(angle) * 0.8
val z = Math.sin(angle) * 0.8
world.spawnParticle(Particle.CLOUD, loc.clone().add(x, 0.1, z), 1, 0.0, 0.0, 0.0, 0.02)
world.spawnParticle(Particle.END_ROD, loc.clone().add(x, 0.1, z), 1, 0.0, 0.2, 0.0, 0.02)
}
// Upward burst
world.spawnParticle(Particle.FIREWORK, loc, 15, 0.3, 0.1, 0.3, 0.08)
world.spawnParticle(Particle.SOUL_FIRE_FLAME, loc, 8, 0.2, 0.0, 0.2, 0.03)
// Trail particles (spawned slightly delayed via velocity)
world.spawnParticle(Particle.SWEEP_ATTACK, loc.clone().add(0.0, 0.5, 0.0), 1, 0.0, 0.0, 0.0, 0.0)
}
private fun showJumpMessage(player: Player) {
player.sendActionBar(
Component.text("", PRIMARY_COLOR)
.append(Component.text("ダブルジャンプ!", SECONDARY_COLOR))
.append(Component.text("", PRIMARY_COLOR))
)
}
private fun showReadyMessage(player: Player) {
player.sendActionBar(
Component.text("", READY_COLOR)
.append(Component.text("ダブルジャンプ準備完了", NamedTextColor.AQUA))
)
}
}