本文整理汇总了Java中org.bukkit.potion.PotionEffectType.values方法的典型用法代码示例。如果您正苦于以下问题:Java PotionEffectType.values方法的具体用法?Java PotionEffectType.values怎么用?Java PotionEffectType.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.potion.PotionEffectType
的用法示例。
在下文中一共展示了PotionEffectType.values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SpawnItem
import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
SpawnItem(Map<String, Object> items) throws Exception {
super();
this.id = (int) items.get("id");
this.damage = (int) items.get("damage");
this.owner = (String) items.get("owner");
this.displayName = (String) items.get("name");
this.spawnrate = Spawnrate.getSpawnrateFromName((String) items.get("rate"));
for (final PotionEffectType potionEffectType : PotionEffectType.values()) {
if (potionEffectType != null && items.containsKey("potioneffects." + potionEffectType.getId())) {
this.potioneffectList.put(potionEffectType.getId(), new FastPotioneffect(((MemorySection) items.get("potioneffects." + potionEffectType.getId())).getValues(true)));
}
}
}
示例2: onPlayerItemConsume
import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
/**
* Give a random potion effect when a player eat rotten flesh
*
* @param event Event
*/
@EventHandler
public void onPlayerItemConsume(PlayerItemConsumeEvent event)
{
if (event.getItem().getType() == Material.ROTTEN_FLESH)
{
PotionEffectType effectType = PotionEffectType.values()[this.random.nextInt(PotionEffectType.values().length)];
if (effectType != null)
event.getPlayer().addPotionEffect(new PotionEffect(effectType, (int) this.moduleConfiguration.get("effect-time") * 20, 1));
}
}