diff --git a/docs/api/sources.md b/docs/api/sources.md index 5ad7953..9e508c8 100644 --- a/docs/api/sources.md +++ b/docs/api/sources.md @@ -30,13 +30,21 @@ Entity sources are attached to the entities. ::: ### Player source -Player sources are attached to the players. +Player source is attached to the player, audio will be played at a certain distance around the player. ::: code-group <<< @/snippets/api/sources/player.java [java] <<< @/snippets/api/sources/player.kt{kotlin} [kotlin] ::: +By default, the player attached to the source can't hear the audio. +If you want to override this behaviour, you need to remove the first source filter: +::: code-group +<<< @/snippets/api/sources/player-remove-filter.java [java] +<<< @/snippets/api/sources/player-remove-filter.kt{kotlin} [kotlin] +::: +You can also remove all filters, but beware that vanish support won't work for this source. + ### Direct source Direct sources are attached to a specific player and can only be heard by that player. diff --git a/snippets/api/sources/player-remove-filter.java b/snippets/api/sources/player-remove-filter.java new file mode 100644 index 0000000..43a7396 --- /dev/null +++ b/snippets/api/sources/player-remove-filter.java @@ -0,0 +1,6 @@ +ServerPlayerSource source = /* */; + +source.getFilters() + .stream() + .findFirst() + .ifPresent(source::removeFilter); diff --git a/snippets/api/sources/player-remove-filter.kt b/snippets/api/sources/player-remove-filter.kt new file mode 100644 index 0000000..29fac72 --- /dev/null +++ b/snippets/api/sources/player-remove-filter.kt @@ -0,0 +1,3 @@ +val source: ServerPlayerSource = /* */ + +source.removeFilter(source.filters.first()) \ No newline at end of file