From 5a48b568ef8565c7657b487e202649c7661b057f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 16 Jun 2019 06:46:25 -0700 Subject: [PATCH] Fix sounds being disabled by default --- .../ConfigPlayerNotifications.java | 1 + .../config/hocon/sound/SoundSetting.java | 2 ++ .../nossr50/datatypes/player/McMMOPlayer.java | 3 --- .../runnables/skills/AbilityDisableTask.java | 6 +----- .../util/skills/ParticleEffectUtils.java | 18 ------------------ .../gmail/nossr50/util/skills/SkillUtils.java | 8 +++++--- 6 files changed, 9 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/hocon/notifications/ConfigPlayerNotifications.java b/src/main/java/com/gmail/nossr50/config/hocon/notifications/ConfigPlayerNotifications.java index 9553bbc1c..103c844a9 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/notifications/ConfigPlayerNotifications.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/notifications/ConfigPlayerNotifications.java @@ -15,6 +15,7 @@ public class ConfigPlayerNotifications { NOTIFICATION_MAP_DEFAULT = new HashMap<>(); NOTIFICATION_MAP_DEFAULT.put(NotificationType.ABILITY_OFF, new PlayerNotificationSettings(true, false, true)); + NOTIFICATION_MAP_DEFAULT.put(NotificationType.ABILITY_REFRESHED, new PlayerNotificationSettings(true, false, true)); NOTIFICATION_MAP_DEFAULT.put(NotificationType.HARDCORE_MODE, new PlayerNotificationSettings(true, true, true)); NOTIFICATION_MAP_DEFAULT.put(NotificationType.REQUIREMENTS_NOT_MET, new PlayerNotificationSettings(true, false, true)); NOTIFICATION_MAP_DEFAULT.put(NotificationType.ABILITY_COOLDOWN, new PlayerNotificationSettings(true, false, true)); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/sound/SoundSetting.java b/src/main/java/com/gmail/nossr50/config/hocon/sound/SoundSetting.java index 9abae9915..ffa5054a1 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/sound/SoundSetting.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/sound/SoundSetting.java @@ -24,11 +24,13 @@ public class SoundSetting { } public SoundSetting(double volume, double pitch) { + this.enabled = true; this.volume = (float) volume; this.pitch = (float) pitch; } public SoundSetting(double volume) { + this.enabled = true; this.volume = (float) volume; this.pitch = 1.0F; } 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 7487763f3..f663655a0 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -842,9 +842,6 @@ public class McMMOPlayer { return; } - // Notify people that ability has been activated - ParticleEffectUtils.playAbilityEnabledEffect(player); - if (useChatNotifications()) { mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.SUPER_ABILITY, ability.getAbilityOn()); //player.sendMessage(ability.getAbilityOn()); 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 cadbfb3c3..0e254e55a 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -39,9 +39,7 @@ public class AbilityDisableTask extends BukkitRunnable { // Fallthrough case BERSERK: - if (MainConfig.getInstance().getRefreshChunksEnabled()) { - resendChunkRadiusAt(player); - } + resendChunkRadiusAt(player); // Fallthrough default: @@ -53,8 +51,6 @@ public class AbilityDisableTask extends BukkitRunnable { mcMMOPlayer.setAbilityMode(ability, false); mcMMOPlayer.setAbilityInformed(ability, false); - ParticleEffectUtils.playAbilityDisabledEffect(player); - if (mcMMOPlayer.useChatNotifications()) { //player.sendMessage(ability.getAbilityOff()); mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_OFF, ability.getAbilityOff()); diff --git a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java index 574a1cef1..1ea153b33 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java @@ -73,24 +73,6 @@ public final class ParticleEffectUtils { livingEntity.getWorld().playEffect(livingEntity.getEyeLocation(), Effect.MOBSPAWNER_FLAMES, 1); } - public static void playAbilityEnabledEffect(Player player) { - if (!MainConfig.getInstance().getAbilityActivationEffectEnabled()) { - } - - /* if (hasHeadRoom(player)) { - fireworkParticleShower(player, Color.GREEN); - }*/ - } - - public static void playAbilityDisabledEffect(Player player) { - if (!MainConfig.getInstance().getAbilityDeactivationEffectEnabled()) { - } - - /*if (hasHeadRoom(player)) { - fireworkParticleShower(player, Color.RED); - }*/ - } - /* public static void fireworkParticleShower(Player player, Color color) { Location location = player.getLocation(); location.setY(location.getY() + (player.isInsideVehicle() ? 1.0 : -1.0)); diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index 6c286bddb..42361cf9e 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -31,6 +31,8 @@ import java.util.List; public class SkillUtils { + public static final int ENCHANT_SPEED_VAR = 5; + public static void applyXpGain(McMMOPlayer mcMMOPlayer, PrimarySkillType skill, float xp, XPGainReason xpGainReason) { mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, XPGainSource.SELF); } @@ -162,7 +164,7 @@ public class SkillUtils { } itemLore.add("mcMMO Ability Tool"); - itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel + AdvancedConfig.getInstance().getEnchantBuff(), true); + itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel + ENCHANT_SPEED_VAR, true); itemMeta.setLore(itemLore); heldItem.setItemMeta(itemMeta); @@ -227,10 +229,10 @@ public class SkillUtils { if (itemLore.remove("mcMMO Ability Tool")) { int efficiencyLevel = item.getEnchantmentLevel(Enchantment.DIG_SPEED); - if (efficiencyLevel <= AdvancedConfig.getInstance().getEnchantBuff()) { + if (efficiencyLevel <= ENCHANT_SPEED_VAR) { itemMeta.removeEnchant(Enchantment.DIG_SPEED); } else { - itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel - AdvancedConfig.getInstance().getEnchantBuff(), true); + itemMeta.addEnchant(Enchantment.DIG_SPEED, efficiencyLevel - ENCHANT_SPEED_VAR, true); } itemMeta.setLore(itemLore);