Added 'None' option to the message sound.

This commit is contained in:
Aust1n46 2021-07-01 20:23:33 -04:00
parent a847a50bbe
commit bff5797a34
3 changed files with 7 additions and 2 deletions

View File

@ -100,6 +100,7 @@ unmuteinterval: 60
bungeecordmessaging: false bungeecordmessaging: false
# Sound for message notification # Sound for message notification
# Enter 'None' to disable the sound
message_sound: ENTITY_PLAYER_LEVELUP message_sound: ENTITY_PLAYER_LEVELUP
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online # This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online

View File

@ -100,6 +100,7 @@ unmuteinterval: 60
bungeecordmessaging: false bungeecordmessaging: false
# Sound for message notification # Sound for message notification
# Enter 'None' to disable the sound
message_sound: ENTITY_PLAYER_LEVELUP message_sound: ENTITY_PLAYER_LEVELUP
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online # This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online

View File

@ -902,9 +902,12 @@ public class Format {
public static void playMessageSound(MineverseChatPlayer mcp) { public static void playMessageSound(MineverseChatPlayer mcp) {
Player player = mcp.getPlayer(); Player player = mcp.getPlayer();
Sound messageSound = getSound(getInstance().getConfig().getString("message_sound", DEFAULT_MESSAGE_SOUND)); String soundName = getInstance().getConfig().getString("message_sound", DEFAULT_MESSAGE_SOUND);
if(!soundName.equalsIgnoreCase("None")) {
Sound messageSound = getSound(soundName);
player.playSound(player.getLocation(), messageSound, 1, 0); player.playSound(player.getLocation(), messageSound, 1, 0);
} }
}
private static Sound getSound(String soundName) { private static Sound getSound(String soundName) {
if(Arrays.asList(Sound.values()).stream().map(Sound::toString).collect(Collectors.toList()).contains(soundName)) { if(Arrays.asList(Sound.values()).stream().map(Sound::toString).collect(Collectors.toList()).contains(soundName)) {