当前位置: 首页>>代码示例>>Java>>正文


Java PotionEffect.getType方法代码示例

本文整理汇总了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;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:19,代码来源:CraftMetaPotion.java

示例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;
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:27,代码来源:MinecraftUtils.java

示例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());
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:MatchPlayer.java

示例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());
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:15,代码来源:Alive.java

示例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;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:PotionUtils.java

示例6: convert

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
@Override
public PotionEffectType convert(@NotNull PotionEffect potionEffect) {
	return potionEffect.getType();
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:5,代码来源:ExprPotionEffectType.java

示例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());
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:5,代码来源:MinecraftUtils.java

示例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());
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:5,代码来源:MinecraftUtils.java


注:本文中的org.bukkit.potion.PotionEffect.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。