Changed sound playing to effect dispatching, since these seem more like more like encompassing effect than mere sounds.

By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-06-09 22:57:44 -07:00
parent db11d49745
commit e471f45bae
3 changed files with 40 additions and 37 deletions

View File

@ -0,0 +1,25 @@
package org.bukkit;
/**
* A list of effects that the server is able to send to players.
*/
public enum Effect {
BOW_FIRE(1002),
CLICK1(1001),
CLICK2(1000),
DOOR_TOGGLE(1003),
EXTINGUISH(1004),
RECORD_PLAY(1005),
SMOKE(2000),
STEP_SOUND(2001);
private final int id;
Effect(int id) {
this.id = id;
}
public int getId() {
return this.id;
}
}

View File

@ -1,25 +0,0 @@
package org.bukkit;
/**
* A list of sounds that the server is able to send to players.
*/
public enum Sound {
BOW_FIRE(1002),
CLICK1(1001),
CLICK2(1000),
DOOR_SOUND(1003),
EXTINGUISH(1004),
RECORD_PLAY(1005),
SMOKE(2000),
STEP_SOUND(2001);
private final int soundIdentifier;
Sound(int soundIdentifier) {
this.soundIdentifier = soundIdentifier;
}
public int getSoundIdentifier() {
return this.soundIdentifier;
}
}

View File

@ -533,29 +533,32 @@ public interface World {
public List<BlockPopulator> getPopulators();
/**
* Plays a sound to just one player.
* @param player the player to play the sound for
* @param sound the {@link Sound}
* Plays an effect to just one player.
*
* @param player the player to play the effect for
* @param effect the {@link Effect}
* @param data a data bit needed for the RECORD_PLAY, SMOKE, and STEP_SOUND sounds
*/
public void playSound(Player player, Sound sound, int data);
public void playEffect(Player player, Effect effect, int data);
/**
* Plays a sound to all players within a default radius around a given location.
* Plays an effect to all players within a default radius around a given location.
*
* @param location the {@link Location} around which players must be to hear the sound
* @param sound the {@link Sound}
* @param effect the {@link Effect}
* @param data a data bit needed for the RECORD_PLAY, SMOKE, and STEP_SOUND sounds
*/
public void playSound(Location location, Sound sound, int data);
public void playEffect(Location location, Effect effect, int data);
/**
* Plays a sound to all players within a given radius around a location.
* @param location the {@link Location} around which players must be to hear the sound
* @param sound the {@link Sound}
* @param data a data bit needed for the RECORD_PLAY, SMOKE, and STEP_SOUND sounds
* Plays an effect to all players within a given radius around a location.
*
* @param location the {@link Location} around which players must be to hear the effect
* @param effect the {@link Effect}
* @param data a data bit needed for the RECORD_PLAY, SMOKE, and STEP effects
* @param radius the radius around the location
*/
public void playSound(Location location, Sound sound, int data, int radius);
public void playEffect(Location location, Effect effect, int data, int radius);
/**
* Represents various map environment types that a world may be