// returns an Potion item with cooked ingredients public ItemStack cook(int state) { ItemStack potion = new ItemStack(Material.POTION); PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); // cookedTime is always time in minutes, state may differ with number of ticks cookedTime = state; String cookedName = null; BRecipe cookRecipe = getCookRecipe(); int uid = Brew.generateUID(); if (cookRecipe != null) { // Potion is best with cooking only int quality = (int) Math.round( (getIngredientQuality(cookRecipe) + getCookingQuality(cookRecipe, false)) / 2.0); P.p.debugLog("cooked potion has Quality: " + quality); Brew brew = new Brew(uid, quality, cookRecipe, this); Brew.addOrReplaceEffects(potionMeta, brew.getEffects()); cookedName = cookRecipe.getName(quality); potion.setDurability(Brew.PotionColor.valueOf(cookRecipe.getColor()).getColorId(false)); } else { // new base potion new Brew(uid, this); if (state <= 1) { cookedName = P.p.languageReader.get("Brew_ThickBrew"); potion.setDurability(Brew.PotionColor.BLUE.getColorId(false)); } else { for (Material ingredient : ingredients.keySet()) { if (cookedNames.containsKey(ingredient)) { // if more than half of the ingredients is of one kind if (ingredients.get(ingredient) > (getIngredientsCount() / 2)) { cookedName = cookedNames.get(ingredient); potion.setDurability(Brew.PotionColor.CYAN.getColorId(true)); } } } } } if (cookedName == null) { // if no name could be found cookedName = P.p.languageReader.get("Brew_Undefined"); potion.setDurability(Brew.PotionColor.CYAN.getColorId(true)); } potionMeta.setDisplayName(P.p.color("&f" + cookedName)); // This effect stores the UID in its Duration potionMeta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true); potion.setItemMeta(potionMeta); return potion; }
@Override protected ItemStack[] get(Event e) { PotionEffectType p = effect.getSingle(e); if (p == null) return null; ItemStack potion = new Potion(PotionType.getByEffect(p)).toItemStack(1); PotionMeta meta = ((PotionMeta) potion.getItemMeta()); meta.addCustomEffect(new PotionEffect(p, 0, 0), true); potion.setItemMeta(meta); return Collect.asArray(potion); }
public static ItemStack createItemStack() { ItemStack ret = new ItemStack(Material.POTION, 1, POTION_VALUES.get(0).shortValue()); PotionMeta meta = (PotionMeta) ret.getItemMeta(); meta.setDisplayName(NAME); meta.setLore(LORE); meta.addCustomEffect(EFFECT, false); ret.setItemMeta(meta); return ret; }
public static void savePotion(ItemStack potion, String name) { if (potion.getType() != Material.POTION) return; PotionMeta meta = (PotionMeta) potion.getItemMeta(); ConfigurationSection potionYaml = yaml.createSection(name); for (int i = 0; i < meta.getCustomEffects().size(); i++) { PotionEffect effect = meta.getCustomEffects().get(i); ConfigurationSection effectYaml = potionYaml.createSection("effect_" + i); effectYaml.set("type", effect.getType().getName().toLowerCase()); effectYaml.set("duration", effect.getDuration()); effectYaml.set("amplifier", effect.getAmplifier() + 1); effectYaml.set("showParticles", effect.isAmbient()); } }
public static void transferPotionMeta(PotionMeta meta, JsonObject json, boolean meta2json) { if (meta2json) { if (!meta.hasCustomEffects()) return; json.add(POTION_EFFECTS, convertPotionEffectList(meta.getCustomEffects())); } else { JsonElement element = json.get(POTION_EFFECTS); if (element == null) element = json.get(POTION_EFFECTS_OLD); if (element == null) return; meta.clearCustomEffects(); for (PotionEffect pe : convertPotionEffectList(element)) { meta.addCustomEffect(pe, false); } } }
// Create a Potion from this Recipe with best values. Quality can be set, but will reset to 10 if // put in a barrel public ItemStack create(int quality) { ItemStack potion = new ItemStack(Material.POTION); PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); int uid = Brew.generateUID(); ArrayList<ItemStack> list = new ArrayList<ItemStack>(ingredients.size()); for (ItemStack item : ingredients) { if (item.getDurability() == -1) { list.add(new ItemStack(item.getType(), item.getAmount())); } else { list.add(item.clone()); } } BIngredients bIngredients = new BIngredients(list, cookingTime); Brew brew = new Brew( uid, bIngredients, quality, distillruns, getAge(), wood, getName(5), false, false, true); potion.setDurability(Brew.PotionColor.valueOf(getColor()).getColorId(false)); potionMeta.setDisplayName(P.p.color("&f" + getName(quality))); // This effect stores the UID in its Duration potionMeta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true); brew.convertLore(potionMeta, false); Brew.addOrReplaceEffects(potionMeta, effects, quality); potion.setItemMeta(potionMeta); return potion; }
public static ItemStack loadPotion(ItemStack potion, String name) { if (potion.getType() != Material.POTION) return potion; PotionMeta meta = (PotionMeta) potion.getItemMeta(); meta.clearCustomEffects(); ConfigurationSection potionYaml = getSection(name); if (potionYaml == null) return potion; for (String index : potionYaml.getKeys(false)) { ConfigurationSection effectYaml = potionYaml.getConfigurationSection(index); PotionEffect effect = new PotionEffect( ItemController.matchPotionEffect(effectYaml.getString("type")), effectYaml.getInt("duration", 600), effectYaml.getInt("amplifier", 1) - 1, effectYaml.getBoolean("showParticles", true)); meta.addCustomEffect(effect, true); } if (!meta.getCustomEffects().isEmpty()) meta.setMainEffect(meta.getCustomEffects().get(0).getType()); potion.setItemMeta(meta); return potion; }
private List<MobDrop> getDefaultDrops(EntityType entityType) { List<MobDrop> drops = new ArrayList<>(); switch (entityType) { case DROPPED_ITEM: break; case EXPERIENCE_ORB: break; case LEASH_HITCH: break; case PAINTING: break; case ARROW: break; case SNOWBALL: break; case FIREBALL: break; case SMALL_FIREBALL: break; case ENDER_PEARL: break; case ENDER_SIGNAL: break; case THROWN_EXP_BOTTLE: break; case ITEM_FRAME: break; case WITHER_SKULL: break; case PRIMED_TNT: break; case FALLING_BLOCK: break; case FIREWORK: break; case MINECART_COMMAND: break; case BOAT: break; case MINECART: break; case MINECART_CHEST: break; case MINECART_FURNACE: break; case MINECART_TNT: break; case MINECART_HOPPER: break; case MINECART_MOB_SPAWNER: break; case CREEPER: for (int i = 0; i < 40; i++) { drops.add( new MobDrop( i, i, 90, new ItemStack(Material.SULPHUR, (int) Math.ceil((double) i / 2D)))); } break; case SKELETON: for (int i = 0; i < 40; i++) { drops.add( new MobDrop( i, i, 50, new ItemStack(Material.ARROW, (int) Math.ceil((double) i / 2D)))); drops.add( new MobDrop( i, i, 50, new ItemStack(Material.BONE, (int) Math.ceil((double) i / 2D)))); } drops.add(new MobDrop(5, -1, 5, new ItemStack(Material.BOW, 1))); break; case SPIDER: case CAVE_SPIDER: for (int i = 0; i < 40; i++) { drops.add( new MobDrop( i, i, 75, new ItemStack(Material.STRING, (int) Math.ceil((double) i / 4D)))); drops.add( new MobDrop( i, i, 20, new ItemStack(Material.SPIDER_EYE, (int) Math.ceil((double) i / 8D)))); // ItemStack spiderVenom = new Potion(PotionType.POISON).toItemStack(i); ItemStack spiderVenom = new ItemStack(Material.POTION, i); PotionMeta potionMeta = (PotionMeta) spiderVenom.getItemMeta(); potionMeta.addCustomEffect(new PotionEffect(PotionEffectType.POISON, 120, 1), false); spiderVenom.setItemMeta(potionMeta); ItemMeta spiderVenomMeta = spiderVenom.getItemMeta(); spiderVenomMeta.setDisplayName("Spider venom"); spiderVenom.setItemMeta(spiderVenomMeta); drops.add(new MobDrop(i, i, 2, spiderVenom)); } drops.add(new MobDrop(5, 10, 5, new ItemStack(Material.NETHER_STALK))); break; case GIANT: drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.BONE, 64))); drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.ROTTEN_FLESH, 64))); break; case ZOMBIE: drops.add(new MobDrop(0, -1, 90, new ItemStack(Material.ROTTEN_FLESH))); drops.add(new MobDrop(0, -1, 30, new ItemStack(Material.ROTTEN_FLESH))); break; case SLIME: for (int i = 0; i < 40; i++) { drops.add(new MobDrop(i, i, 100, new ItemStack(Material.SLIME_BALL, i))); } break; case GHAST: for (int i = 0; i < 40; i++) { drops.add(new MobDrop(i, i, 50, new ItemStack(Material.GHAST_TEAR, i))); drops.add(new MobDrop(i, i, 50, new ItemStack(Material.SULPHUR, i))); } break; case PIG_ZOMBIE: drops.add(new MobDrop(0, 5, 90, new ItemStack(Material.GOLD_NUGGET))); drops.add(new MobDrop(5, 10, 80, new ItemStack(Material.GOLD_INGOT))); for (int i = 10; i < 40; i += 10) { drops.add(new MobDrop(i, i + 10, i * 2, new ItemStack(Material.GOLD_SWORD))); } break; case ENDERMAN: drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.ENDER_PEARL))); drops.add(new MobDrop(0, -1, 50, new ItemStack(Material.ENDER_PEARL))); drops.add(new MobDrop(20, -1, 20, new ItemStack(Material.EYE_OF_ENDER))); break; case SILVERFISH: ItemStack silverfishDroppings1 = new ItemStack(Material.PUMPKIN_SEEDS); ItemMeta meta1 = silverfishDroppings1.getItemMeta(); meta1.setDisplayName("Silverfish droppings"); silverfishDroppings1.setItemMeta(meta1); drops.add(new MobDrop(0, -1, 20, silverfishDroppings1)); ItemStack silverfishDroppings2 = new ItemStack(Material.MELON_SEEDS); ItemMeta meta2 = silverfishDroppings2.getItemMeta(); meta2.setDisplayName("Silverfish droppings"); silverfishDroppings2.setItemMeta(meta2); drops.add(new MobDrop(0, -1, 20, silverfishDroppings2)); ItemStack silverfishDroppings3 = new ItemStack(Material.SEEDS); ItemMeta meta3 = silverfishDroppings3.getItemMeta(); meta3.setDisplayName("Silverfish droppings"); silverfishDroppings3.setItemMeta(meta3); drops.add(new MobDrop(0, -1, 20, silverfishDroppings3)); break; case BLAZE: for (int i = 0; i < 40; i++) { drops.add(new MobDrop(i, i, 75, new ItemStack(Material.BLAZE_ROD))); } drops.add(new MobDrop(0, -1, 90, new ItemStack(Material.BLAZE_POWDER, 3))); break; case MAGMA_CUBE: drops.add(new MobDrop(0, -1, 90, new ItemStack(Material.MAGMA_CREAM, 5))); break; case ENDER_DRAGON: drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.DRAGON_EGG))); break; case WITHER: // ItemStack witherVenom = new Potion(PotionType.INSTANT_DAMAGE, 2).toItemStack(5); ItemStack witherVenom = new ItemStack(Material.POTION); ItemMeta witherVenomMeta = witherVenom.getItemMeta(); witherVenomMeta.setDisplayName("Wither venom"); PotionMeta witherVenomPotionMeta = (PotionMeta) witherVenomMeta; witherVenomPotionMeta.addCustomEffect( new PotionEffect(PotionEffectType.HARM, 120, 2), false); witherVenom.setItemMeta(witherVenomMeta); drops.add(new MobDrop(0, -1, 2, witherVenom)); break; case BAT: ItemStack batFang = new ItemStack(Material.GHAST_TEAR); ItemMeta batFangMeta = batFang.getItemMeta(); batFangMeta.setDisplayName("Bat fang"); batFang.setItemMeta(batFangMeta); drops.add(new MobDrop(0, -1, 80, batFang)); break; case WITCH: for (PotionEffectType potionEffectType : PotionEffectType.values()) { ItemStack potion = new ItemStack(Material.POTION); PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); potionMeta.addCustomEffect(new PotionEffect(potionEffectType, 120, 1), false); potion.setItemMeta(potionMeta); drops.add(new MobDrop(0, -1, 5, potion)); } break; case PIG: drops.add(new MobDrop(0, -1, 90, new ItemStack(Material.PORK))); drops.add(new MobDrop(0, -1, 10, new ItemStack(Material.GRILLED_PORK))); break; case SHEEP: ItemStack lampChop = new ItemStack(Material.PORK, 1); ItemMeta lambChop = lampChop.getItemMeta(); lambChop.setDisplayName("Lamb chop"); lampChop.setItemMeta(lambChop); drops.add(new MobDrop(0, -1, 60, lampChop)); drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.WOOL, 5))); break; case COW: drops.add(new MobDrop(0, -1, 90, new ItemStack(Material.RAW_BEEF))); drops.add(new MobDrop(0, -1, 10, new ItemStack(Material.COOKED_BEEF))); break; case CHICKEN: drops.add(new MobDrop(0, -1, 90, new ItemStack(Material.RAW_CHICKEN))); drops.add(new MobDrop(0, -1, 10, new ItemStack(Material.COOKED_CHICKEN))); break; case SQUID: drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.INK_SACK))); break; case WOLF: drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.BONE))); break; case MUSHROOM_COW: drops.add(new MobDrop(0, -1, 50, new ItemStack(Material.BROWN_MUSHROOM, 5))); drops.add(new MobDrop(0, -1, 50, new ItemStack(Material.RED_MUSHROOM, 5))); break; case SNOWMAN: drops.add(new MobDrop(0, -1, 60, new ItemStack(Material.SNOW_BALL, 16))); drops.add(new MobDrop(0, -1, 30, new ItemStack(Material.SNOW_BLOCK))); drops.add(new MobDrop(0, -1, 20, new ItemStack(Material.PUMPKIN))); break; case OCELOT: drops.add(new MobDrop(0, -1, 90, new ItemStack(Material.RAW_FISH))); break; case IRON_GOLEM: drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.IRON_INGOT, 8))); break; case HORSE: drops.add(new MobDrop(0, -1, 30, new ItemStack(Material.HAY_BLOCK))); break; case VILLAGER: drops.add(new MobDrop(0, -1, 20, new ItemStack(Material.EMERALD))); break; case ENDER_CRYSTAL: drops.add(new MobDrop(0, -1, 100, new ItemStack(Material.ENDER_PEARL, 32))); break; case SPLASH_POTION: break; case EGG: break; case FISHING_HOOK: break; case LIGHTNING: break; case WEATHER: break; case PLAYER: break; case COMPLEX_PART: break; case UNKNOWN: break; } return drops; }
@SuppressWarnings("deprecation") public static ItemStack parseItemStack(String s) { try { String[] gSplit = s.split(" "); ItemStack is = null; // ITEM ID / MATERIAL / SUBID String[] idsSplit = gSplit[0].split(":"); try { is = new ItemStack(Integer.parseInt(idsSplit[0])); } catch (NumberFormatException e) { is = new ItemStack(Material.valueOf(idsSplit[0])); } if (idsSplit.length > 1) is.setDurability(Short.parseShort(idsSplit[1])); if (gSplit.length > 1) { int metaStart = 2; try { is.setAmount(Integer.parseInt(gSplit[1])); } catch (NumberFormatException e) { metaStart = 1; } ItemMeta im = is.getItemMeta(); for (int meta = metaStart; meta < gSplit.length; meta++) { String rawKey = gSplit[meta]; String[] split = rawKey.split(":"); String key = split[0]; if (key.equalsIgnoreCase("name")) { im.setDisplayName( ChatColor.translateAlternateColorCodes('&', split[1]).replace("_", " ")); } else if (key.equalsIgnoreCase("lore")) { List<String> lore = new ArrayList<>(); for (String line : split[1].split("//")) { lore.add(ChatColor.translateAlternateColorCodes('&', line).replace("_", " ")); } im.setLore(lore); } else if (key.equalsIgnoreCase("color") && im instanceof LeatherArmorMeta) { LeatherArmorMeta lam = (LeatherArmorMeta) im; String[] csplit = split[1].split(","); Color color = Color.fromBGR( Integer.parseInt(csplit[0]), Integer.parseInt(csplit[1]), Integer.parseInt(csplit[2])); lam.setColor(color); } else if (key.equalsIgnoreCase("effect") && im instanceof PotionMeta) { PotionMeta pm = (PotionMeta) im; String[] psplit = split[1].split(","); pm.addCustomEffect( new PotionEffect( PotionEffectType.getByName(psplit[0]), Integer.parseInt(psplit[1]) * 20, Integer.parseInt(psplit[2])), true); } else if (key.equalsIgnoreCase("player") && im instanceof SkullMeta) { ((SkullMeta) im).setOwner(split[1]); } else if (key.equalsIgnoreCase("enchant")) { String[] esplit = split[1].split(","); im.addEnchant(getEnchantment(esplit[0]), Integer.parseInt(esplit[1]), true); } } is.setItemMeta(im); } return is; } catch (Exception e) { System.err.println( "[SurvivalGames] Cannot parse ItemStack: " + s + " - Mabye this is the reason: " + e.toString()); return null; } }
/** * Sends a display of item information to the specified command sender * * @param item the item to display, cannot be null * @param sender the command sender to send the display to, cannot be null */ public static void showInformation(ItemStack item, CommandSender sender) { if (item == null || sender == null) throw new IllegalArgumentException(); StringBuilder builder = new StringBuilder(); builder.append(ChatColor.BOLD).append(getName(item)).append(" "); if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) { builder.append(ChatColor.ITALIC).append("(").append(getName(item, true)).append(") "); } builder.append(ChatColor.BLUE).append("x").append(item.getAmount()); DumbAuction.getInstance().sendMessage(sender, ChatColor.AQUA + builder.toString().trim()); // Display durability if (item.getType().getMaxDurability() > 0 && item.getDurability() != 0) { double durability = 1 - ((double) item.getDurability() / (double) item.getType().getMaxDurability()); int percent = (int) Math.round(durability * 100); DumbAuction.getInstance() .sendMessage( sender, ChatColor.GRAY + "Durability: " + ChatColor.AQUA + "" + percent + "%"); } Potion pot = null; try { pot = Potion.fromItemStack(item); } catch (Exception e) { } // Consume error List<String> metaMessage = new ArrayList<String>(); if (item.hasItemMeta() || pot != null) { ItemMeta meta = item.getItemMeta(); if (meta.hasLore()) { List<String> lore = meta.getLore(); metaMessage.add(ChatColor.LIGHT_PURPLE + "Lore: "); metaMessage.add(ChatColor.DARK_GRAY + "-------------"); for (String l : lore) { metaMessage.add(ChatColor.GRAY + l); } metaMessage.add(ChatColor.DARK_GRAY + "-------------"); } if (meta.hasEnchants() || meta instanceof EnchantmentStorageMeta) { metaMessage.add(ChatColor.LIGHT_PURPLE + "Enchants: "); metaMessage.add(ChatColor.DARK_GRAY + "-------------"); if (meta.hasEnchants()) { Map<Enchantment, Integer> enchants = meta.getEnchants(); for (Enchantment e : enchants.keySet()) { int level = enchants.get(e); String strLevel = integerToRomanNumeral(level) + " " + ChatColor.GRAY + "(" + level + ")"; metaMessage.add(ChatColor.AQUA + getEnchantmentName(e) + " " + strLevel); } } if (meta instanceof EnchantmentStorageMeta) { EnchantmentStorageMeta emeta = (EnchantmentStorageMeta) meta; if (emeta.hasStoredEnchants()) { Map<Enchantment, Integer> enchants = emeta.getStoredEnchants(); for (Enchantment e : enchants.keySet()) { int level = enchants.get(e); String strLevel = integerToRomanNumeral(level) + " " + ChatColor.GRAY + "(" + level + ")"; metaMessage.add(ChatColor.AQUA + getEnchantmentName(e) + " " + strLevel); } } } metaMessage.add(ChatColor.DARK_GRAY + "-------------"); } if (meta instanceof BookMeta) { BookMeta book = (BookMeta) meta; if (book.hasTitle()) metaMessage.add(ChatColor.GRAY + "Book Title: " + ChatColor.AQUA + book.getTitle()); if (book.hasAuthor()) metaMessage.add(ChatColor.GRAY + "Book Author: " + ChatColor.AQUA + book.getAuthor()); } List<FireworkEffect> effects = new ArrayList<FireworkEffect>(); int fireworkPower = -1; if (meta instanceof FireworkEffectMeta) { FireworkEffectMeta firework = (FireworkEffectMeta) meta; if (firework.hasEffect()) { effects.add(firework.getEffect()); } } if (meta instanceof FireworkMeta) { FireworkMeta firework = (FireworkMeta) meta; if (firework.hasEffects()) { effects.addAll(firework.getEffects()); } fireworkPower = firework.getPower(); } if (effects.size() > 0) { metaMessage.add(ChatColor.LIGHT_PURPLE + "Firework Effects: "); metaMessage.add(ChatColor.DARK_GRAY + "-------------"); for (FireworkEffect effect : effects) { metaMessage.add(ChatColor.AQUA + getFireworkTypeName(effect.getType())); if (effect.getColors().size() > 0) { builder = new StringBuilder(); for (Color color : effect.getColors()) { ChatColor chat = ChatColorPalette.matchColor(color.getRed(), color.getGreen(), color.getBlue()); String name = getChatName(chat); builder.append(chat).append(name).append(ChatColor.GRAY).append(", "); } metaMessage.add( ChatColor.GRAY + " Colors: " + builder.toString().substring(0, builder.toString().length() - 2)); } if (effect.getFadeColors().size() > 0) { builder = new StringBuilder(); for (Color color : effect.getFadeColors()) { ChatColor chat = ChatColorPalette.matchColor(color.getRed(), color.getGreen(), color.getBlue()); String name = getChatName(chat); builder.append(chat).append(name).append(ChatColor.GRAY).append(", "); } metaMessage.add( ChatColor.GRAY + " Fade Colors: " + builder.toString().substring(0, builder.toString().length() - 2)); } } metaMessage.add(ChatColor.DARK_GRAY + "-------------"); } if (fireworkPower >= 0) { metaMessage.add(ChatColor.GRAY + "Firework Power: " + ChatColor.AQUA + "" + fireworkPower); } if (meta instanceof LeatherArmorMeta) { LeatherArmorMeta leather = (LeatherArmorMeta) meta; if (!leather .getColor() .equals( DumbAuction.getInstance().getServer().getItemFactory().getDefaultLeatherColor())) { ChatColor chat = ChatColorPalette.matchColor( leather.getColor().getRed(), leather.getColor().getGreen(), leather.getColor().getBlue()); metaMessage.add(ChatColor.GRAY + "Leather Color: " + chat + getChatName(chat)); } } if (meta instanceof SkullMeta) { SkullMeta skull = (SkullMeta) meta; if (skull.hasOwner()) { metaMessage.add(ChatColor.GRAY + "Skull Player: " + ChatColor.AQUA + skull.getOwner()); } } if (meta instanceof PotionMeta || pot != null) { metaMessage.add(ChatColor.LIGHT_PURPLE + "Potion Effects: "); metaMessage.add(ChatColor.DARK_GRAY + "-------------"); if (pot != null) { for (PotionEffect effect : pot.getEffects()) { int amplifier = effect.getAmplifier() + 1; int time = effect.getDuration() / 20; metaMessage.add( ChatColor.AQUA + getPotionEffectName(effect.getType()) + " " + integerToRomanNumeral(amplifier) + " " + ChatColor.GRAY + "(" + amplifier + ") for " + ChatColor.AQUA + toTime(time)); } } if (meta instanceof PotionMeta) { PotionMeta potion = (PotionMeta) meta; if (potion.hasCustomEffects()) { for (PotionEffect effect : potion.getCustomEffects()) { int amplifier = effect.getAmplifier() + 1; int time = effect.getDuration() / 20; metaMessage.add( ChatColor.AQUA + getPotionEffectName(effect.getType()) + " " + integerToRomanNumeral(amplifier) + " " + ChatColor.GRAY + "(" + amplifier + ") for " + ChatColor.AQUA + toTime(time)); } } } metaMessage.add(ChatColor.DARK_GRAY + "-------------"); } // Note: MapMeta is useless and not used } for (String s : metaMessage) { DumbAuction.getInstance().sendMessage(sender, s); } }