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


Java PotionEffect.getAmplifier方法代码示例

本文整理汇总了Java中org.bukkit.potion.PotionEffect.getAmplifier方法的典型用法代码示例。如果您正苦于以下问题:Java PotionEffect.getAmplifier方法的具体用法?Java PotionEffect.getAmplifier怎么用?Java PotionEffect.getAmplifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.potion.PotionEffect的用法示例。


在下文中一共展示了PotionEffect.getAmplifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: giveSlow

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public void giveSlow(int durationSeconds, int tier) {
    int highestTier = tier;
    int remaining = 0;
    Player p = getPlayer();
    if (p == null)
        return;
    for (PotionEffect pe : p.getActivePotionEffects()) {
        if (pe.getType().equals(PotionEffectType.SLOW)) {
            remaining = pe.getDuration();
            int temp = pe.getAmplifier();
            if (temp > highestTier)
                highestTier = temp;
        }
    }

    p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, RTicks.seconds(durationSeconds) + (remaining / 2), highestTier), true);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:18,代码来源:PlayerDataRPG.java

示例3: get

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
@Nullable
@Override
protected Number[] get(Event e) {
	ItemStack i = item.getSingle(e);
	if (i == null) {
		return null;
	}
	if (PotionUtils.isPotionItem(i)) {
		PotionMeta meta = (PotionMeta) i.getItemMeta();
		PotionEffect eff = PotionUtils.getEffectByEffectType(meta, effectType.getSingle(e));
		if (eff == null) {
			return null;
		}
		return new Number[]{eff.getAmplifier()};
	}
	return null;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:18,代码来源:SExprItemEffectTypeAmplifier.java

示例4: getPotionEffectLevel

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
/**
 * @param type
 *            Get the level of a specific PotionEffect on a player.
 * @return
 */
public final int getPotionEffectLevel(PotionEffectType type) {
	for (PotionEffect effect : getPlayer().getActivePotionEffects()) {
		if (effect.getType().equals(type)) {
			return effect.getAmplifier();
		}
	}

	return 0;
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:15,代码来源:Behaviour.java

示例5: checkPotionEffect

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
private PotionEffect checkPotionEffect(PotionEffect effect, Node node) throws InvalidXMLException {
    if(effect.getType().equals(PotionEffectType.HEALTH_BOOST) && effect.getAmplifier() < 0) {
        if(effect.getDuration() != Integer.MAX_VALUE) {
            // TODO: enable this check after existing maps are fixed
            // throw new InvalidXMLException("Negative health boost effect must have infinite duration (use max-health instead)", node);
        }
    }
    return effect;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:10,代码来源:GlobalItemParser.java

示例6: getResistanceFactor

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
private static double getResistanceFactor(LivingEntity entity) {
    int amplifier = 0;
    for(PotionEffect effect : entity.getActivePotionEffects()) {
        if(PotionEffectType.DAMAGE_RESISTANCE.equals(effect.getType()) && effect.getAmplifier() > amplifier) {
            amplifier = effect.getAmplifier();
        }
    }
    return 1d - (amplifier / 5d);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:10,代码来源:CombatLogTracker.java

示例7: getBaseMoveSpeed

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
/**
 * Return our base move speed.
 *
 * @param player the player
 * @return players move speed
 */
private double getBaseMoveSpeed(Player player) {
    double baseSpeed = 0.2873;

    for (PotionEffect ef : player.getActivePotionEffects()) {
        if (ef.getType().equals(PotionEffectType.SPEED)) {
            baseSpeed *= 1.0 + 0.2 * ef.getAmplifier() + 1;
        }
    }

    return baseSpeed;
}
 
开发者ID:Vrekt,项目名称:Arc-v2,代码行数:18,代码来源:Speed17.java

示例8: addPotionEffect

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public static void addPotionEffect(Player p, PotionEffect pe) {
	Packet41MobEffect pm = new Packet41MobEffect();
	pm.a = p.getEntityId();
	pm.b = (byte)pe.getType().getId();
	pm.c = (byte)pe.getAmplifier();
	pm.d = (short)pe.getDuration();
	((CraftPlayer) p).getHandle().playerConnection.sendPacket(pm);
	pm = null;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:10,代码来源:Lobby.java

示例9: onPlayerDeath

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
/**
 * Drop player's potion effect on his death
 *
 * @param event Event
 */
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
{
    for (PotionEffect potionEffect : event.getEntity().getActivePotionEffects())
    {
        if (this.blacklist.contains(potionEffect.getType()))
            continue;

        if (PotionType.getByEffect(potionEffect.getType()) == null)
            continue;

        if(potionEffect.getDuration() > 10000)
            continue;

        Potion potion = new Potion(PotionType.getByEffect(potionEffect.getType()), potionEffect.getAmplifier() + 1);
        ItemStack stack = potion.toItemStack(1);

        PotionMeta meta = (PotionMeta) stack.getItemMeta();
        meta.clearCustomEffects();
        meta.addCustomEffect(new PotionEffect(potionEffect.getType(), potionEffect.getDuration(), potionEffect.getAmplifier()), true);

        stack.setItemMeta(meta);

        event.getDrops().add(stack);
        event.getEntity().removePotionEffect(potionEffect.getType());
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:33,代码来源:DropMyEffectsModule.java

示例10: onPotionEffectAdd

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPotionEffectAdd(PotionEffectAddEvent event) {
    LivingEntity entity = event.getEntity();
    if (entity instanceof Player && event.getCause() == PotionEffectAddEvent.EffectCause.BEACON) {
        PotionEffect effect = event.getEffect();
        if (effect.getAmplifier() > 1 && effect.getType().equals(PotionEffectType.INCREASE_DAMAGE)) {
            entity.addPotionEffect(new PotionEffect(effect.getType(), effect.getDuration(), 0, effect.isAmbient()));
            event.setCancelled(true);
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:12,代码来源:BeaconStrengthFixListener.java

示例11: onUnequip

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
/**
 * Method called when a {@link Player} unequips a {@link PvpClass}.
 *
 * @param player
 *            the unequipping {@link Player}
 */
public void onUnequip(Player player) {
    for (PotionEffect effect : passiveEffects) {
        for (PotionEffect active : player.getActivePotionEffects()) {
            if (active.getDuration() > DEFAULT_MAX_DURATION && active.getType().equals(effect.getType()) && active.getAmplifier() == effect.getAmplifier()) {
                player.removePotionEffect(effect.getType());
                break;
            }
        }
    }

    player.sendMessage(ChatColor.RED + name + " has been deactivated.");
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:PvpClass.java

示例12: setRestoreEffect

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public void setRestoreEffect(Player player, PotionEffect effect) {
    boolean shouldCancel = true;
    Collection<PotionEffect> activeList = player.getActivePotionEffects();
    for (PotionEffect active : activeList) {
        if (!active.getType().equals(effect.getType()))
            continue;

        // If the current potion effect has a higher amplifier, ignore this one.
        if (effect.getAmplifier() < active.getAmplifier()) {
            return;
        } else if (effect.getAmplifier() == active.getAmplifier()) {
            // If the current potion effect has a longer duration, ignore this one.
            if (effect.getDuration() < active.getDuration()) {
                return;
            }
        }

        restores.put(player.getUniqueId(), active.getType(), active);
        shouldCancel = false;
        break;
    }

    // Cancel the previous restore.
    player.addPotionEffect(effect, true);
    if (shouldCancel && effect.getDuration() > BardClass.HELD_EFFECT_DURATION_TICKS && effect.getDuration() < BardClass.DEFAULT_MAX_DURATION) {
        restores.remove(player.getUniqueId(), effect.getType());
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:29,代码来源:EffectRestorer.java

示例13: onUnequip

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
/**
 * Method called when a {@link Player} unequips a {@link PvpClass}.
 *
 * @param player
 *            the unequipping {@link Player}
 */
public void onUnequip(Player player) {
    for (PotionEffect effect : passiveEffects) {
        for (PotionEffect active : player.getActivePotionEffects()) {
            if (active.getDuration() > DEFAULT_MAX_DURATION && active.getType().equals(effect.getType()) && active.getAmplifier() == effect.getAmplifier()) {
                player.removePotionEffect(effect.getType());
                break;
            }
        }
    }

    player.sendMessage(ChatColor.RED + name + " has been desactivated.");
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:PvpClass.java

示例14: convert

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

示例15: PotionEffects

import org.bukkit.potion.PotionEffect; //导入方法依赖的package包/类
public PotionEffects(PotionEffect ef){
    this.type = ef.getType().getId();
    this.lv = ef.getAmplifier();
    this.duration = ef.getDuration();
}
 
开发者ID:DevCrafters,项目名称:SaveableSerializing,代码行数:6,代码来源:PotionEffects.java


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