本文整理汇总了Java中org.bukkit.potion.PotionEffect.getType方法的典型用法代码示例。如果您正苦于以下问题:Java PotionEffect.getType方法的具体用法?Java PotionEffect.getType怎么用?Java PotionEffect.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.potion.PotionEffect
的用法示例。
在下文中一共展示了PotionEffect.getType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeCustomEffect
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public boolean removeCustomEffect(PotionEffectType type) {
Validate.notNull(type, "Potion effect type must not be null");
if (!hasCustomEffects()) {
return false;
}
boolean changed = false;
Iterator<PotionEffect> iterator = customEffects.iterator();
while (iterator.hasNext()) {
PotionEffect effect = iterator.next();
if (effect.getType() == type) {
iterator.remove();
changed = true;
}
}
return changed;
}
示例2: applyEffect
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public static int applyEffect(VPPlayer player, PotionEffect effect, boolean add) {
List<PotionEffect>current = player.getPotionEffect();
Iterator<PotionEffect>iterator = current.iterator();
while(iterator.hasNext()) {
PotionEffect potionEffect = iterator.next();
if(potionEffect.getType()==effect.getType()){
if(potionEffect.getAmplifier()<effect.getAmplifier()){
iterator.remove();
}else if(potionEffect.getAmplifier() == effect.getAmplifier()){
if(add){
effect = setDuration(effect, (int) (potionEffect.getDuration()+effect.getDuration()));
}else{
if(potionEffect.getDuration()<effect.getDuration())
iterator.remove();
}
}else
return 0;
break;
}
}
current.add(effect);
player.setPotionEffect(current);
return effect.getDuration()/20;
}
示例3: resetPotions
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public void resetPotions() {
final Player bukkit = getBukkit();
for(PotionEffect effect : bukkit.getActivePotionEffects()) {
if(effect.getType() != null) {
bukkit.removePotionEffect(effect.getType());
}
}
}
示例4: playDeathEffect
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
private void playDeathEffect(@Nullable ParticipantState killer) {
playDeathSound(killer);
// negative health boost potions sometimes change max health
for(PotionEffect effect : bukkit.getActivePotionEffects()) {
// Keep speed and NV for visual continuity
if(effect.getType() != null &&
!PotionEffectType.NIGHT_VISION.equals(effect.getType()) &&
!PotionEffectType.SPEED.equals(effect.getType())) {
bukkit.removePotionEffect(effect.getType());
}
}
}
示例5: primaryEffectType
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public static @Nullable PotionEffectType primaryEffectType(ItemStack potion) {
for(PotionEffect effect : effects(potion)) {
return effect.getType();
}
return null;
}
示例6: convert
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
@Override
public PotionEffectType convert(@NotNull PotionEffect potionEffect) {
return potionEffect.getType();
}
示例7: setLevel
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public static PotionEffect setLevel(PotionEffect effect, int level) {
return new PotionEffect(effect.getType(), effect.getDuration(), level-1, effect.isAmbient(),
effect.hasParticles());
}
示例8: setDuration
import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public static PotionEffect setDuration(PotionEffect effect, int duration) {
return new PotionEffect(effect.getType(), duration, effect.getAmplifier(), effect.isAmbient(),
effect.hasParticles());
}