@ -1,12 +1,16 @@
|
||||
package org.bukkit;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* A list of effects that the server is able to send to players.
|
||||
*/
|
||||
public enum Effect {
|
||||
BOW_FIRE(1002),
|
||||
CLICK1(1001),
|
||||
CLICK2(1000),
|
||||
CLICK1(1001),
|
||||
BOW_FIRE(1002),
|
||||
DOOR_TOGGLE(1003),
|
||||
EXTINGUISH(1004),
|
||||
RECORD_PLAY(1005),
|
||||
@ -20,12 +24,34 @@ public enum Effect {
|
||||
MOBSPAWNER_FLAMES(2004);
|
||||
|
||||
private final int id;
|
||||
private static final Map<Integer, Effect> BY_ID = Maps.newHashMap();
|
||||
|
||||
Effect(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID for this effect.
|
||||
*
|
||||
* @return ID of this effect
|
||||
*/
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user