mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-03 04:55:28 +02:00
Update code style
This commit is contained in:
@@ -11,47 +11,43 @@ import org.bukkit.entity.Player;
|
||||
public class SoundManager {
|
||||
/**
|
||||
* Sends a sound to the player
|
||||
*
|
||||
* @param soundType the type of sound
|
||||
*/
|
||||
public static void sendSound(Player player, Location location, SoundType soundType)
|
||||
{
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
public static void sendSound(Player player, Location location, SoundType soundType) {
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory)
|
||||
{
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) {
|
||||
if (SoundConfig.getInstance().getIsEnabled(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 static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) {
|
||||
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
||||
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
||||
}
|
||||
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType)
|
||||
{
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType) {
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
/**
|
||||
* All volume is multiplied by the master volume to get its final value
|
||||
*
|
||||
* @param soundType target soundtype
|
||||
* @return the volume for this soundtype
|
||||
*/
|
||||
private static float getVolume(SoundType soundType)
|
||||
{
|
||||
private static float getVolume(SoundType soundType) {
|
||||
return SoundConfig.getInstance().getVolume(soundType) * SoundConfig.getInstance().getMasterVolume();
|
||||
}
|
||||
|
||||
private static float getPitch(SoundType soundType)
|
||||
{
|
||||
if(soundType == SoundType.FIZZ)
|
||||
private static float getPitch(SoundType soundType) {
|
||||
if (soundType == SoundType.FIZZ)
|
||||
return getFizzPitch();
|
||||
else if (soundType == SoundType.POP)
|
||||
return getPopPitch();
|
||||
@@ -59,10 +55,8 @@ public class SoundManager {
|
||||
return SoundConfig.getInstance().getPitch(soundType);
|
||||
}
|
||||
|
||||
private static Sound getSound(SoundType soundType)
|
||||
{
|
||||
switch(soundType)
|
||||
{
|
||||
private static Sound getSound(SoundType soundType) {
|
||||
switch (soundType) {
|
||||
case ANVIL:
|
||||
return Sound.BLOCK_ANVIL_PLACE;
|
||||
case ITEM_BREAK:
|
||||
|
@@ -16,9 +16,8 @@ public enum SoundType {
|
||||
BLEED,
|
||||
TIRED;
|
||||
|
||||
public boolean usesCustomPitch()
|
||||
{
|
||||
switch(this){
|
||||
public boolean usesCustomPitch() {
|
||||
switch (this) {
|
||||
case POP:
|
||||
case FIZZ:
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user