Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Effect.java
1 package org.bukkit;
2 
3 import java.util.Map;
4 
5 import com.google.common.collect.Maps;
6 
8 import org.bukkit.potion.Potion;
9 
10 /**
11  * A list of effects that the server is able to send to players.
12  */
13 public enum Effect {
14  /**
15  * An alternate click sound.
16  */
17  CLICK2(1000, Type.SOUND),
18  /**
19  * A click sound.
20  */
21  CLICK1(1001, Type.SOUND),
22  /**
23  * Sound of a bow firing.
24  */
25  BOW_FIRE(1002, Type.SOUND),
26  /**
27  * Sound of a door opening/closing.
28  */
29  DOOR_TOGGLE(1003, Type.SOUND),
30  /**
31  * Sound of fire being extinguished.
32  */
33  EXTINGUISH(1004, Type.SOUND),
34  /**
35  * A song from a record. Needs the record item ID as additional info
36  */
37  RECORD_PLAY(1005, Type.SOUND, Material.class),
38  /**
39  * Sound of ghast shrieking.
40  */
41  GHAST_SHRIEK(1007, Type.SOUND),
42  /**
43  * Sound of ghast firing.
44  */
45  GHAST_SHOOT(1008, Type.SOUND),
46  /**
47  * Sound of blaze firing.
48  */
49  BLAZE_SHOOT(1009, Type.SOUND),
50  /**
51  * Sound of zombies chewing on wooden doors.
52  */
54  /**
55  * Sound of zombies chewing on iron doors.
56  */
58  /**
59  * Sound of zombies destroying a door.
60  */
61  ZOMBIE_DESTROY_DOOR(1012, Type.SOUND),
62  /**
63  * A visual smoke effect. Needs direction as additional info.
64  */
65  SMOKE(2000, Type.VISUAL, BlockFace.class),
66  /**
67  * Sound of a block breaking. Needs block ID as additional info.
68  */
69  STEP_SOUND(2001, Type.SOUND, Material.class),
70  /**
71  * Visual effect of a splash potion breaking. Needs potion data value as
72  * additional info.
73  */
74  POTION_BREAK(2002, Type.VISUAL, Potion.class),
75  /**
76  * An ender eye signal; a visual effect.
77  */
78  ENDER_SIGNAL(2003, Type.VISUAL),
79  /**
80  * The flames seen on a mobspawner; a visual effect.
81  */
82  MOBSPAWNER_FLAMES(2004, Type.VISUAL);
83 
84  private final int id;
85  private final Type type;
86  private final Class<?> data;
87  private static final Map<Integer, Effect> BY_ID = Maps.newHashMap();
88 
89  Effect(int id, Type type) {
90  this(id,type,null);
91  }
92 
93  Effect(int id, Type type, Class<?> data) {
94  this.id = id;
95  this.type = type;
96  this.data = data;
97  }
98 
99  /**
100  * Gets the ID for this effect.
101  *
102  * @return ID of this effect
103  * @deprecated Magic value
104  */
105  @Deprecated
106  public int getId() {
107  return this.id;
108  }
109 
110  /**
111  * @return The type of the effect.
112  */
113  public Type getType() {
114  return this.type;
115  }
116 
117  /**
118  * @return The class which represents data for this effect, or null if
119  * none
120  */
121  public Class<?> getData() {
122  return this.data;
123  }
124 
125  /**
126  * Gets the Effect associated with the given ID.
127  *
128  * @param id ID of the Effect to return
129  * @return Effect with the given ID
130  * @deprecated Magic value
131  */
132  @Deprecated
133  public static Effect getById(int id) {
134  return BY_ID.get(id);
135  }
136 
137  static {
138  for (Effect effect : values()) {
139  BY_ID.put(effect.id, effect);
140  }
141  }
142 
143  /**
144  * Represents the type of an effect.
145  */
146  public enum Type {SOUND, VISUAL}
147 }
Class<?> getData()
Definition: Effect.java:121
static Effect getById(int id)
Definition: Effect.java:133