From b1be43154afca6ef9f3a1bd20b07e4e9ab2ea4f9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 20 Jan 2019 02:23:18 -0800 Subject: [PATCH] Roll & Gracefull Roll have sounds now --- .../nossr50/datatypes/skills/subskills/acrobatics/Roll.java | 5 +++++ .../java/com/gmail/nossr50/util/sounds/SoundManager.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index c65e68c74..ccd2bcc6a 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -19,9 +19,12 @@ import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.PerksUtils; import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillUtils; +import com.gmail.nossr50.util.sounds.SoundManager; +import com.gmail.nossr50.util.sounds.SoundType; import net.md_5.bungee.api.chat.ComponentBuilder; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.SoundCategory; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.Event; @@ -225,6 +228,7 @@ public class Roll extends AcrobaticsSubSkill implements RandomChance { if (!isFatal(player, modifiedDamage) && SkillUtils.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ACROBATICS_ROLL, player, getPrimarySkill(), skillLevel, getActivationChance(mcMMOPlayer))) { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Roll.Text"); + SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS); //player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text")); if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) { @@ -264,6 +268,7 @@ public class Roll extends AcrobaticsSubSkill implements RandomChance { AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL) / 2)) //This effectively makes it so you reach the max chance for success at half the requirements of roll's max chance (which would make graceful roll twice as likely per skill level) { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Ability.Proc"); + SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS,0.5F); SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, true), XPGainReason.PVE); return modifiedDamage; diff --git a/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java b/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java index d64f5a201..227ccac4d 100644 --- a/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java +++ b/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java @@ -23,6 +23,12 @@ public class SoundManager { player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType)); } + public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) + { + float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier)); + player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch); + } + public static void worldSendSound(World world, Location location, SoundType soundType) { world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));