From 5298472c902cc8259eebd4805fc64df1602957f0 Mon Sep 17 00:00:00 2001 From: Ineusia Date: Sat, 25 Jul 2020 11:10:01 -0500 Subject: [PATCH] Add option to disable other-player ability notifications --- src/main/java/com/gmail/nossr50/config/AdvancedConfig.java | 5 +++++ .../com/gmail/nossr50/datatypes/player/McMMOPlayer.java | 4 +++- .../gmail/nossr50/runnables/skills/AbilityDisableTask.java | 6 ++++-- src/main/resources/advanced.yml | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 16cb6f915..615488646 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -718,6 +718,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { return config.getBoolean("Feedback.Events.XP.SendTitles", true); } + public boolean sendAbilityNotificationToOtherPlayers() + { + return config.getBoolean("Feedback.Events.AbilityActivation.SendNotificationToOtherPlayers", true); + } + /* * JSON Style Settings */ diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 3f469a0b3..7b3504265 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -907,7 +907,9 @@ public class McMMOPlayer { //player.sendMessage(ability.getAbilityOn()); } - SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayer()); + if (AdvancedConfig.getInstance().sendAbilityNotificationToOtherPlayers()) { + SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayer()); + } //Sounds SoundManager.worldSendSound(player.getWorld(), player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC); diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java index 53f05f594..76dd5a401 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.runnables.skills; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; @@ -61,8 +62,9 @@ public class AbilityDisableTask extends BukkitRunnable { NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_OFF, ability.getAbilityOff()); } - - SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff()); + if (AdvancedConfig.getInstance().sendAbilityNotificationToOtherPlayers()) { + SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff()); + } new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR); } diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index 6648a3dc7..211ac13cd 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -24,6 +24,9 @@ Feedback: Events: XP: SendTitles: true + # Send notifications to the chat or actionbar of other nearby players when a user activates an ability + AbilityActivation: + SendNotificationToOtherPlayers: true #The actionbar is the message location right above the health bar ## If you disable the action bar messages, mcMMO will send the message to the chat system instead ActionBarNotifications: