Implement API for Sound, and playing the sounds for Worlds and Players. Adds BUKKIT-1430, BUKKIT-1226 and BUKKIT-2019

This commit is contained in:
feildmaster
2012-08-21 17:23:17 -05:00
parent ccc760d629
commit 161ab5edc6
2 changed files with 22 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.Difficulty;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.plugin.messaging.StandardMessenger;
@@ -1161,4 +1162,14 @@ public class CraftWorld implements World {
public void setWaterAnimalSpawnLimit(int limit) {
waterAnimalSpawn = limit;
}
public void playSound(Location loc, Sound sound, float volume, float pitch) {
if (loc == null || sound == null) return;
double x = loc.getX();
double y = loc.getY();
double z = loc.getZ();
getHandle().makeSound(x, y, z, sound.getSound(), volume, pitch);
}
}