From 1d62f8b1776bc7623d4d02237f1b934b6bb6adc4 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 11 Jan 2019 07:31:17 -0800 Subject: [PATCH] Added some missing config items --- .../gmail/nossr50/config/AdvancedConfig.java | 26 +------------------ .../nossr50/listeners/InteractionManager.java | 11 ++++++++ .../nossr50/util/TextComponentFactory.java | 4 +-- src/main/resources/advanced.yml | 4 +++ 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 53e80f0c3..749d5de88 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -695,31 +695,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { /* Interaction Settings */ public boolean doesNotificationUseActionBar(NotificationType notificationType) { - String key = ""; - - switch(notificationType) - { - case XP_GAIN: - key = "ExperienceGain"; - break; - case LEVEL_UP_MESSAGE: - key = "LevelUp"; - break; - case SUBSKILL_MESSAGE: - key = "SubSkillInteraction"; - break; - case SUBSKILL_UNLOCKED: - key = "SubSkillUnlocked"; - break; - case TOOL: - key = "ToolReady"; - break; - case SUPER_ABILITY: - key = "SuperAbilityInteraction"; - break; - } - - return config.getBoolean("Skills.FeedBack.ActionBarNotifications."+key, true); + return config.getBoolean("Skills.FeedBack.ActionBarNotifications."+notificationType.toString(), true); } /* diff --git a/src/main/java/com/gmail/nossr50/listeners/InteractionManager.java b/src/main/java/com/gmail/nossr50/listeners/InteractionManager.java index 8bd48ffa1..b72dc2bab 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InteractionManager.java +++ b/src/main/java/com/gmail/nossr50/listeners/InteractionManager.java @@ -4,6 +4,7 @@ import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkill; +import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.Interaction; @@ -172,6 +173,16 @@ public class InteractionManager { return subSkillList; } + public static boolean hasSubSkill(String name) + { + return getAbstractByName(name) != null; + } + + public static boolean hasSubSkill(SubSkillType subSkillType) + { + return hasSubSkill(subSkillType.getNiceNameNoSpaces(subSkillType)); + } + /** * Returns the associative map which contains all registered interactions * @return the interact register diff --git a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java index af53a244c..963509d1e 100644 --- a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java +++ b/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java @@ -580,8 +580,8 @@ public class TextComponentFactory { { if(Permissions.isSubSkillEnabled(player, subSkillType)) { - if(InteractionManager.getInteractRegister().get(subSkillType.getNiceNameNoSpaces(subSkillType)) == null) - textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, subSkillType)); + if(!InteractionManager.hasSubSkill(subSkillType)) + textComponents.add(TextComponentFactory.getSubSkillTextComponent(player, subSkillType)); } } } diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index 0661df55f..a7e097971 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -17,11 +17,15 @@ Skills: Feedback: # Turning these to false will have them printed in chat instead ActionBarNotifications: + AbilityOff: true + LevelRequirementNotMet: true + AbilityCoolDown: true LevelUps: true ToolReady: true SubSkillInteraction: true SubSkillUnlocked: true SuperAbilityInteraction: true + SuperAbilityAlertOthers: true ExperienceGain: true General: Ability: