music plugin: reclassify teleport sfx as other players' area effects instead of environmental area effects

This commit is contained in:
Jay
2019-11-22 08:07:22 -07:00
committed by Adam
parent 9e6eb370b4
commit 37bf35087d

View File

@@ -25,10 +25,12 @@
*/ */
package net.runelite.client.plugins.music; package net.runelite.client.plugins.music;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Provides; import com.google.inject.Provides;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator; import java.util.Comparator;
import java.util.Set;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.ToIntFunction; import java.util.function.ToIntFunction;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -76,6 +78,10 @@ import net.runelite.client.plugins.PluginDescriptor;
) )
public class MusicPlugin extends Plugin public class MusicPlugin extends Plugin
{ {
private static final Set<Integer> SOURCELESS_PLAYER_SOUNDS = ImmutableSet.of(
SoundEffectID.TELEPORT_VWOOP
);
@Inject @Inject
private Client client; private Client client;
@@ -558,13 +564,14 @@ public class MusicPlugin extends Plugin
public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed) public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed)
{ {
Actor source = areaSoundEffectPlayed.getSource(); Actor source = areaSoundEffectPlayed.getSource();
int soundId = areaSoundEffectPlayed.getSoundId();
if (source == client.getLocalPlayer() if (source == client.getLocalPlayer()
&& musicConfig.muteOwnAreaSounds()) && musicConfig.muteOwnAreaSounds())
{ {
areaSoundEffectPlayed.consume(); areaSoundEffectPlayed.consume();
} }
else if (source != client.getLocalPlayer() else if (source != client.getLocalPlayer()
&& source instanceof Player && (source instanceof Player || (source == null && SOURCELESS_PLAYER_SOUNDS.contains(soundId)))
&& musicConfig.muteOtherAreaSounds()) && musicConfig.muteOtherAreaSounds())
{ {
areaSoundEffectPlayed.consume(); areaSoundEffectPlayed.consume();
@@ -575,9 +582,10 @@ public class MusicPlugin extends Plugin
areaSoundEffectPlayed.consume(); areaSoundEffectPlayed.consume();
} }
else if (source == null else if (source == null
&& !SOURCELESS_PLAYER_SOUNDS.contains(soundId)
&& musicConfig.muteEnvironmentAreaSounds()) && musicConfig.muteEnvironmentAreaSounds())
{ {
areaSoundEffectPlayed.consume(); areaSoundEffectPlayed.consume();
} }
} }
} }