Interface SoundPlayer


public interface SoundPlayer
Plays sounds to players with permission checking.

Usage example:

SoundPlayer soundPlayer = flectonePulse.get(SoundPlayer.class);

Sound sound = ...;
PermissionSetting permission = new PermissionSetting("myplugin.sound", false);

// Play sound to specific player
soundPlayer.play(Pair.of(sound, permission), sender, receiver);

// Play sound at location to nearby players
soundPlayer.play(Pair.of(sound, permission), sender, new Vector3i(100, 64, 200));
Since:
1.6.0
  • Method Details

    • play

      default void play(Pair<Sound, PermissionSetting> soundPermission, FEntity sender)
      Plays a sound to a player at their own location.
      Parameters:
      soundPermission - pair containing sound settings and required permission
      sender - the entity triggering the sound (checks permission)
    • play

      void play(Pair<Sound, PermissionSetting> soundPermission, FEntity sender, FPlayer receiver)
      Plays a sound from one player to another player.
      Parameters:
      soundPermission - pair containing sound settings and required permission
      sender - the player triggering the sound (checks permission)
      receiver - the player receiving the sound