本文整理匯總了Java中org.bukkit.potion.PotionEffectType.POISON屬性的典型用法代碼示例。如果您正苦於以下問題:Java PotionEffectType.POISON屬性的具體用法?Java PotionEffectType.POISON怎麽用?Java PotionEffectType.POISON使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.potion.PotionEffectType
的用法示例。
在下文中一共展示了PotionEffectType.POISON屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fromPotionData
@NotNull
public static PotionEffect fromPotionData(@NotNull PotionData data) {
PotionEffectType type = data.getType().getEffectType();
if (type == PotionEffectType.HEAL || type == PotionEffectType.HARM) {
return new PotionEffect(type, 1, data.isUpgraded() ? 2 : 1);
} else if (type == PotionEffectType.REGENERATION || type == PotionEffectType.POISON) {
if (data.isExtended()) {
return new PotionEffect(type, 1800, 1);
} else if (data.isUpgraded()) {
return new PotionEffect(type, 440, 2);
} else {
return new PotionEffect(type, 900, 1);
}
} else if (type == PotionEffectType.NIGHT_VISION || type == PotionEffectType.INVISIBILITY
|| type == PotionEffectType.FIRE_RESISTANCE || type == PotionEffectType.WATER_BREATHING) {
return new PotionEffect(type, data.isExtended() ? 9600 : 3600, 1);
} else if (type == PotionEffectType.WEAKNESS || type == PotionEffectType.SLOW) {
return new PotionEffect(type, data.isExtended() ? 4800 : 1800, 1);
} else if (data.isExtended()) {
return new PotionEffect(type, 9600, 1);
} else if (data.isUpgraded()) {
return new PotionEffect(type, 1800, 2);
} else {
return new PotionEffect(type, 3600, 1);
}
}
示例2: resolveDamage
@Override
public @Nullable PotionInfo resolveDamage(EntityDamageEvent.DamageCause damageType, Entity victim, @Nullable PhysicalInfo damager) {
// If potion is already resolved (i.e. as a splash potion), leave it alone
if(damager instanceof PotionInfo ||
damager instanceof ProjectileInfo && ((ProjectileInfo) damager).getProjectile() instanceof PotionInfo) {
return null;
}
final PotionEffectType effect;
switch(damageType) {
case POISON: effect = PotionEffectType.POISON; break;
case WITHER: effect = PotionEffectType.WITHER; break;
case MAGIC: effect = PotionEffectType.HARM; break;
default: return null;
}
return new GenericPotionInfo(effect);
}
示例3: getPotionType
private static PotionEffectType getPotionType(String type) {
switch (type.toLowerCase()) {
case "speed": return PotionEffectType.SPEED;
case "slowness": return PotionEffectType.SLOW;
case "haste": return PotionEffectType.FAST_DIGGING;
case "miningfatique": return PotionEffectType.SLOW_DIGGING;
case "strength": return PotionEffectType.INCREASE_DAMAGE;
case "instanthealth": return PotionEffectType.HEAL;
case "instantdamage": return PotionEffectType.HARM;
case "jumpboost": return PotionEffectType.JUMP;
case "nausea": return PotionEffectType.CONFUSION;
case "regeneration": return PotionEffectType.REGENERATION;
case "resistance": return PotionEffectType.DAMAGE_RESISTANCE;
case "fireresistance": return PotionEffectType.FIRE_RESISTANCE;
case "waterbreathing": return PotionEffectType.WATER_BREATHING;
case "invisibility": return PotionEffectType.INVISIBILITY;
case "blindness": return PotionEffectType.BLINDNESS;
case "nightvision": return PotionEffectType.NIGHT_VISION;
case "hunger": return PotionEffectType.HUNGER;
case "weakness": return PotionEffectType.WEAKNESS;
case "poison": return PotionEffectType.POISON;
case "wither": return PotionEffectType.WITHER;
case "healthboost": return PotionEffectType.HEALTH_BOOST;
case "absorption": return PotionEffectType.ABSORPTION;
case "saturation": return PotionEffectType.SATURATION;
default: return null;
}
}