Skip to content

Commit a00ccce

Browse files
authored
Add Adventure playSound(Sound, Position) (#14100)
1 parent ccee047 commit a00ccce

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

paper-api/src/main/java/org/bukkit/World.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.papermc.paper.entity.poi.PoiSearchResult;
44
import io.papermc.paper.entity.poi.PoiType;
5+
import io.papermc.paper.math.Position;
56
import io.papermc.paper.raytracing.PositionedRayTraceConfigurationBuilder;
67
import java.io.File;
78
import java.nio.file.Path;
@@ -3772,6 +3773,16 @@ default void playSound(@NotNull Entity entity, @NotNull String sound, float volu
37723773
*/
37733774
void playSound(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed);
37743775

3776+
/**
3777+
* Plays a sound at a position.
3778+
*
3779+
* @param sound a sound
3780+
* @param pos position
3781+
*/
3782+
default void playSound(net.kyori.adventure.sound.@NotNull Sound sound, @NotNull Position pos) {
3783+
playSound(sound, pos.x(), pos.y(), pos.z());
3784+
}
3785+
37753786
/**
37763787
* Get an array containing the names of all the {@link GameRule}s.
37773788
*

paper-api/src/main/java/org/bukkit/entity/Player.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,16 @@ default void playSound(Entity entity, String sound, float volume, float pitch) {
844844
*/
845845
public void playSound(Entity entity, String sound, SoundCategory category, float volume, float pitch, long seed);
846846

847+
/**
848+
* Plays a sound at a position.
849+
*
850+
* @param sound a sound
851+
* @param pos position
852+
*/
853+
default void playSound(net.kyori.adventure.sound.Sound sound, Position pos) {
854+
playSound(sound, pos.x(), pos.y(), pos.z());
855+
}
856+
847857
/**
848858
* Stop the specified sound from playing.
849859
*

0 commit comments

Comments
 (0)