/** * {@inheritDoc} */ public ParrotMenu(Plot plot, Parrot parrot) { super(plot, parrot); //type ItemStack type = new ItemStack(Material.BONE); ItemMeta typeMeta = type.getItemMeta(); typeMeta.setDisplayName(ChatColor.GREEN + "Change type"); type.setItemMeta(typeMeta); insertItem(type, event -> { new ParrotTypeMenu(parrot).open((Player) event.getWhoClicked()); event.setCancelled(true); }, 0); }
/** * {@inheritDoc} */ ParrotTypeMenu(Parrot parrot) { super(null, 9, ChatColor.GREEN + "Select the parrot type", 1); setStartingPoint(2); //blue ItemStack blue = new Wool(DyeColor.BLUE).toItemStack(1); ItemMeta blueMeta = blue.getItemMeta(); blueMeta.setDisplayName(ChatColor.GREEN + "Blue"); blue.setItemMeta(blueMeta); addItem(blue, event -> { parrot.setVariant(Parrot.Variant.BLUE); event.setCancelled(true); }); //cyan ItemStack cyan = new Wool(DyeColor.CYAN).toItemStack(1); ItemMeta cyanMeta = cyan.getItemMeta(); cyanMeta.setDisplayName(ChatColor.GREEN + "Cyan"); cyan.setItemMeta(cyanMeta); addItem(cyan, event -> { parrot.setVariant(Parrot.Variant.CYAN); event.setCancelled(true); }); //gray ItemStack gray = new Wool(DyeColor.GRAY).toItemStack(1); ItemMeta grayMeta = gray.getItemMeta(); grayMeta.setDisplayName(ChatColor.GREEN + "Gray"); gray.setItemMeta(grayMeta); addItem(gray, event -> { parrot.setVariant(Parrot.Variant.GRAY); event.setCancelled(true); }); //green ItemStack green = new Wool(DyeColor.GREEN).toItemStack(1); ItemMeta greenMeta = green.getItemMeta(); greenMeta.setDisplayName(ChatColor.GREEN + "Green"); green.setItemMeta(greenMeta); addItem(green, event -> { parrot.setVariant(Parrot.Variant.GREEN); event.setCancelled(true); }); //red ItemStack red = new Wool(DyeColor.RED).toItemStack(1); ItemMeta redMeta = red.getItemMeta(); redMeta.setDisplayName(ChatColor.GREEN + "Red"); red.setItemMeta(redMeta); addItem(red, event -> { parrot.setVariant(Parrot.Variant.RED); event.setCancelled(true); }); }
/** * Assembles an ArrayList of the properties for the specified Entity that * is to be used for a spawn egg. All instanceof checks are done internally * by the LorePackager, so no type checking is required prior to calling * this method. Null Entities will throw an IllegalArgumentException. <b>The * actual ArrayList is returned by {@link #getLore() LorePacker.getLore()}. * </b> * @param livingEntity - The Entity to assemble a lore for. * @return An ArrayList of Strings * @throws IllegalArgumentException If entity parameter is null */ public LorePacker(LivingEntity livingEntity) throws IllegalArgumentException { if (livingEntity == null) { throw new IllegalArgumentException("Can't assemble lore for a null entity!"); } lore = new ArrayList<String>(); // This needs to always be on top of an egg's lore lore.add("Identifier: SimpleEgg." + livingEntity.getType().getEntityClass().getSimpleName() + "." + Main.getSelf().getDescription().getVersion()); lore.addAll(livingEntity(livingEntity)); if (livingEntity instanceof Ageable) { lore.addAll(ageable((Ageable) livingEntity)); if (livingEntity instanceof Sheep) { lore.addAll(sheep((Sheep) livingEntity)); } else if (livingEntity instanceof Pig) { lore.addAll(pig((Pig) livingEntity)); } else if (livingEntity instanceof Rabbit) { lore.addAll(rabbit((Rabbit) livingEntity)); } else if (livingEntity instanceof Villager) { lore.addAll(villager((Villager) livingEntity)); } else if (livingEntity instanceof Tameable) { lore.addAll(tameable((Tameable) livingEntity)); if (livingEntity instanceof AbstractHorse) { lore.addAll(abstractHorse((AbstractHorse) livingEntity)); if (livingEntity instanceof Horse) { lore.addAll(horse((Horse) livingEntity)); } else if (livingEntity instanceof ChestedHorse) { lore.addAll(chestedHorse((ChestedHorse) livingEntity)); if (livingEntity instanceof Llama) { lore.addAll(llama((Llama) livingEntity)); } } } else if (livingEntity instanceof Sittable) { lore.addAll(sittable((Sittable) livingEntity)); if (livingEntity instanceof Wolf) { lore.addAll(wolf((Wolf) livingEntity)); } else if (livingEntity instanceof Ocelot) { lore.addAll(ocelot((Ocelot) livingEntity)); } else if (livingEntity instanceof Parrot) { lore.addAll(parrot((Parrot) livingEntity)); } } } } else if (livingEntity instanceof Slime) { lore.addAll(slime((Slime) livingEntity)); } else if (livingEntity instanceof Creeper) { lore.addAll(creeper((Creeper) livingEntity)); } else if (livingEntity instanceof Zombie) { lore.addAll(zombie((Zombie) livingEntity)); if (livingEntity instanceof PigZombie) { lore.addAll(pigZombie((PigZombie) livingEntity)); } else if (livingEntity instanceof ZombieVillager) { lore.addAll(zombieVillager((ZombieVillager) livingEntity)); } } else if (livingEntity instanceof Spellcaster) { lore.addAll(spellCaster((Spellcaster) livingEntity)); } else if (livingEntity instanceof IronGolem) { lore.addAll(ironGolem((IronGolem) livingEntity)); } else if (livingEntity instanceof Snowman) { lore.addAll(snowman((Snowman) livingEntity)); } }