2012-09-26 23:34:06 +02:00
|
|
|
package org.bukkit.craftbukkit;
|
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
import com.google.common.base.Preconditions;
|
|
|
|
import net.minecraft.server.MinecraftKey;
|
|
|
|
import net.minecraft.server.SoundEffect;
|
2012-09-26 23:34:06 +02:00
|
|
|
|
|
|
|
import org.apache.commons.lang.Validate;
|
|
|
|
import org.bukkit.Sound;
|
|
|
|
|
|
|
|
public class CraftSound {
|
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
public static String getSound(final Sound sound) {
|
|
|
|
Validate.notNull(sound, "Sound cannot be null");
|
2013-09-11 03:00:26 +02:00
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
return sound.name().replace('_', '.').toLowerCase();
|
2012-09-26 23:34:06 +02:00
|
|
|
}
|
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
public static SoundEffect getSoundEffect(String s) {
|
|
|
|
SoundEffect effect = SoundEffect.a.get(new MinecraftKey(s));
|
|
|
|
Preconditions.checkArgument(effect != null, "Sound effect %s does not exist", s);
|
|
|
|
|
|
|
|
return effect;
|
2012-09-26 23:34:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private CraftSound() {}
|
|
|
|
}
|