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:13:30 -05:00
|
|
|
/**
|
|
|
|
* An alternate click sound.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
CLICK2(1000, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* A click sound.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
CLICK1(1001, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of a bow firing.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
BOW_FIRE(1002, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of a door opening/closing.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
DOOR_TOGGLE(1003, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of fire being extinguished.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
EXTINGUISH(1004, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* A song from a record. Needs the record item ID as additional info
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
RECORD_PLAY(1005, Type.SOUND, Material.class),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of ghast shrieking.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
GHAST_SHRIEK(1007, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of ghast firing.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
GHAST_SHOOT(1008, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of blaze firing.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
BLAZE_SHOOT(1009, Type.SOUND),
|
2012-03-03 02:21:57 +00:00
|
|
|
/**
|
|
|
|
* Sound of zombies chewing on wooden doors.
|
|
|
|
*/
|
|
|
|
ZOMBIE_CHEW_WOODEN_DOOR(1010, Type.SOUND),
|
|
|
|
/**
|
2012-03-03 02:26:13 +00:00
|
|
|
* Sound of zombies chewing on iron doors.
|
2012-03-03 02:21:57 +00:00
|
|
|
*/
|
|
|
|
ZOMBIE_CHEW_IRON_DOOR(1011, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of zombies destroying a door.
|
|
|
|
*/
|
|
|
|
ZOMBIE_DESTROY_DOOR(1012, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* A visual smoke effect. Needs direction as additional info.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
SMOKE(2000, Type.VISUAL, BlockFace.class),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
2012-06-03 05:40:54 -05:00
|
|
|
* Sound of a block breaking. Needs block ID as additional info.
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
STEP_SOUND(2001, Type.SOUND, Material.class),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Visual effect of a splash potion breaking. Needs potion data value as additional info.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
POTION_BREAK(2002, Type.VISUAL, Potion.class),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* An ender eye signal; a visual effect.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
ENDER_SIGNAL(2003, Type.VISUAL),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* The flames seen on a mobspawner; a visual effect.
|
|
|
|
*/
|
2012-02-26 12:53:31 -05:00
|
|
|
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
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2012-01-29 11:10:40 +01:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
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
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2012-01-29 11:10:40 +01:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2012-01-29 11:10:40 +01:00
|
|
|
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
|
|
|
}
|