本文整理汇总了Java中org.bukkit.potion.PotionType.values方法的典型用法代码示例。如果您正苦于以下问题:Java PotionType.values方法的具体用法?Java PotionType.values怎么用?Java PotionType.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.potion.PotionType
的用法示例。
在下文中一共展示了PotionType.values方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findPotion
import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
private PotionType findPotion(String token){
token = token.replaceAll("[(potion|instant)_ ]", "").toLowerCase();
for(PotionType o: PotionType.values())
if(o.name().replaceAll("[(POTION|INSTANT)_ ]", "").equalsIgnoreCase(token))
return o;
return null;
}
示例2: getPotionType
import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
public static PotionType getPotionType(String name) {
if (name != null) {
for (PotionType potionType : PotionType.values()) {
if (potionType != null && potionType.name().equals(name)) return potionType;
}
switch (name) {
case "FATIGUE":
return PotionType.WEAKNESS;
case "HARM":
case "HARMING":
case "DAMAGE":
return PotionType.INSTANT_DAMAGE;
case "HEAL":
case "HEALTH":
case "HEALING":
return PotionType.INSTANT_HEAL;
case "LEAP":
case "LEAPING":
return PotionType.JUMP;
case "REGENERATION":
return PotionType.REGEN;
case "SLOW":
return PotionType.SLOWNESS;
}
}
return null;
}
示例3: getType
import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
private PotionType getType(String substring) {
if(substring.equals("BREAT")) return PotionType.WATER_BREATHING;//例外
else if(substring.equals("HEAL")) return PotionType.INSTANT_HEAL;
else if(substring.equals("DAMAG")) return PotionType.INSTANT_HEAL;
else{ //後ろ切れてるかも
for(PotionType p : PotionType.values()) {
if(p.toString().startsWith(substring)) return p;
}
}
return null;
}