music plugin: add more area mute options
This adds an option to mute your own area sounds, sounds from npcs, and sounds with no source.
This commit is contained in:
@@ -31,16 +31,50 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
@ConfigGroup("music")
|
@ConfigGroup("music")
|
||||||
public interface MusicConfig extends Config
|
public interface MusicConfig extends Config
|
||||||
{
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "muteOwnAreaSounds",
|
||||||
|
name = "Mute player area sounds",
|
||||||
|
description = "Mute area sounds caused by yourself",
|
||||||
|
position = 0
|
||||||
|
)
|
||||||
|
default boolean muteOwnAreaSounds()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "muteOtherAreaSounds",
|
keyName = "muteOtherAreaSounds",
|
||||||
name = "Mute others' area sounds",
|
name = "Mute other players' area sounds",
|
||||||
description = "Mute area sounds caused from other players"
|
description = "Mute area sounds caused by other players",
|
||||||
|
position = 1
|
||||||
)
|
)
|
||||||
default boolean muteOtherAreaSounds()
|
default boolean muteOtherAreaSounds()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "muteOtherAreaNPCSounds",
|
||||||
|
name = "Mute NPCs' area sounds",
|
||||||
|
description = "Mute area sounds caused by NPCs",
|
||||||
|
position = 2
|
||||||
|
)
|
||||||
|
default boolean muteNpcAreaSounds()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "muteOtherAreaEnvironmentSounds",
|
||||||
|
name = "Mute environment area sounds",
|
||||||
|
description = "Mute area sounds caused by neither NPCs nor players",
|
||||||
|
position = 3
|
||||||
|
)
|
||||||
|
default boolean muteEnvironmentAreaSounds()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "musicVolume",
|
keyName = "musicVolume",
|
||||||
name = "",
|
name = "",
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import lombok.Setter;
|
|||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.ScriptID;
|
import net.runelite.api.ScriptID;
|
||||||
import net.runelite.api.SoundEffectID;
|
import net.runelite.api.SoundEffectID;
|
||||||
@@ -557,11 +558,26 @@ public class MusicPlugin extends Plugin
|
|||||||
public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed)
|
public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed)
|
||||||
{
|
{
|
||||||
Actor source = areaSoundEffectPlayed.getSource();
|
Actor source = areaSoundEffectPlayed.getSource();
|
||||||
if (source != client.getLocalPlayer()
|
if (source == client.getLocalPlayer()
|
||||||
|
&& musicConfig.muteOwnAreaSounds())
|
||||||
|
{
|
||||||
|
areaSoundEffectPlayed.consume();
|
||||||
|
}
|
||||||
|
else if (source != client.getLocalPlayer()
|
||||||
&& source instanceof Player
|
&& source instanceof Player
|
||||||
&& musicConfig.muteOtherAreaSounds())
|
&& musicConfig.muteOtherAreaSounds())
|
||||||
{
|
{
|
||||||
areaSoundEffectPlayed.consume();
|
areaSoundEffectPlayed.consume();
|
||||||
}
|
}
|
||||||
|
else if (source instanceof NPC
|
||||||
|
&& musicConfig.muteNpcAreaSounds())
|
||||||
|
{
|
||||||
|
areaSoundEffectPlayed.consume();
|
||||||
|
}
|
||||||
|
else if (source == null
|
||||||
|
&& musicConfig.muteEnvironmentAreaSounds())
|
||||||
|
{
|
||||||
|
areaSoundEffectPlayed.consume();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user