Package org.bukkit.potion

Examples of org.bukkit.potion.Potion


        // World record winning stupidest necessary workaround for a Bukkit issue
        if ((item.getItemStack().getDurability() & 0x40) != 0
                && PotionType.getByDamageValue(item.getItemStack().getDurability() & 0xF).isInstant()) {
            item.getItemStack().setDurability((short)(item.getItemStack().getDurability() & ~0x40));
        }
        Potion pot = Potion.fromItemStack(item.getItemStack());
        if (pot == null || pot.getType() == null)
            return String.valueOf(item.getItemStack().getDurability());
        return pot.getType().name() + "," + pot.getLevel() + "," + pot.hasExtendedDuration() + "," + pot.isSplash();
    }
View Full Code Here


                }
                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

            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

        }
        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

    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

       
        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

    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

        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

  }
 
  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

TOP

Related Classes of org.bukkit.potion.Potion

Copyright © 2018 www.massapicom. 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.