mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 08:09:39 +01:00
Remove Static Abuse - SoundManager
This commit is contained in:
parent
f0636ef47e
commit
4b1cdbf493
@ -5,7 +5,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -257,7 +256,7 @@ public class Party {
|
||||
if (leader != null) {
|
||||
leader.sendMessage(pluginRef.getLocaleManager().getString("Party.LevelUp", levelsGained, getLevel()));
|
||||
|
||||
SoundManager.sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
|
||||
pluginRef.getSoundManager().sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.GameMode;
|
||||
@ -683,7 +682,7 @@ public class McMMOPlayer {
|
||||
return;
|
||||
}
|
||||
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
||||
|
||||
/*
|
||||
* Check to see if the player unlocked any new skills
|
||||
@ -924,7 +923,7 @@ public class McMMOPlayer {
|
||||
*/
|
||||
if (primarySkillType == PrimarySkillType.WOODCUTTING || primarySkillType == PrimarySkillType.AXES) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
|
||||
//SoundManager.sendSound(player, player.getLocation(), SoundType.TIRED);
|
||||
//pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.TIRED);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -942,7 +941,7 @@ public class McMMOPlayer {
|
||||
pluginRef.getSkillTools().getSuperAbilityOtherPlayerActivationStr(superAbility));
|
||||
|
||||
//Sounds
|
||||
SoundManager.worldSendSound(player.getWorld(), player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC);
|
||||
pluginRef.getSoundManager().worldSendSound(player.getWorld(), player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC);
|
||||
|
||||
int abilityLength = pluginRef.getSkillTools().calculateAbilityLengthPerks(this, primarySkillType, superAbility);
|
||||
|
||||
@ -998,7 +997,7 @@ public class McMMOPlayer {
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigNotifications().isSuperAbilityToolMessage()) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.TOOL_READY);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.TOOL_READY);
|
||||
}
|
||||
|
||||
setToolPreparationMode(tool, true);
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
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;
|
||||
@ -201,7 +200,7 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
if (!isFatal(player, modifiedDamage)
|
||||
&& pluginRef.getRandomChanceTools().isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ACROBATICS_ROLL, player)) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Roll.Text");
|
||||
SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS);
|
||||
pluginRef.getSoundManager().sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS);
|
||||
|
||||
if (!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
|
||||
pluginRef.getSkillTools().applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, true), XPGainReason.PVE);
|
||||
@ -240,7 +239,7 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
if (!isFatal(player, modifiedDamage)
|
||||
&& pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(rcs)) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Ability.Proc");
|
||||
SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS, 0.5F);
|
||||
pluginRef.getSoundManager().sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS, 0.5F);
|
||||
|
||||
if (!pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
|
||||
pluginRef.getSkillTools().applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, true), XPGainReason.PVE);
|
||||
|
@ -368,7 +368,7 @@
|
||||
// return;
|
||||
//
|
||||
// int levelTotal = Misc.getRandom().nextInt(1 + pluginRef.getUserManager().getPlayer(player).getSkillLevel(PrimarySkillType.MINING)) + 1;
|
||||
// SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
||||
// pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
||||
// mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.HOLIDAY, "Holiday.AprilFools.Levelup", StringUtils.getCapitalized(fakeSkillType.toString()), String.valueOf(levelTotal));
|
||||
//// ParticleEffectUtils.fireworkParticleShower(player, ALL_COLORS.get(Misc.getRandom().nextInt(ALL_COLORS.size())));
|
||||
// }
|
||||
|
@ -13,7 +13,6 @@ import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
@ -456,7 +455,7 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
||||
pluginRef.getSoundManager().sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
||||
}
|
||||
|
||||
private Player getPlayerFromFurnace(Block furnaceBlock) {
|
||||
@ -520,7 +519,7 @@ public class BlockListener implements Listener {
|
||||
if (pluginRef.getSkillTools().superAbilityBlockCheck(SuperAbilityType.BERSERK, block.getState())
|
||||
&& pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
pluginRef.getSoundManager().sendSound(player, block.getLocation(), SoundType.POP);
|
||||
} else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && pluginRef.getBlockTools().affectedByBlockCracker(blockState) && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||
blockState.update();
|
||||
@ -528,7 +527,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
} else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && pluginRef.getBlockTools().isLeaves(blockState) && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
pluginRef.getSoundManager().sendSound(player, block.getLocation(), SoundType.POP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.HardcoreManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -455,7 +454,7 @@ public class PlayerListener implements Listener {
|
||||
if (!drop.hasMetadata(MetadataConstants.DROPPED_ITEM_TRACKING_METAKEY) && mcMMOPlayer.inParty() && pluginRef.getItemTools().isSharable(dropStack)) {
|
||||
event.setCancelled(mcMMOPlayer.getParty().getShareHandler().handleItemShare(drop, mcMMOPlayer));
|
||||
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.POP);
|
||||
}
|
||||
|
||||
/*if (player.getInventory().getItemInMainHand().getType() == Material.AIR) {
|
||||
|
@ -43,6 +43,7 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.CombatTools;
|
||||
import com.gmail.nossr50.util.skills.RankTools;
|
||||
import com.gmail.nossr50.util.skills.SkillTools;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||
@ -84,6 +85,7 @@ public class mcMMO extends JavaPlugin {
|
||||
private EventManager eventManager;
|
||||
private UserManager userManager;
|
||||
private ScoreboardManager scoreboardManager;
|
||||
private SoundManager soundManager;
|
||||
|
||||
/* Not-Managers but my naming scheme sucks */
|
||||
private DatabaseManagerFactory databaseManagerFactory;
|
||||
@ -284,6 +286,9 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
//Init MOTD Utils
|
||||
messageOfTheDayUtils = new MessageOfTheDayUtils(this);
|
||||
|
||||
//Init Sound Manager
|
||||
soundManager = new SoundManager(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -821,5 +826,11 @@ public class mcMMO extends JavaPlugin {
|
||||
return messageOfTheDayUtils;
|
||||
}
|
||||
|
||||
public SoundManager getSoundManager() {
|
||||
return soundManager;
|
||||
}
|
||||
|
||||
public ChunkManagerFactory getChunkManagerFactory() {
|
||||
return chunkManagerFactory;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.items.TeleportationWarmup;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -887,7 +886,7 @@ public final class PartyManager {
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
member.sendMessage(pluginRef.getLocaleManager().getString("Party.LevelUp", levelsGained, level));
|
||||
|
||||
SoundManager.sendSound(member, member.getLocation(), SoundType.LEVEL_UP);
|
||||
pluginRef.getSoundManager().sendSound(member, member.getLocation(), SoundType.LEVEL_UP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.skills.BleedContainer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -162,7 +161,7 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
|
||||
if (victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath) {
|
||||
//Play Bleed Sound
|
||||
SoundManager.worldSendSound(target.getWorld(), target.getLocation(), SoundType.BLEED);
|
||||
pluginRef.getSoundManager().worldSendSound(target.getWorld(), target.getLocation(), SoundType.BLEED);
|
||||
|
||||
ParticleEffectUtils.playBleedEffect(target);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.behaviours.FishingBehaviour;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -69,7 +68,7 @@ public class FishingManager extends SkillManager {
|
||||
if (lastWarnedExhaust + (1000) < currentTime) {
|
||||
getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Fishing.Exhausting"));
|
||||
lastWarnedExhaust = currentTime;
|
||||
SoundManager.sendSound(getPlayer(), getPlayer().getLocation(), SoundType.TIRED);
|
||||
pluginRef.getSoundManager().sendSound(getPlayer(), getPlayer().getLocation(), SoundType.TIRED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -41,7 +40,7 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilPlacedSounds()) {
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||
}
|
||||
|
||||
togglePlacedAnvil();
|
||||
@ -160,8 +159,8 @@ public class RepairManager extends SkillManager {
|
||||
//
|
||||
// // BWONG BWONG BWONG
|
||||
// if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilUseSounds()) {
|
||||
// SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||
// SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
||||
// pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||
// pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
||||
// }
|
||||
//
|
||||
// // Repair the item!
|
||||
|
@ -11,7 +11,6 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -48,7 +47,7 @@ public class SalvageManager extends SkillManager {
|
||||
}
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigSalvage().getGeneral().isAnvilPlacedSounds()) {
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||
}
|
||||
|
||||
togglePlacedAnvil();
|
||||
@ -154,7 +153,7 @@ public class SalvageManager extends SkillManager {
|
||||
|
||||
// BWONG BWONG BWONG - CLUNK!
|
||||
if (pluginRef.getConfigManager().getConfigSalvage().getGeneral().isAnvilUseSounds()) {
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
||||
}
|
||||
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Skills.Success");
|
||||
|
@ -16,7 +16,6 @@ import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.*;
|
||||
@ -294,7 +293,7 @@ public class TamingManager extends SkillManager {
|
||||
}
|
||||
|
||||
//Send Sound
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC);
|
||||
|
||||
amountSummoned++;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.skills.unarmed;
|
||||
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
@ -63,7 +62,7 @@ public class Unarmed {
|
||||
event.setCancelled(true);
|
||||
|
||||
if (grabbedItem) {
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.POP);
|
||||
pluginRef.getSoundManager().sendSound(player, player.getLocation(), SoundType.POP);
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.items.ChimaeraWingWarmup;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -121,7 +120,7 @@ public final class ChimaeraWing {
|
||||
mcMMOPlayer.setTeleportCommenceLocation(null);
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigItems().isChimaeraWingSoundEnabled()) {
|
||||
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
|
||||
pluginRef.getSoundManager().sendSound(player, location, SoundType.CHIMAERA_WING);
|
||||
}
|
||||
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass");
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
@ -193,7 +192,7 @@ public class NotificationManager {
|
||||
mcMMOPlayer.getPlayer().spigot().sendMessage(pluginRef.getTextComponentFactory().getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
|
||||
|
||||
//Unlock Sound Effect
|
||||
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
||||
pluginRef.getSoundManager().sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.util.sounds;
|
||||
|
||||
import com.gmail.nossr50.config.hocon.sound.SoundSetting;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -9,29 +10,36 @@ import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SoundManager {
|
||||
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public SoundManager(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a sound to the player
|
||||
*
|
||||
* @param soundType the type of sound
|
||||
*/
|
||||
public static void sendSound(Player player, Location location, SoundType soundType) {
|
||||
public void sendSound(Player player, Location location, SoundType soundType) {
|
||||
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) {
|
||||
public void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) {
|
||||
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) {
|
||||
public void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) {
|
||||
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
||||
}
|
||||
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType) {
|
||||
public void worldSendSound(World world, Location location, SoundType soundType) {
|
||||
if (pluginRef.getConfigManager().getConfigSound().isSoundEnabled(soundType))
|
||||
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
@ -42,12 +50,12 @@ public class SoundManager {
|
||||
* @param soundType target soundtype
|
||||
* @return the volume for this soundtype
|
||||
*/
|
||||
private static float getVolume(SoundType soundType) {
|
||||
private float getVolume(SoundType soundType) {
|
||||
SoundSetting soundSetting = pluginRef.getConfigManager().getConfigSound().getSoundSetting(soundType);
|
||||
return soundSetting.getVolume() * (float) pluginRef.getConfigManager().getConfigSound().getMasterVolume();
|
||||
}
|
||||
|
||||
private static float getPitch(SoundType soundType) {
|
||||
private float getPitch(SoundType soundType) {
|
||||
if (soundType == SoundType.FIZZ)
|
||||
return getFizzPitch();
|
||||
else if (soundType == SoundType.POP)
|
||||
@ -58,7 +66,7 @@ public class SoundManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static Sound getSound(SoundType soundType) {
|
||||
private Sound getSound(SoundType soundType) {
|
||||
switch (soundType) {
|
||||
case ANVIL:
|
||||
return Sound.BLOCK_ANVIL_PLACE;
|
||||
@ -91,11 +99,11 @@ public class SoundManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static float getFizzPitch() {
|
||||
public float getFizzPitch() {
|
||||
return 2.6F + (Misc.getRandom().nextFloat() - Misc.getRandom().nextFloat()) * 0.8F;
|
||||
}
|
||||
|
||||
public static float getPopPitch() {
|
||||
public float getPopPitch() {
|
||||
return ((Misc.getRandom().nextFloat() - Misc.getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user