From bff5797a343bd225396f2ec12cd0b2da43d758f2 Mon Sep 17 00:00:00 2001 From: Aust1n46 Date: Thu, 1 Jul 2021 20:23:33 -0400 Subject: [PATCH] Added 'None' option to the message sound. --- src/config.yml | 1 + src/example_config_always_up_to_date!.yml | 1 + src/mineverse/Aust1n46/chat/utilities/Format.java | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/config.yml b/src/config.yml index 8e32d18..88ed9bc 100644 --- a/src/config.yml +++ b/src/config.yml @@ -100,6 +100,7 @@ unmuteinterval: 60 bungeecordmessaging: false # Sound for message notification +# Enter 'None' to disable the sound 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 diff --git a/src/example_config_always_up_to_date!.yml b/src/example_config_always_up_to_date!.yml index 8e32d18..88ed9bc 100644 --- a/src/example_config_always_up_to_date!.yml +++ b/src/example_config_always_up_to_date!.yml @@ -100,6 +100,7 @@ unmuteinterval: 60 bungeecordmessaging: false # Sound for message notification +# Enter 'None' to disable the sound 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 diff --git a/src/mineverse/Aust1n46/chat/utilities/Format.java b/src/mineverse/Aust1n46/chat/utilities/Format.java index e80cf99..2b73015 100644 --- a/src/mineverse/Aust1n46/chat/utilities/Format.java +++ b/src/mineverse/Aust1n46/chat/utilities/Format.java @@ -902,8 +902,11 @@ public class Format { public static void playMessageSound(MineverseChatPlayer mcp) { Player player = mcp.getPlayer(); - Sound messageSound = getSound(getInstance().getConfig().getString("message_sound", DEFAULT_MESSAGE_SOUND)); - player.playSound(player.getLocation(), messageSound, 1, 0); + 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); + } } private static Sound getSound(String soundName) {