Add Maces skill
This commit is contained in:
Robert Alan Chapton
2024-06-30 15:10:29 -07:00
committed by GitHub
parent 02c732bdf2
commit 971e5da0ad
38 changed files with 688 additions and 288 deletions

View File

@@ -9,21 +9,54 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
public class SoundManager {
public static Sound CRIPPLE_SOUND;
static {
try {
CRIPPLE_SOUND = Sound.valueOf("ITEM_MACE_SMASH_GROUND");
} catch (IllegalArgumentException e) {
CRIPPLE_SOUND = Sound.BLOCK_ANVIL_PLACE;
}
}
/**
* 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))
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(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 static void sendCategorizedSound(Location location, SoundType soundType, SoundCategory soundCategory) {
if (SoundConfig.getInstance().getIsEnabled(soundType)) {
final World world = location.getWorld();
if (world != null) {
world.playSound(location, getSound(soundType), soundCategory,
getVolume(soundType), getPitch(soundType));
}
}
}
public static void sendCategorizedSound(Location location, SoundType soundType, SoundCategory soundCategory,
float pitchModifier) {
if (SoundConfig.getInstance().getIsEnabled(soundType)) {
final World world = location.getWorld();
if (world != null) {
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
world.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
}
}
}
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))
@@ -74,6 +107,7 @@ public class SoundManager {
case DEFLECT_ARROWS, BLEED -> Sound.ENTITY_ENDER_EYE_DEATH;
case GLASS -> Sound.BLOCK_GLASS_BREAK;
case ITEM_CONSUMED -> Sound.ITEM_BOTTLE_EMPTY;
case CRIPPLE -> CRIPPLE_SOUND;
};
}