Java 类org.bukkit.potion.PotionEffectType 实例源码

项目:DoubleRunner    文件:DoubleRunnerGameLoop.java   
@EventHandler
public void onPotionSplash(PotionSplashEvent event)
{
    PotionEffect actual = null;

    for (PotionEffect potionEffect : event.getPotion().getEffects())
    {
        if (potionEffect.getType().getName().equals("POISON"))
        {
            actual = potionEffect;
            break;
        }
    }

    if (actual != null)
    {
        event.setCancelled(true);
        event.getAffectedEntities().forEach(entity -> entity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 8 * 20, 0)));
    }
}
项目:Uranium    文件:CraftMetaPotion.java   
CraftMetaPotion(net.minecraft.nbt.NBTTagCompound tag) {
    super(tag);

    if (tag.hasKey(POTION_EFFECTS.NBT)) {
        net.minecraft.nbt.NBTTagList list = tag.getTagList(POTION_EFFECTS.NBT, 10);
        int length = list.tagCount();
        if (length > 0) {
            customEffects = new ArrayList<PotionEffect>(length);

            for (int i = 0; i < length; i++) {
                net.minecraft.nbt.NBTTagCompound effect = list.getCompoundTagAt(i);
                PotionEffectType type = PotionEffectType.getById(effect.getByte(ID.NBT));
                int amp = effect.getByte(AMPLIFIER.NBT);
                int duration = effect.getInteger(DURATION.NBT);
                boolean ambient = effect.getBoolean(AMBIENT.NBT);
                customEffects.add(new PotionEffect(type, duration, amp, ambient));
            }
        }
    }
}
项目:Uranium    文件:CraftPotionBrewer.java   
public Collection<PotionEffect> getEffectsFromDamage(int damage) {
    if (cache.containsKey(damage))
        return cache.get(damage);

    List<?> mcEffects = net.minecraft.potion.PotionHelper.getPotionEffects(damage, false);
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    if (mcEffects == null)
        return effects;

    for (Object raw : mcEffects) {
        if (raw == null || !(raw instanceof net.minecraft.potion.PotionEffect))
            continue;
        net.minecraft.potion.PotionEffect mcEffect = (net.minecraft.potion.PotionEffect) raw;
        PotionEffect effect = new PotionEffect(PotionEffectType.getById(mcEffect.getPotionID()),
                mcEffect.getDuration(), mcEffect.getAmplifier());
        // Minecraft PotionBrewer applies duration modifiers automatically.
        effects.add(effect);
    }

    cache.put(damage, effects);

    return effects;
}
项目:ZentrelaRPG    文件:PlayerDataRPG.java   
public void equipEffectsTask() {
    RScheduler.schedule(plugin, new Runnable() {
        public void run() {
            if (isValid()) {
                Player p = getPlayer();
                EntityEquipment ee = p.getEquipment();
                if (ee.getHelmet() != null && ItemManager.isItem(ee.getHelmet(), "miner_helmet")) {
                    if (!equipStates.contains("miner_helmet")) {
                        p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, true, false), true);
                        equipStates.add("miner_helmet");
                    }
                } else {
                    if (equipStates.contains("miner_helmet")) {
                        equipStates.remove("miner_helmet");
                        p.removePotionEffect(PotionEffectType.NIGHT_VISION);
                    }
                }
                RScheduler.schedule(plugin, this, RTicks.seconds(1));
            }
        }
    });
}
项目:ZentrelaRPG    文件:PlayerDataRPG.java   
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);
}
项目:ZentrelaRPG    文件:FreezeSpell.java   
public void castSpell(final LivingEntity caster, final MobData md, Player target) {
    ArrayList<Location> locs = RLocation.findCastableLocs(caster.getLocation(), range, count);
    for (Location loc : locs) {
        FreezeSpellEffect effect = new FreezeSpellEffect(EffectFactory.em(), loc.add(0, 0.15, 0), 3);
        effect.setEntity(caster);
        effect.start();
        RScheduler.schedule(Spell.plugin, () -> {
            Entity activator = null;
            for (Entity e : RMath.getNearbyEntities(loc, 1)) {
                if (e instanceof Player && Spell.canDamage(e, false)) {
                    ((Player) e).addPotionEffect(new PotionEffect(PotionEffectType.JUMP, RTicks.seconds(durationSec), -100), false);
                    ((Player) e).addPotionEffect(new PotionEffect(PotionEffectType.SPEED, RTicks.seconds(durationSec), -100), false);
                    activator = e;
                }
            }
            if (activator != null) {
                FreezeSpellEndEffect end = new FreezeSpellEndEffect(EffectFactory.em(), loc, durationSec);
                end.setEntity(activator);
                end.start();
            }
        }, RTicks.seconds(3));
    }
}
项目:VanillaPlus    文件:MinecraftUtils.java   
public static PotionEffect craftPotionEffect(String name, ConfigurationSection section) {
    if(section == null){
        Error.MISSING.add();
        return null;
    }
    PotionEffectType effect = PotionEffectType.getByName(name);
    if( effect == null ) {
        ErrorLogger.addError(name + " is not a valid potion effect type !");
        return null;
    }
    int duration = section.getInt(Node.DURATION.get(), 120)*20;
    int amplifier = section.getInt(Node.LEVEL.get(), 1) - 1;
    boolean ambient = section.getBoolean(Node.AMBIANT.get(), true);
    boolean particles = section.getBoolean(Node.PARTICLE.get(), true);
    return new PotionEffect(effect, duration, amplifier, ambient, particles);
}
项目:SurvivalAPI    文件:NaturalListener.java   
/**
 * Patching witch's potions
 *
 * @param event Event
 */
@EventHandler
public void onPotionSplash(PotionSplashEvent event)
{
    ThrownPotion potion = event.getPotion();

    if (potion.getShooter() instanceof Witch)
    {
        event.setCancelled(true);

        List<PotionEffectType> potionEffects = new ArrayList<>();
        potionEffects.add(PotionEffectType.SLOW_DIGGING);
        potionEffects.add(PotionEffectType.CONFUSION);
        potionEffects.add(PotionEffectType.NIGHT_VISION);
        potionEffects.add(PotionEffectType.HUNGER);
        potionEffects.add(PotionEffectType.BLINDNESS);

        PotionEffect selected = new PotionEffect(potionEffects.get(new Random().nextInt(potionEffects.size())), 20 * 15, 1);

        for (LivingEntity ent : event.getAffectedEntities())
            ent.addPotionEffect(selected);
    }
}
项目:mczone    文件:KitEvents.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    final Gamer g = Gamer.get(event.getPlayer());

    if (g.getVariable("spectator") != null)
        return;

    if (g.getVariable("kit") != Kit.get("tank"))
        return;

    g.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1, 100), true);

    if (g.getPlayer().isSprinting()) {
        new BukkitRunnable() {
            public void run() {
                g.getPlayer().setSprinting(false);
            }
        }.runTaskLater(Nexus.getPlugin(), 1);
    }
}
项目:SurvivalAPI    文件:ConstantPotionModule.java   
@Override
public Map<String, Object> buildFromJson(Map<String, JsonElement> configuration) throws Exception
{
    if (configuration.containsKey("effects"))
    {
        JsonArray potionEffectsJson = configuration.get("effects").getAsJsonArray();

        for (int i = 0; i < potionEffectsJson.size(); i++)
        {
            JsonObject potionEffectJson = potionEffectsJson.get(i).getAsJsonObject();
            this.addPotionEffect(PotionEffectType.getByName(potionEffectJson.get("effect").getAsString()), potionEffectJson.get("level").getAsInt());
        }
    }

    return this.build();
}
项目:SuperiorCraft    文件:HoverBike.java   
public static Pig create(Location l) {
    Pig hov = (Pig) l.getWorld().spawnEntity(l, EntityType.PIG);

    hov.setSaddle(true);
    hov.setCustomName("HoverBike");
    hov.addScoreboardTag("speed:10");
    hov.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 30, true, false));
    hov.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, true, false));
    //hov.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 1, true, false));
    hov.setAI(false);
    hov.setGravity(true);
    hov.setSilent(true);

    hov.setMaxHealth(100);
    hov.setHealth(100);

    return hov;
}
项目:SurvivalPlus    文件:StarBattleaxeWither.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onAttack(EntityDamageByEntityEvent event)
{
    if(event.isCancelled()) return;
    if(event.getDamager() instanceof Player && event.getEntity() instanceof LivingEntity && event.getCause() == DamageCause.ENTITY_ATTACK)
    {
        Player player = (Player)event.getDamager();
        ItemStack mainItem = player.getInventory().getItemInMainHand();
        LivingEntity enemy = (LivingEntity)event.getEntity();

        Random rand = new Random();

        if(mainItem.getType() == Material.GOLD_AXE)
        {
            enemy.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 480, 2, false));
            enemy.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 480, 0, false));
            enemy.getLocation().getWorld().playSound(enemy.getLocation(), Sound.ENTITY_WITHER_SPAWN, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
        }
    }
}
项目:AsgardAscension    文件:CustomEnchantsListener.java   
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) {
    if(event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
        Player damager = (Player) event.getDamager();
        if(damager.getInventory().getItemInMainHand() == null)
            return;
        if(!damager.getInventory().getItemInMainHand().hasItemMeta())
            return;
        if(damager.getInventory().getItemInMainHand().getItemMeta().getLore() == null)
            return;
        Player victim = (Player) event.getEntity();
        if(!Utility.canAttack(damager, victim)) 
            return;
        List<String> lore = damager.getInventory().getItemInMainHand().getItemMeta().getLore();
        if(contains(lore, "Wither Damage")) {
            victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 200, 1));
        }
        if(contains(lore,"Fire Damage")) {
            victim.setFireTicks(100);
        }
        if(contains(lore,"Poison Damage")) {
            victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 200, 0));
        }
    }
}
项目:ProjectAres    文件:XMLUtils.java   
public static PotionEffect parseCompactPotionEffect(Node node, String text) throws InvalidXMLException {
    String[] parts = text.split(":");

    if(parts.length == 0) throw new InvalidXMLException("Missing potion effect", node);
    PotionEffectType type = parsePotionEffectType(node, parts[0]);
    Duration duration = TimeUtils.INF_POSITIVE;
    int amplifier = 0;
    boolean ambient = false;

    if(parts.length >= 2) {
        duration = parseTickDuration(node, parts[1]);
        if(parts.length >= 3) {
            amplifier = parseNumber(node, parts[2], Integer.class);
            if(parts.length >= 4) {
                ambient = parseBoolean(node, parts[3]);
            }
        }
    }

    return createPotionEffect(node, type, duration, amplifier, ambient);
}
项目:DynamicAC    文件:BackendChecks.java   
public void checkAscension(Player player, double y1, double y2) {
    int max = MagicNumbers.ASCENSION_COUNT_MAX;
    if(player.hasPotionEffect(PotionEffectType.JUMP)) {
        max += 12;
    }
    Block block = player.getLocation().getBlock();
    if(!isMovingExempt(player) && !Utilities.isInWater(player) && !player.isFlying() && !Utilities
            .isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle() && !MOVE_UP_BLOCKS
            .contains(player.getLocation().add(0,-1,0).getBlock().getType()) && !MOVE_UP_BLOCKS.contains(player
            .getLocation().add(0,-1.5,0).getBlock().getType())) {
        if(y1 < y2) {
            if(!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid()) {
                incrementOld(player,ascensionCount,max);
                if(ascensionCount.get(player) > max) {
                    for(Player pla : DynamicAC.instance.onlinestaff) {
                        pla.sendMessage(DynamicAC.prefix + player.getName() + " ascended Y Axis too fast!");
                    }
                    DACManager.getUserManager().incrementUser(DACManager.getUserManager().getUser(player.getName
                            ()),"Climbed too fast");
                }
            }
        }
    }
}
项目:mczone    文件:Kit.java   
public static void addEffects(Gamer g) {
    if (Nexus.getRotary().getState() != GameState.PLAYING)
        return;

    if (g.getVariable("spectator") != null)
        return;

    Kit kit = (Kit) g.getVariable("kit");

    if (kit.getName().equals("spy")) {
        g.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 200, 1), true);
    }
    else if (kit.getName().equals("scout")) {
        g.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 400, 1), true);
        g.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 400, 2), true);
    }
    else if (kit.getName().equals("tank")) {
        g.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 400, 2), true);
    }
}
项目:ProjectAres    文件:PotionDamageResolver.java   
@Override
public @Nullable PotionInfo resolveDamage(EntityDamageEvent.DamageCause damageType, Entity victim, @Nullable PhysicalInfo damager) {
    // If potion is already resolved (i.e. as a splash potion), leave it alone
    if(damager instanceof PotionInfo ||
       damager instanceof ProjectileInfo && ((ProjectileInfo) damager).getProjectile() instanceof PotionInfo) {
        return null;
    }

    final PotionEffectType effect;
    switch(damageType) {
        case POISON: effect = PotionEffectType.POISON; break;
        case WITHER: effect = PotionEffectType.WITHER; break;
        case MAGIC: effect = PotionEffectType.HARM; break;
        default: return null;
    }

    return new GenericPotionInfo(effect);
}
项目:ZorahPractice    文件:MatchListener.java   
@EventHandler
public void onEat(PlayerItemConsumeEvent event) {
    Player player = event.getPlayer();
    PracticeProfile profile = ManagerHandler.getPlayerManager().getPlayerProfile(player);

    if (profile.getStatus() != PlayerStatus.PLAYING) {
        return;
    }

    if (!event.getItem().getItemMeta().hasDisplayName()) {
        return;
    }

    if (event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + "Golden Head")) {
        player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 240, 0));
        player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 2));
    }
}
项目:KingdomFactions    文件:Confuse.java   
@Override
public void execute(KingdomFactionsPlayer player) {

    setLocation(player.getPlayer().getTargetBlock((Set<Material>) null, 80).getLocation());

    SpellExecuteEvent event = new SpellExecuteEvent(executeLocation, this, player);
    if (event.isCancelled())
        return;
    playEffect(executeLocation);
    for (Entity e : Utils.getInstance().getNearbyEntities(executeLocation, 3)) {
        if (e instanceof LivingEntity) {
            LivingEntity en = (LivingEntity) e;

            if (e instanceof Player) {
                Player p = (Player) e;
                if (PlayerModule.getInstance().getPlayer(p).isVanished()) continue;
                en.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 5 * 20, 1));
                en.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 5 * 20, 1));
                en.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 5 * 20, 1));
            }
        }
    }

}
项目:Chambers    文件:VillagerManager.java   
/**
 * Spawns a Villager of the given VillagerType at the provided Location
 * 
 * @param type - the Type of the Villager you wish to Spawn
 * @param location - the Location at which you want the Villager to be
 * @return Villager - the Villager that you had set at the provided Location if you wish to use it
 */
public Villager spawnVillager(VillagerType type, Location location) {
    if (!location.getChunk().isLoaded()) {
        location.getChunk().load();
    }
    Villager villager = (Villager) location.getWorld().spawnEntity(location, EntityType.VILLAGER);
    villager.setAdult();
    villager.setAgeLock(true);
    villager.setProfession(Profession.FARMER);
    villager.setRemoveWhenFarAway(false);
    villager.setCustomName(type.getColor() + type.getName());
    villager.setCustomNameVisible(true);
    villager.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, -6, true), true);
    villager.teleport(location, TeleportCause.PLUGIN);
    villager.setHealth(20.0D);
    return villager;
}
项目:SurvivalAPI    文件:GameListener.java   
/**
 * Handle player death
 *
 * @param event Event
 */
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
{
    if (this.game.hasPlayer(event.getEntity()) && !this.game.isSpectator(event.getEntity()))
    {
        try
        {
            this.game.stumpPlayer(event.getEntity().getUniqueId(), false, false);
        }
        catch (GameException e)
        {
            this.game.getPlugin().getLogger().log(Level.SEVERE, "Error stumping player", e);
        }

        event.getDrops().add(new ItemStack(Material.GOLDEN_APPLE));
        event.setDeathMessage("");

        if (event.getEntity().getKiller() != null)
            event.getEntity().getKiller().addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 20 * 20, 1));

        new DeadCorpses(event.getEntity()).spawn(event.getEntity().getLocation());

        if (deathSound)
            GameUtils.broadcastSound(Sound.WITHER_SPAWN);
    }
}
项目:Crescent    文件:CriticalsA.java   
/**
 * @return Whether the hit is a critical hit or not.
 */
private boolean isCritical() {
    final Player player = profile.getPlayer();
    final Behaviour behaviour = profile.getBehaviour();
    return player.getFallDistance() > 0.0 && !behaviour.isOnLadder() && !behaviour.isOnVine()
            && !behaviour.isInWater() && !player.hasPotionEffect(PotionEffectType.BLINDNESS)
            && !player.isInsideVehicle() && !player.isSprinting() && !((Entity) player).isOnGround();
}
项目:CloudNet    文件:MobSelector.java   
@Deprecated
public void unstableEntity(Entity entity)
{
    try
    {
        Class<?> nbt = ReflectionUtil.reflectNMSClazz(".NBTTagCompound");
        Class<?> entityClazz = ReflectionUtil.reflectNMSClazz(".Entity");
        Object object = nbt.newInstance();

        Object nmsEntity = entity.getClass().getMethod("getHandle", new Class[]{}).invoke(entity);
        try
        {
            entityClazz.getMethod("e", nbt).invoke(nmsEntity, object);
        } catch (Exception ex)
        {
            entityClazz.getMethod("save", nbt).invoke(nmsEntity, object);
        }
        object.getClass().getMethod("setInt", String.class, int.class).invoke(object, "NoAI", 1);
        object.getClass().getMethod("setInt", String.class, int.class).invoke(object, "Silent", 1);
        entityClazz.getMethod("f", nbt).invoke(nmsEntity, object);
    } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e)
    {
        e.printStackTrace();
        System.out.println("[CLOUD] Disabling NoAI and Silent support for " + entity.getEntityId());
        ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 100));
    }
}
项目:Warzone    文件:EffectKitNodeParser.java   
private PotionEffect parsePotionEffect(JsonObject jsonObject) {
    PotionEffectType type = PotionEffectType.getByName(Strings.getTechnicalName(jsonObject.get("type").getAsString()));

    int duration = 30;
    int amplifier = 0;
    boolean ambient = true;
    boolean particles = true;
    //Color color = null;

    if (jsonObject.has("duration")) { // Ticks
        duration = jsonObject.get("duration").getAsInt();
    }

    if (jsonObject.has("amplifier")) {
        amplifier = jsonObject.get("amplifier").getAsInt();
    }

    if (jsonObject.has("ambient")) {
        ambient = jsonObject.get("ambient").getAsBoolean();
    }

    if (jsonObject.has("particles")) {
        particles = jsonObject.get("particles").getAsBoolean();
    }

    //if (jsonObject.has("color")) color = Color.jsonObject.get("color")

    return new PotionEffect(type, duration, amplifier, ambient, particles, null);
}
项目:Warzone    文件:InfectionModule.java   
private void refresh(PlayerContext playerContext, MatchTeam matchTeam) {
    Players.reset(playerContext.getPlayer(), true);

    matchTeam.getKits().forEach(kit -> kit.apply(playerContext.getPlayer(), matchTeam));
    playerContext.getPlayer().updateInventory();
    playerContext.getPlayer().teleport(matchTeam.getSpawnPoints().get(0).getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
    playerContext.getPlayer().setGameMode(GameMode.ADVENTURE);
    playerContext.getPlayer().addPotionEffects(Collections.singleton(new PotionEffect(PotionEffectType.JUMP, 10000, 2, true, false)));

}
项目:UHC    文件:HeadEatHandler.java   
@EventHandler
public void onInteract(final PlayerInteractEvent event) {
    if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) return;

    ItemStack item = event.getItem();
    if (item instanceof PlayerheadItemStack) {
        event.setCancelled(true);
        Player player = event.getPlayer();

        //Use the item
        if (item.getAmount() > 1) item.setAmount(item.getAmount() - 1);
        else player.getInventory().remove(item);

        MainConfiguration config = UHC.getInstance().getMainConfig();

        //Give effects & crap
        PlayerheadItemStack playerhead = (PlayerheadItemStack) item;
        boolean golden = playerhead.isGolden();
        player.sendMessage(colour("&aYou ate " + playerhead.getFrom() + "'s playerhead!"));

        int regenDuration = golden ? config.getGoldenHeadRegenerationDuration() : config.getHeadRegenerationDuration();
        int regenAmpf = golden ? config.getGoldenHeadRegenerationAmplifier() : config.getHeadRegenerationAmplifier();
        int absorpDuration = golden ? config.getGoldenHeadAbsorptionDuration() : config.getHeadAbsorptionDuration();
        int absorpAmpf = golden ? config.getGoldenHeadAbsorptionAmplifier() : config.getHeadAbsorptionAmplifier();

        player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, regenDuration, regenAmpf, false, true));
        player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, absorpDuration, absorpAmpf, false, true));
    }
}
项目:Warzone    文件:InfectionModule.java   
public void infect(Player player) {
    player.getWorld().strikeLightningEffect(player.getLocation());

    teamManager.joinTeam(TGM.get().getPlayerManager().getPlayerContext(player), teamManager.getTeamById("infected"));
    if (teamManager.getTeamById("humans").getMembers().size() > 0) player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou have been infected!"));
    player.addPotionEffects(Collections.singleton(new PotionEffect(PotionEffectType.JUMP, 50000, 1, true, false)));
}
项目:SurvivalAPI    文件:DropMyEffectsModule.java   
@Override
public Map<String, Object> buildFromJson(Map<String, JsonElement> configuration) throws Exception
{
    if (configuration.containsKey("blacklist"))
    {
        JsonArray blacklistJson = configuration.get("blacklist").getAsJsonArray();
        blacklistJson.forEach(jsonElement -> this.blacklistPotionEffect(PotionEffectType.getByName(jsonElement.getAsString())));
    }

    return this.build();
}
项目:Warzone    文件:InfectionModule.java   
public void unfreeze(Player player) {
    player.removePotionEffect(PotionEffectType.JUMP);
    player.removePotionEffect(PotionEffectType.SLOW);
    player.removePotionEffect(PotionEffectType.BLINDNESS);

    player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 50000, 1, true, false));
}
项目:Uranium    文件:CraftLivingEntity.java   
public Collection<PotionEffect> getActivePotionEffects() {
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    for (Object raw : getHandle().activePotionsMap.values()) {
        if (!(raw instanceof net.minecraft.potion.PotionEffect))
            continue;
        net.minecraft.potion.PotionEffect handle = (net.minecraft.potion.PotionEffect) raw;
        if (PotionEffectType.getById(handle.getPotionID()) == null) continue; // Cauldron - ignore null types
        effects.add(new PotionEffect(PotionEffectType.getById(handle.getPotionID()), handle.getDuration(), handle.getAmplifier(), handle.getIsAmbient()));
    }
    return effects;
}
项目:SkyWarsReloaded    文件:Game.java   
public void startGame() {
    gameState = GameState.PLAYING;
    if (SkyWarsReloaded.getCfg().bungeeEnabled()) {
        BungeeUtil.sendSignUpdateRequest(this);
    }
    if (SkyWarsReloaded.getCfg().signJoinMode()) {
        SkyWarsReloaded.getGC().updateSign(gameNumber);
    }
    fillChests();
    removeSpawnHousing();
    for (GamePlayer gPlayer: getPlayers()) {
        if (gPlayer.getP() != null) {
            gPlayer.getP().setGameMode(GameMode.SURVIVAL);
            gPlayer.getP().getInventory().remove(SkyWarsReloaded.getCfg().getKitMenuItem());
            gPlayer.getP().getInventory().remove(SkyWarsReloaded.getCfg().getOptionsItem());
            gPlayer.getP().getInventory().remove(SkyWarsReloaded.getCfg().getExitGameItem());
            gPlayer.getP().getOpenInventory().close();
            gPlayer.getP().setHealth(20);
            gPlayer.getP().setFoodLevel(20);
            gPlayer.getP().addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 100, 5));
            if (gPlayer.hasKitSelected()) {
                SkyWarsReloaded.getKC().populateInventory(gPlayer.getP().getInventory(), gPlayer.getSelectedKit());
                SkyWarsReloaded.getKC().givePotionEffects(gPlayer, gPlayer.getSelectedKit());
                gPlayer.setKitSelected(false);
            }
        }
    }
    if (SkyWarsReloaded.getCfg().timeVoteEnabled()) {
        setTime();
    }
    if (SkyWarsReloaded.getCfg().jumpVoteEnabled()) {
        setJump();
    }
    if (SkyWarsReloaded.getCfg().weatherVoteEnabled()) {
        setWeather();
    }
}
项目:mczone    文件:Gamer.java   
public void removePotionEffects() {
    for (PotionEffect effect : getPlayer().getActivePotionEffects()) {
        removePotionEffect(effect.getType());
    }

    Iterator<PotionEffectType> list = effects.iterator();
    while (list.hasNext()) {
        removePotionEffect(list.next());
        list.remove();
    }
}
项目:ZentrelaRPG    文件:StealthManager.java   
public static void giveStealth(Player p, int seconds) {
    invis.add(p);
    for(Player p2 : plugin.getServer().getOnlinePlayers())
        p2.hidePlayer(p);
    p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, RTicks.seconds(seconds), 1, true, false));
    RParticles.showWithOffset(ParticleEffect.SMOKE_LARGE, p.getLocation().add(0, p.getEyeHeight() * 0.7, 0), 1.0, 15);
}
项目:PA    文件:Frenesi.java   
public void play(TOAUser u) {
    if (!canUse(u)) return;
    if (isInCooldown(u, getName())) return;

    u.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 100, 1, true, false));
    u.getPlayer().setWalkSpeed(0.5f);
    plugin.getServer().getScheduler().runTaskLater(plugin, () -> Race.parseRace(getRace().getId()).addEffects(u), 100);
    cool.setOnCooldown(getName());
}
项目:ZentrelaRPG    文件:ShadowAcrobat.java   
@Override
public boolean cast(final Player p, PlayerDataRPG pd, int level) {
    if (!pd.isStealthed()) {
        p.sendMessage(ChatColor.RED + "Shadow Acrobat can only be used while in stealth.");
        return false;
    }
    int durationSeconds = 0;
    switch (level) {
        case 1:
            durationSeconds = 5;
            break;
        case 2:
            durationSeconds = 7;
            break;
        case 3:
            durationSeconds = 9;
            break;
        case 4:
            durationSeconds = 11;
            break;
        case 5:
            durationSeconds = 13;
            break;
    }
    p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, RTicks.seconds(durationSeconds), 4, true, false));
    p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, RTicks.seconds(durationSeconds), 2, true, false));
    Spell.notify(p, "You feel extremely nimble.");
    return true;
}
项目:ZentrelaRPG    文件:WalkingSanctuary.java   
@Override
public boolean cast(final Player p, PlayerDataRPG pd, int level) {
    double multiplier = 2.0;
    switch (level) {
        case 1:
            multiplier = 2.0;
            break;
        case 2:
            multiplier = 2.3;
            break;
        case 3:
            multiplier = 2.6;
            break;
        case 4:
            multiplier = 2.9;
            break;
        case 5:
            multiplier = 3.2;
            break;
    }
    ArrayList<Location> locs = new ArrayList<Location>();
    final Location startLoc = p.getLocation().clone();
    locs.add(startLoc.clone().add(1, 0, 1));
    locs.add(startLoc.clone().add(1, 0, -1));
    locs.add(startLoc.clone().add(-1, 0, 1));
    locs.add(startLoc.clone().add(-1, 0, -1));
    for (Location loc : locs) {
        RParticles.sendLightning(p, loc);
    }
    p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, RTicks.seconds(10), 5, true, false));
    pd.giveBuff(WalkingSanctuary.BUFF_ID, multiplier, 10000);
    Spell.notify(p, "You call upon divine powers.");
    Spell.notifyDelayed(p, "You feel Walking Sanctuary wear off.", 10);
    return true;
}
项目:ZentrelaCore    文件:CustomSkeleton.java   
@Override
public boolean B(Entity entity) {
    boolean r = super.B(entity);
    if (this.getSkeletonType() == EnumSkeletonType.WITHER && entity instanceof EntityLiving) {
        if (entity.getBukkitEntity() instanceof Player) {
            ((Player) (entity.getBukkitEntity())).removePotionEffect(PotionEffectType.WITHER);
        }
    }
    return r;
}
项目:Arcadia-Spigot    文件:DeadEndGame.java   
@Override
public void onPreStart() {
    Location spawnLocation = Utils.parseLocation((String) this.getGameMap().fetchSetting("startPosition"));
    PotionEffect potionEffect = new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 199);
    PotionEffect potionEffect2 = new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2);
    for(Player player : Bukkit.getOnlinePlayers()) {
        if(!this.getAPI().getGameManager().isAlive(player)) continue;
        player.teleport(spawnLocation);
        player.setGameMode(GameMode.ADVENTURE);
        player.addPotionEffect(potionEffect, true);
        player.addPotionEffect(potionEffect2, true);
    }
}
项目:HCFCore    文件:RogueClass.java   
public RogueClass(HCF plugin) {
    super("Rogue", TimeUnit.SECONDS.toMillis(15L));

    this.plugin = plugin;
    this.passiveEffects.add(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 0));
    this.passiveEffects.add(new PotionEffect(PotionEffectType.REGENERATION, Integer.MAX_VALUE, 0));
    this.passiveEffects.add(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2));
}
项目:PetBlocks    文件:CustomRabbit.java   
/**
 * Spawns the entity at the given location
 *
 * @param mLocation location
 */
@Override
public void spawn(Object mLocation) {
    final Location location = (Location) mLocation;
    final LivingEntity entity = (LivingEntity) this.getEntity();
    final net.minecraft.server.v1_9_R1.World mcWorld = ((CraftWorld) location.getWorld()).getHandle();
    this.setPosition(location.getX(), location.getY(), location.getZ());
    mcWorld.addEntity(this, SpawnReason.CUSTOM);
    entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 1));
    entity.setMetadata("keep", this.getKeepField());
    entity.setCustomNameVisible(false);
    entity.setCustomName("PetBlockIdentifier");
}