music plugin: add option to mute other players area sounds
This commit is contained in:
@@ -31,6 +31,16 @@ import net.runelite.client.config.ConfigItem;
|
||||
@ConfigGroup("music")
|
||||
public interface MusicConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "muteOtherAreaSounds",
|
||||
name = "Mute others' area sounds",
|
||||
description = "Mute area sounds caused from other players"
|
||||
)
|
||||
default boolean muteOtherAreaSounds()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "musicVolume",
|
||||
name = "",
|
||||
@@ -60,6 +70,7 @@ public interface MusicConfig extends Config
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "soundEffectVolume",
|
||||
name = "",
|
||||
|
||||
@@ -37,13 +37,16 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.SoundEffectID;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.events.AreaSoundEffectPlayed;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
@@ -532,4 +535,16 @@ public class MusicPlugin extends Plugin
|
||||
client.getIntStack()[client.getIntStackSize() - 1] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed)
|
||||
{
|
||||
Actor source = areaSoundEffectPlayed.getSource();
|
||||
if (source != client.getLocalPlayer()
|
||||
&& source instanceof Player
|
||||
&& musicConfig.muteOtherAreaSounds())
|
||||
{
|
||||
areaSoundEffectPlayed.consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user