Examples of Potion


Examples of org.bukkit.potion.Potion

                }
                if (!data3.isBoolean()) {
                    dB.echoError("Cannot apply effect '" + data[0] +"': '" + data[3] + "' is not a valid boolean!");
                    return;
                }
                Potion pot = new Potion(type);
                pot.setLevel(data1.asInt());
                if (!pot.getType().isInstant())
                    pot.setHasExtendedDuration(data2.asBoolean());
                pot.setSplash(data3.asBoolean());
                pot.apply(item.getItemStack());
            }
        }

    }
View Full Code Here

Examples of org.bukkit.potion.Potion

            if (materialName.contains("POTION")) {
                String potionType = materialName.substring(7);

                try {
                    item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
                }
                catch (IllegalArgumentException ex) {
                    reason.add("Invalid Potion_Type: " + potionType);
                }
            }
View Full Code Here

Examples of org.bukkit.potion.Potion

        }
        else {
            player.sendMessage(LocaleLoader.getString("Fishing.Ability.TH.Poison"));

            ThrownPotion thrownPotion = player.getWorld().spawn(fishingCatch.getLocation(), ThrownPotion.class);
            thrownPotion.setItem(new Potion(PotionType.POISON).splash().toItemStack(1));

            fishingCatch.setPassenger(thrownPotion);
        }
    }
View Full Code Here

Examples of org.bukkit.potion.Potion

    if (itemStack == null) return null;
    if (itemStack.getType() != Material.POTION) return null;
   
    List<PotionEffect> ret = new ArrayList<PotionEffect>();
   
    Potion potion = Potion.fromItemStack(itemStack);
    ret.addAll(potion.getEffects());
   
    PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
    if (meta.hasCustomEffects())
    {
      ret.addAll(meta.getCustomEffects());
View Full Code Here

Examples of org.bukkit.potion.Potion

       
        player.getInventory().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
       
        player.getInventory().addItem(new ItemStack(272, 1));
       
        player.getInventory().addItem(new Potion(PotionType.SPEED).toItemStack(1));
             
   
    return true;
  }
View Full Code Here

Examples of org.bukkit.potion.Potion

    newContents[oldContents.length + SLOT_FEET] = copyItem(pInventory.getBoots());

    // SLOT 6: ACTIVE POTION EFFECTS
    if (player.getActivePotionEffects().size() > 0)
    {
      ItemStack potion = new Potion(PotionType.POISON).toItemStack(1);
      ItemMeta meta = potion.getItemMeta();

      List<String> effects = Lists.newLinkedList();
      for (PotionEffect effect : player.getActivePotionEffects())
        effects.add(ChatColor.RESET + "" + ChatColor.GRAY +
View Full Code Here

Examples of org.bukkit.potion.Potion

        if (item.getType() != Material.POTION || item.getDurability() == 0) {
            return;
        }

        Potion potion;

        try {
            potion = Potion.fromItemStack(item);
        } catch (IllegalArgumentException ex) {
            return;
        }

        StringBuilder message = new StringBuilder(50);

        message.append(ChatColor.GRAY);

        if (potion.getType() == null) {
            return;
        }

        if (potion.isSplash()) {
            message.append("Splash ");
        }

        message.append("Potion of ");
        message.append(capitalizeFirstLetter(potion.getType().name(), '_')).append(' ');
        message.append(toRoman(potion.getLevel()));

        CommandSender sender = event.getSender();

        sender.sendMessage(message.toString());

        for (PotionEffect effect : potion.getEffects()) {
            sender.sendMessage(ChatColor.DARK_GRAY + capitalizeFirstLetter(effect.getType().getName(), '_') + ' ' + toTime(effect.getDuration() / 20));
        }
    }
View Full Code Here

Examples of org.bukkit.potion.Potion

  }
 
  public static short guessData(final ThrownPotion p) {
    if (p.getEffects().size() == 1) {
      final PotionEffect e = p.getEffects().iterator().next();
      final Potion d = new Potion(PotionType.getByEffect(e.getType())).splash();
      return d.toDamageValue();
    }
    return 0;
  }
View Full Code Here

Examples of org.spout.vanilla.component.entity.substance.projectile.Potion

  }

  @Override
  public void onInteract(Entity entity, Action action) {
    if (this.isSplash()) {
      Potion item = entity.getWorld().createEntity(entity.getPhysics().getPosition().add(0, 1.6f, 0)).add(Potion.class);
      item.setShooter(entity);
      item.setPotion(this);
      PhysicsComponent physics = item.getOwner().getPhysics();
      physics.activate(1f, new SphereShape(0.3f), false, true);
      entity.getWorld().spawnEntity(item.getOwner());
      physics.impulse(entity.getPhysics().getRotation().getDirection().mul(55)); //TODO: Need real parameters
    }
  }
View Full Code Here

Examples of org.spout.vanilla.component.entity.substance.projectile.Potion

  }

  @Override
  public List<Message> getSpawnMessages(Entity entity, RepositionManager rm) {
    List<Message> messages = new ArrayList<>();
    Potion potion = entity.add(Potion.class);
    messages.add(new EntityObjectMessage(entity, (byte) typeId, potion.getPotion().getData(), rm));
    return messages;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.