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
|
|
|
/**
|
2016-04-06 12:27:20 +01:00
|
|
|
* Sound of a door opening.
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
DOOR_TOGGLE(1006, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a door opening.
|
|
|
|
*/
|
|
|
|
IRON_DOOR_TOGGLE(1005, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a trapdoor opening.
|
|
|
|
*/
|
|
|
|
TRAPDOOR_TOGGLE(1007, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a door opening.
|
|
|
|
*/
|
|
|
|
IRON_TRAPDOOR_TOGGLE(1037, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a door opening.
|
|
|
|
*/
|
|
|
|
FENCE_GATE_TOGGLE(1008, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a door closing.
|
|
|
|
*/
|
|
|
|
DOOR_CLOSE(1012, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a door closing.
|
|
|
|
*/
|
|
|
|
IRON_DOOR_CLOSE(1011, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a trapdoor closing.
|
|
|
|
*/
|
|
|
|
TRAPDOOR_CLOSE(1013, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a door closing.
|
|
|
|
*/
|
|
|
|
IRON_TRAPDOOR_CLOSE(1036, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a door closing.
|
|
|
|
*/
|
|
|
|
FENCE_GATE_CLOSE(1014, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of fire being extinguished.
|
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
EXTINGUISH(1009, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* A song from a record. Needs the record item ID as additional info
|
|
|
|
*/
|
2016-03-02 23:45:26 +00:00
|
|
|
RECORD_PLAY(1010, Type.SOUND, Material.class),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of ghast shrieking.
|
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
GHAST_SHRIEK(1015, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of ghast firing.
|
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
GHAST_SHOOT(1016, Type.SOUND),
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Sound of blaze firing.
|
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
BLAZE_SHOOT(1018, Type.SOUND),
|
2012-03-03 02:21:57 +00:00
|
|
|
/**
|
|
|
|
* Sound of zombies chewing on wooden doors.
|
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
ZOMBIE_CHEW_WOODEN_DOOR(1019, Type.SOUND),
|
2012-03-03 02:21:57 +00:00
|
|
|
/**
|
2012-03-03 02:26:13 +00:00
|
|
|
* Sound of zombies chewing on iron doors.
|
2012-03-03 02:21:57 +00:00
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
ZOMBIE_CHEW_IRON_DOOR(1020, Type.SOUND),
|
2012-03-03 02:21:57 +00:00
|
|
|
/**
|
|
|
|
* Sound of zombies destroying a door.
|
|
|
|
*/
|
2016-03-03 17:03:42 +11:00
|
|
|
ZOMBIE_DESTROY_DOOR(1021, 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
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* Visual effect of a splash potion breaking. Needs potion data value as
|
|
|
|
* additional info.
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
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.
|
|
|
|
*/
|
2016-04-06 12:27:20 +01:00
|
|
|
MOBSPAWNER_FLAMES(2004, Type.VISUAL),
|
|
|
|
/**
|
|
|
|
* The sound played by brewing stands when brewing
|
|
|
|
*/
|
|
|
|
BREWING_STAND_BREW(1035, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when a chorus flower grows
|
|
|
|
*/
|
|
|
|
CHORUS_FLOWER_GROW(1033, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when a chorus flower dies
|
|
|
|
*/
|
|
|
|
CHORUS_FLOWER_DEATH(1034, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when traveling through a portal
|
|
|
|
*/
|
|
|
|
PORTAL_TRAVEL(1032, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when launching an endereye
|
|
|
|
*/
|
|
|
|
ENDEREYE_LAUNCH(1003, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when launching a firework
|
|
|
|
*/
|
|
|
|
FIREWORK_SHOOT(1004, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Particles displayed when a villager grows a plant, data
|
|
|
|
* is the number of particles
|
|
|
|
*/
|
|
|
|
VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class),
|
|
|
|
/**
|
|
|
|
* The sound/particles used by the enderdragon's breath
|
|
|
|
* attack.
|
|
|
|
*/
|
|
|
|
DRAGON_BREATH(2006, Type.VISUAL),
|
|
|
|
/**
|
|
|
|
* The sound played when an anvil breaks
|
|
|
|
*/
|
|
|
|
ANVIL_BREAK(1029, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when an anvil is used
|
|
|
|
*/
|
|
|
|
ANVIL_USE(1030, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when an anvil lands after
|
|
|
|
* falling
|
|
|
|
*/
|
|
|
|
ANVIL_LAND(1031, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of an enderdragon firing
|
|
|
|
*/
|
|
|
|
ENDERDRAGON_SHOOT(1017, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when a wither breaks a block
|
|
|
|
*/
|
|
|
|
WITHER_BREAK_BLOCK(1022, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound of a wither shooting
|
|
|
|
*/
|
|
|
|
WITHER_SHOOT(1024, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when a zombie infects a target
|
|
|
|
*/
|
|
|
|
ZOMBIE_INFECT(1026, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound played when a villager is converted by
|
|
|
|
* a zombie
|
|
|
|
*/
|
|
|
|
ZOMBIE_CONVERTED_VILLAGER(1027, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* Sound played by a bat taking off
|
|
|
|
*/
|
|
|
|
BAT_TAKEOFF(1025, Type.SOUND),
|
|
|
|
/**
|
|
|
|
* The sound/particles caused by a end gateway spawning
|
|
|
|
*/
|
|
|
|
END_GATEWAY_SPAWN(3000, Type.VISUAL),
|
|
|
|
/**
|
|
|
|
* The sound of an enderdragon growling
|
|
|
|
*/
|
|
|
|
ENDERDRAGON_GROWL(3001, Type.SOUND),
|
|
|
|
;
|
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) {
|
2017-08-06 09:08:05 +10:00
|
|
|
this(id, type, null);
|
2012-02-26 12:53:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* @return The class which represents data for this effect, or null if
|
|
|
|
* none
|
2012-02-26 12:53:31 -05:00
|
|
|
*/
|
|
|
|
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
|
|
|
}
|