Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PotionType.java
1 package org.bukkit.potion;
2 
3 public enum PotionType {
4  WATER(0, null, 0),
5  REGEN(1, PotionEffectType.REGENERATION, 2),
6  SPEED(2, PotionEffectType.SPEED, 2),
7  FIRE_RESISTANCE(3, PotionEffectType.FIRE_RESISTANCE, 1),
8  POISON(4, PotionEffectType.POISON, 2),
9  INSTANT_HEAL(5, PotionEffectType.HEAL, 2),
10  NIGHT_VISION(6, PotionEffectType.NIGHT_VISION, 1),
11  WEAKNESS(8, PotionEffectType.WEAKNESS, 1),
12  STRENGTH(9, PotionEffectType.INCREASE_DAMAGE, 2),
13  SLOWNESS(10, PotionEffectType.SLOW, 1),
14  INSTANT_DAMAGE(12, PotionEffectType.HARM, 2),
15  WATER_BREATHING(13, PotionEffectType.WATER_BREATHING, 1),
16  INVISIBILITY(14, PotionEffectType.INVISIBILITY, 1),
17  ;
18 
19  private final int damageValue, maxLevel;
20  private final PotionEffectType effect;
21 
22  PotionType(int damageValue, PotionEffectType effect, int maxLevel) {
23  this.damageValue = damageValue;
24  this.effect = effect;
25  this.maxLevel = maxLevel;
26  }
27 
28  public PotionEffectType getEffectType() {
29  return effect;
30  }
31 
32  /**
33  *
34  * @deprecated Magic value
35  */
36  @Deprecated
37  public int getDamageValue() {
38  return damageValue;
39  }
40 
41  public int getMaxLevel() {
42  return maxLevel;
43  }
44 
45  public boolean isInstant() {
46  return effect == null ? true : effect.isInstant();
47  }
48 
49  /**
50  *
51  * @deprecated Magic value
52  */
53  @Deprecated
54  public static PotionType getByDamageValue(int damage) {
55  for (PotionType type : PotionType.values()) {
56  if (type.damageValue == damage)
57  return type;
58  }
59  return null;
60  }
61 
62  public static PotionType getByEffect(PotionEffectType effectType) {
63  if (effectType == null)
64  return WATER;
65  for (PotionType type : PotionType.values()) {
66  if (effectType.equals(type.effect))
67  return type;
68  }
69  return null;
70  }
71 }
static final PotionEffectType HEAL
static final PotionEffectType WEAKNESS
static final PotionEffectType WATER_BREATHING
static final PotionEffectType NIGHT_VISION
static final PotionEffectType INVISIBILITY
static final PotionEffectType FIRE_RESISTANCE
static final PotionEffectType INCREASE_DAMAGE
static PotionType getByDamageValue(int damage)
Definition: PotionType.java:54
static final PotionEffectType SLOW
static final PotionEffectType SPEED
static final PotionEffectType POISON
static final PotionEffectType HARM
static final PotionEffectType REGENERATION