BlurpSound

BlurpSound is a builder-style utility for playing sounds in plugins.

Features

  • Builder pattern for fluent sound configuration

  • Play a sound to all players in a radius, or to specific players

  • Exclude certain players from hearing the sound

  • Adjustable volume, pitch, radius, and fade multiplier

  • Supports sound categories and playback delay (in ticks)

  • Integrates with BlurpScheduler for delayed execution

Usage

Basic Example

new BlurpSound()
    .sound(Sound.ENTITY_PLAYER_LEVELUP)
    .volume(1.0f)
    .pitch(1.2f)
    .play(player); // Play to one player at their location

Play to All Players in a Radius

new BlurpSound()
    .sound(Sound.BLOCK_ANVIL_LAND)
    .volume(0.5f)
    .radius(20f)
    .fadeMultiplier(0.5f)
    .category(SoundCategory.BLOCKS)
    .play(location); // Play to all players near a location

Target or Exclude Players

new BlurpSound()
    .sound(Sound.BLOCK_NOTE_BLOCK_BELL)
    .target(player1, player2)
    .exclude(player3)
    .play(location);

Delayed Playback

new BlurpSound()
    .sound(Sound.ENTITY_CREEPER_PRIMED)
    .delay(40) // 2 seconds (40 ticks)
    .play(player);

API Reference

Method
Description

sound(Sound)

Set the sound to play

volume(float)

Set the volume (default: 1.0)

pitch(float)

Set the pitch (default: 1.0)

radius(float)

Max distance for sound (default: 16.0)

fadeMultiplier(float)

Volume fade factor across radius

category(SoundCategory)

Set the sound category

delay(int ticks)

Delay playback by ticks

target(Player...)

Only play to these players

exclude(Player...)

Exclude these players from playback

play(Location)

Play to all (or targeted) players near loc

play(Player)

Play to a specific player

Notes

  • All time values are in ticks (20 ticks = 1 second).

  • If both target and exclude are used, exclude takes precedence.

Last updated