2011-06-09 22:57:44 -07:00
|
|
|
package org.bukkit;
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
2012-02-26 12:53:31 -05:00
|
|
|
import org.bukkit.block.BlockFace;
|
|
|
|
import org.bukkit.potion.Potion;
|
|
|
|
|
2011-06-09 22:57:44 -07:00
|
|
|
/**
|
|
|
|
* A list of effects that the server is able to send to players.
|
|
|
|
*/
|
|
|
|
public enum Effect {
|
2012-02-26 12:53:31 -05:00
|
|
|
CLICK2(1000, Type.SOUND),
|
|
|
|
CLICK1(1001, Type.SOUND),
|
|
|
|
BOW_FIRE(1002, Type.SOUND),
|
|
|
|
DOOR_TOGGLE(1003, Type.SOUND),
|
|
|
|
EXTINGUISH(1004, Type.SOUND),
|
|
|
|
RECORD_PLAY(1005, Type.SOUND, Material.class),
|
|
|
|
GHAST_SHRIEK(1007, Type.SOUND),
|
|
|
|
GHAST_SHOOT(1008, Type.SOUND),
|
|
|
|
BLAZE_SHOOT(1009, Type.SOUND),
|
|
|
|
SMOKE(2000, Type.VISUAL, BlockFace.class),
|
|
|
|
STEP_SOUND(2001, Type.SOUND, Material.class),
|
|
|
|
POTION_BREAK(2002, Type.VISUAL, Potion.class),
|
|
|
|
ENDER_SIGNAL(2003, Type.VISUAL),
|
|
|
|
MOBSPAWNER_FLAMES(2004, Type.VISUAL);
|
2011-06-09 22:57:44 -07:00
|
|
|
|
|
|
|
private final int id;
|
2012-02-26 12:53:31 -05:00
|
|
|
private final Type type;
|
|
|
|
private final Class<?> data;
|
2012-01-29 11:10:40 +01:00
|
|
|
private static final Map<Integer, Effect> BY_ID = Maps.newHashMap();
|
2011-06-09 22:57:44 -07:00
|
|
|
|
2012-02-26 12:53:31 -05:00
|
|
|
Effect(int id, Type type) {
|
|
|
|
this(id,type,null);
|
|
|
|
}
|
|
|
|
|
|
|
|
Effect(int id, Type type, Class<?> data) {
|
2011-06-09 22:57:44 -07:00
|
|
|
this.id = id;
|
2012-02-26 12:53:31 -05:00
|
|
|
this.type = type;
|
|
|
|
this.data = data;
|
2011-06-09 22:57:44 -07:00
|
|
|
}
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
/**
|
|
|
|
* Gets the ID for this effect.
|
|
|
|
*
|
|
|
|
* @return ID of this effect
|
|
|
|
*/
|
2011-06-09 22:57:44 -07:00
|
|
|
public int getId() {
|
|
|
|
return this.id;
|
|
|
|
}
|
2012-01-29 11:10:40 +01:00
|
|
|
|
2012-02-26 12:53:31 -05:00
|
|
|
/**
|
|
|
|
* @return The type of the effect.
|
|
|
|
*/
|
|
|
|
public Type getType() {
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The class which represents data for this effect, or null if none
|
|
|
|
*/
|
|
|
|
public Class<?> getData() {
|
|
|
|
return this.data;
|
|
|
|
}
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
/**
|
|
|
|
* Gets the Effect associated with the given ID.
|
|
|
|
*
|
|
|
|
* @param id ID of the Effect to return
|
|
|
|
* @return Effect with the given ID
|
|
|
|
*/
|
|
|
|
public static Effect getById(int id) {
|
|
|
|
return BY_ID.get(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
|
|
|
for (Effect effect : values()) {
|
|
|
|
BY_ID.put(effect.id, effect);
|
|
|
|
}
|
|
|
|
}
|
2012-02-26 12:53:31 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents the type of an effect.
|
|
|
|
*/
|
|
|
|
public enum Type {SOUND, VISUAL}
|
2011-06-09 22:57:44 -07:00
|
|
|
}
|