本文整理匯總了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));
}
}