Exemplo n.º 1
0
  private static void spawnFireworks(Player player) {
    int power = (int) (Math.random() * 3) + 1;
    int type = (int) (Math.random() * 5) + 1;

    Type typen = Type.BALL;
    if (type == 1) typen = Type.BALL;
    if (type == 2) typen = Type.BALL_LARGE;
    if (type == 3) typen = Type.BURST;
    if (type == 4) typen = Type.CREEPER;
    if (type == 5) typen = Type.STAR;

    Firework fireworks =
        (Firework) player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK);
    FireworkMeta fireworkmeta = fireworks.getFireworkMeta();
    FireworkEffect effect =
        FireworkEffect.builder()
            .flicker(Misc.getRandom().nextBoolean())
            .withColor(colorchoose())
            .withFade(colorchoose())
            .with(typen)
            .trail(Misc.getRandom().nextBoolean())
            .build();
    fireworkmeta.addEffect(effect);
    fireworkmeta.setPower(power);
    fireworks.setFireworkMeta(fireworkmeta);
  }
Exemplo n.º 2
0
 public static void detonateFirework(Location loc, FireworkEffect effects) {
   World world = loc.getWorld();
   Firework firework = (Firework) world.spawnEntity(loc, EntityType.FIREWORK);
   // Credit to codename_B
   Object nms_world = null;
   Object nms_firework = null;
   if (world_getHandle == null) {
     world_getHandle = getMethod(world.getClass(), "getHandle");
     firework_getHandle = getMethod(firework.getClass(), "getHandle");
   }
   try {
     nms_world = world_getHandle.invoke(world, (Object[]) null);
     nms_firework = firework_getHandle.invoke(firework, (Object[]) null);
   } catch (InvocationTargetException e) {
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   }
   if (nms_world_broadcastEntityEffect == null) {
     nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect");
   }
   FireworkMeta data = (FireworkMeta) firework.getFireworkMeta();
   data.clearEffects();
   data.setPower(1);
   data.addEffect(effects);
   firework.setFireworkMeta(data);
   try {
     nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17});
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   } catch (InvocationTargetException e) {
     e.printStackTrace();
   }
   firework.remove();
 }
Exemplo n.º 3
0
 public static void transferFireworkMetaPower(
     FireworkMeta meta, JsonObject json, boolean meta2json) {
   if (meta2json) {
     json.addProperty(FIREWORK_FLIGHT, meta.getPower());
   } else {
     JsonElement element = json.get(FIREWORK_FLIGHT);
     if (element == null) return;
     meta.setPower(element.getAsInt());
   }
 }
Exemplo n.º 4
0
 public static void transferFireworkMetaEffects(
     FireworkMeta meta, JsonObject json, boolean meta2json) {
   if (meta2json) {
     if (!meta.hasEffects()) return;
     json.add(FIREWORK_EFFECTS, convertFireworkEffectList(meta.getEffects()));
   } else {
     JsonElement element = json.get(FIREWORK_EFFECTS);
     if (element == null) return;
     meta.clearEffects();
     meta.addEffects(convertFireworkEffectList(element));
   }
 }
Exemplo n.º 5
0
  protected void spawnFirework(Location location) {
    List<Location> smokeLocations = new ArrayList<Location>();
    smokeLocations.add(location);
    smokeLocations.add(location.clone().add(0, 1, 0));
    SmokeUtil.spawnCloudRandom(smokeLocations, 3);

    Firework fw = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
    FireworkMeta fwm = fw.getFireworkMeta();

    fwm.addEffect(FireworkEffect.builder().withColor(Color.BLACK).with(Type.BURST).build());
    fwm.setPower(1);
    fw.setFireworkMeta(fwm);
  }
Exemplo n.º 6
0
 public static void shootFirework(Player p) {
   Firework fw = (Firework) p.getWorld().spawn(p.getLocation(), Firework.class);
   FireworkMeta fwMeta = fw.getFireworkMeta();
   boolean flicker = Math.random() < 0.5;
   boolean trail = Math.random() < 0.5;
   fwMeta.addEffect(
       FireworkEffect.builder()
           .withColor(colors[new Random().nextInt(colors.length)])
           .flicker(flicker)
           .trail(trail)
           .build());
   fw.setFireworkMeta(fwMeta);
 }
Exemplo n.º 7
0
  /**
   * Generates a Firework with random colors/velocity and the given Firework Type
   *
   * @param type The type of firework
   */
  public void fireWorkRandomColors(FireworkEffect.Type type, Location location) {
    Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
    FireworkMeta fireworkMeta = firework.getFireworkMeta();

    // Generate the colors
    int rdmInt1 = plugin.getRandom().nextInt(255);
    int rdmInt2 = plugin.getRandom().nextInt(255);
    int rdmInt3 = plugin.getRandom().nextInt(255);
    Color mainColor = Color.fromRGB(rdmInt1, rdmInt2, rdmInt3);

    FireworkEffect fwEffect = FireworkEffect.builder().withColor(mainColor).with(type).build();
    fireworkMeta.addEffect(fwEffect);
    fireworkMeta.setPower(1);
    firework.setFireworkMeta(fireworkMeta);
  }
 /**
  * Make a packet object
  *
  * @param location Location to play firework effect at
  * @param fireworkEffect FireworkEffect to play
  * @return Packet constructed by the parameters
  */
 private static Object makePacket(Location location, FireworkEffect fireworkEffect) {
   try {
     Firework firework = location.getWorld().spawn(location, Firework.class);
     FireworkMeta data = firework.getFireworkMeta();
     data.clearEffects();
     data.setPower(1);
     data.addEffect(fireworkEffect);
     firework.setFireworkMeta(data);
     Object nmsFirework = ReflectionUtil.getHandle(firework);
     firework.remove();
     return PACKET_PLAY_OUT_ENTITY_STATUS.newInstance(nmsFirework, (byte) 17);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Exemplo n.º 9
0
 public static void fireWork(Location loc) {
   Firework fw = loc.getWorld().spawn(loc, Firework.class);
   FireworkMeta fm = fw.getFireworkMeta();
   fm.addEffects(
       FireworkEffect.builder()
           .with(FireworkEffect.Type.BALL_LARGE)
           .withColor(Color.RED)
           .withColor(Color.AQUA)
           .withColor(Color.ORANGE)
           .withColor(Color.YELLOW)
           .trail(false)
           .flicker(false)
           .build());
   fm.setPower(0);
   fw.setFireworkMeta(fm);
   detonate(fw);
 }
 /**
  * Play a pretty firework at the location with the FireworkEffect when called
  *
  * @param world
  * @param loc
  * @param fe
  * @throws Exception
  */
 public static void playFirework(World world, Location loc, FireworkEffect fe) throws Exception {
   // Bukkity load (CraftFirework)
   Firework fw = (Firework) world.spawn(loc, Firework.class);
   // the net.minecraft.server.World
   Object nms_world = null;
   Object nms_firework = null;
   /*
    * The reflection part, this gives us access to funky ways of messing
    * around with things
    */
   if (world_getHandle == null) {
     // get the methods of the craftbukkit objects
     world_getHandle = getMethod(world.getClass(), "getHandle");
     firework_getHandle = getMethod(fw.getClass(), "getHandle");
   }
   // invoke with no arguments
   nms_world = world_getHandle.invoke(world, (Object[]) null);
   nms_firework = firework_getHandle.invoke(fw, (Object[]) null);
   // null checks are fast, so having this seperate is ok
   if (nms_world_broadcastEntityEffect == null) {
     // get the method of the nms_world
     nms_world_broadcastEntityEffect = getMethod(nms_world.getClass(), "broadcastEntityEffect");
   }
   /*
    * Now we mess with the metadata, allowing nice clean spawning of a
    * pretty firework (look, pretty lights!)
    */
   // metadata load
   FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
   // clear existing
   data.clearEffects();
   // power of one
   data.setPower(1);
   // add the effect
   data.addEffect(fe);
   // set the meta
   fw.setFireworkMeta(data);
   /*
    * Finally, we broadcast the entity effect then kill our fireworks
    * object
    */
   // invoke with arguments
   nms_world_broadcastEntityEffect.invoke(nms_world, new Object[] {nms_firework, (byte) 17});
   // remove from the game
   fw.remove();
 }
Exemplo n.º 11
0
 public static void shootRandomFirework(Location loc, int height) {
   Firework f = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
   FireworkMeta fm = f.getFireworkMeta();
   fm.setPower(height);
   int effectAmount = random.nextInt(3) + 1;
   for (int i = 0; i < effectAmount; i++) {
     Builder b = FireworkEffect.builder();
     int colorAmount = random.nextInt(3) + 1;
     for (int ii = 0; ii < colorAmount; ii++) {
       b.withColor(Color.fromBGR(random.nextInt(256), random.nextInt(256), random.nextInt(256)));
     }
     b.with(Type.values()[random.nextInt(Type.values().length)]);
     b.flicker(random.nextInt(2) == 0 ? false : true);
     b.trail(random.nextInt(2) == 0 ? false : true);
     fm.addEffect(b.build());
   }
   f.setFireworkMeta(fm);
 }
Exemplo n.º 12
0
	@Override
	public boolean applyResult(final Player player) {
		if (player == null)
			return false;

		final Location loc = (target.equals("player")) ? player.getLocation() : player.getWorld().getSpawnLocation();

		final Firework fw = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
		final FireworkMeta fwm = fw.getFireworkMeta();
		final FireworkEffect effect = FireworkEffect.builder().withColor(colour).with(type).build();

		fwm.addEffect(effect);
		fwm.setPower(power);

		fw.setFireworkMeta(fwm);

		player.teleport(location);
		return location != null;
	}
 @Override
 public void createFireworksExplosion(
     Location location,
     boolean flicker,
     boolean trail,
     int type,
     int[] colors,
     int[] fadeColors,
     int flightDuration) {
   FireworkEffect.Type t = Type.BALL;
   if (type == 1) {
     t = Type.BALL_LARGE;
   } else if (type == 2) {
     t = Type.STAR;
   } else if (type == 3) {
     t = Type.CREEPER;
   } else if (type == 4) {
     t = Type.BURST;
   }
   Color[] c1 = new Color[colors.length];
   for (int i = 0; i < colors.length; i++) {
     c1[i] = Color.fromRGB(colors[i]);
   }
   Color[] c2 = new Color[fadeColors.length];
   for (int i = 0; i < fadeColors.length; i++) {
     c2[i] = Color.fromRGB(fadeColors[i]);
   }
   FireworkEffect effect =
       FireworkEffect.builder()
           .flicker(flicker)
           .trail(trail)
           .with(t)
           .withColor(c1)
           .withFade(c2)
           .build();
   Firework firework = location.getWorld().spawn(location, Firework.class);
   FireworkMeta meta = firework.getFireworkMeta();
   meta.addEffect(effect);
   meta.setPower(flightDuration < 1 ? 1 : flightDuration);
   firework.setFireworkMeta(meta);
 }
Exemplo n.º 14
0
  /** On creeper death, drop fireworks and heads with a configurable chance. */
  @EventHandler(ignoreCancelled = true)
  public void onCreeperDeath(EntityDeathEvent event) {
    if (!CONFIG.isAffectedWorld(event)) {
      return;
    }

    Entity entity = event.getEntity();
    if (entity.getType() == EntityType.CREEPER && entity.hasMetadata(SPECIAL_KEY)) {
      Creeper creeper = (Creeper) entity;

      // Require recent player damage on the creeper for special drops.
      Long damageTime = getPlayerDamageTime(entity);
      if (damageTime != null) {
        Location loc = creeper.getLocation();
        if (loc.getWorld().getFullTime() - damageTime < PLAYER_DAMAGE_TICKS) {
          if (Math.random() < CONFIG.FIREWORK_DROP_CHANCE) {
            // Replace the default drops.
            event.getDrops().clear();
            final int amount = random(CONFIG.MIN_FIREWORK_DROPS, CONFIG.MAX_FIREWORK_DROPS);
            for (int i = 0; i < amount; ++i) {
              ItemStack firework = new ItemStack(Material.FIREWORK);
              FireworkMeta meta = (FireworkMeta) firework.getItemMeta();
              meta.setPower(random(0, 3));
              meta.addEffect(randomFireworkFffect(false));
              firework.setItemMeta(meta);
              event.getDrops().add(firework);
            }
          }

          // Powered creepers may drop a creeper skull in addition to
          // fireworks.
          if (creeper.isPowered() && Math.random() < CONFIG.CHARGED_CREEPER_SKULL_CHANCE) {
            event.getDrops().add(new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
          }
        }
      }
    }
  } // onCreeperDeath
Exemplo n.º 15
0
  /**
   * Event handler called when an explosive is primed.
   *
   * <p>We use it to detect impending creeper explosions. The event is fired immediately before the
   * explosion.
   */
  @EventHandler(ignoreCancelled = true)
  public void onCreeperDetonate(ExplosionPrimeEvent event) {
    if (!CONFIG.isAffectedWorld(event)) {
      return;
    }

    if (event.getEntityType() == EntityType.CREEPER) {
      event.setRadius((float) CONFIG.BLAST_RADIUS_SCALE * event.getRadius());

      Entity creeper = event.getEntity();
      launchReinforcements(creeper);

      Location origin = creeper.getLocation();
      World world = origin.getWorld();
      Firework firework = (Firework) world.spawnEntity(origin, EntityType.FIREWORK);
      if (firework != null) {
        FireworkMeta meta = firework.getFireworkMeta();
        meta.setPower(random(0, 1));
        meta.addEffect(randomFireworkFffect(true));
        firework.setFireworkMeta(meta);
      }
    }
  }
 @Override
 public void run() {
   if ((Boolean) Setting.BEACONS.getSetting()) {
     if (game == null || game.getFakeBeaconThread() != this) {
       cancel();
       return;
     }
     if (game.getActiveMysteryChest() == null) {
       List<MysteryBox> chests = game.getObjectsOfType(MysteryBox.class);
       if (chests.size() > 0) {
         game.setActiveMysteryChest(chests.get(rand.nextInt(chests.size())));
       }
     }
     if (game.hasStarted() && game.getActiveMysteryChest() != null) {
       if (active == null
           || !BukkitUtility.locationMatch(
               game.getActiveMysteryChest().getLocation(), active.getLocation())) {
         active = game.getActiveMysteryChest();
         fireLocations = getFiringLocations(active.getLocation());
       }
       for (Location l : fireLocations) {
         Builder effect =
             FireworkEffect.builder()
                 .trail(true)
                 .flicker(false)
                 .withColor(Color.BLUE)
                 .with(Type.BURST);
         Firework work = l.getWorld().spawn(l, Firework.class);
         EntityExplode.preventExplosion(work.getUniqueId(), true);
         FireworkMeta meta = work.getFireworkMeta();
         meta.addEffect(effect.build());
         meta.setPower(5);
         work.setFireworkMeta(meta);
       }
     }
   }
 }
Exemplo n.º 17
0
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (cmd.getName().equalsIgnoreCase("entitymanager") || cmd.getName().equalsIgnoreCase("em")) {
      if (sender.hasPermission("entitymanager.use")) {
        if (args.length == 1) {
          if (args[0].equalsIgnoreCase("findduplicate") || args[0].equalsIgnoreCase("fd")) {
            World world = getWorld(sender);

            if (world == null) {
              message(sender, "&cCould not get world.");
              return true;
            }

            List<UUID> entityUUIDs = new ArrayList<UUID>();
            Map<UUID, Location> duplicateEntities = new HashMap<UUID, Location>();
            for (LivingEntity le : world.getLivingEntities()) {
              if (entityUUIDs.contains(le.getUniqueId())) {
                duplicateEntities.put(le.getUniqueId(), le.getLocation());
              }
              entityUUIDs.add(le.getUniqueId());
            }

            if (duplicateEntities.isEmpty()) {
              sender.sendMessage(ChatColor.RED + "Could not find any duplicate entities.");
            } else {
              String message = "";
              for (Entry<UUID, Location> e : duplicateEntities.entrySet()) {
                message +=
                    "Entity "
                        + e.getKey()
                        + " at x:"
                        + (int) e.getValue().getX()
                        + ", y:"
                        + (int) e.getValue().getY()
                        + ", z:"
                        + (int) e.getValue().getZ()
                        + "\n";
              }

              sender.sendMessage(ChatColor.GREEN + "Duplicate entities:\n" + message);
            }

            return true;
          }
        }

        if (args.length >= 2) {
          if (args[0].equalsIgnoreCase("get")) {
            UUID uuid = UUID.fromString(args[1]);
            if (uuid == null) {
              sender.sendMessage(ChatColor.RED + "Invalid UUID.");
            } else {
              World world = getWorld(sender);

              if (world == null) {
                message(sender, "&cCould not get world.");
                return true;
              }

              for (LivingEntity le : world.getLivingEntities()) {
                if (le.getUniqueId().equals(uuid)) {
                  Location loc = le.getLocation();
                  selectedEntity = le;
                  message(
                      sender,
                      "&aEntity location: x:"
                          + (int) loc.getX()
                          + ", y:"
                          + loc.getY()
                          + ", z:"
                          + loc.getZ());
                  return true;
                }
              }

              message(sender, "&cNo valid entity found.");
            }
          } else if (args[0].equalsIgnoreCase("highlight") || args[0].equalsIgnoreCase("h")) {
            if (selectedEntity == null) {
              message(sender, "&cNo entity selected.");
            } else {
              Firework firework =
                  selectedEntity.getWorld().spawn(selectedEntity.getLocation(), Firework.class);
              FireworkMeta data = (FireworkMeta) firework.getFireworkMeta();
              data.addEffects(
                  FireworkEffect.builder().withColor(Color.LIME).with(Type.BALL).build());
              data.setPower(0);
              firework.setFireworkMeta(data);
              message(sender, "&aEntity highlighted.");
            }
          }
        } else {
          message(sender, "&cInvalid subcommand.");
        }

      } else {
        sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
      }

      return true;
    }

    return false;
  }
Exemplo n.º 18
0
  @Override
  public void run() {
    if (complete) return;

    // Log.debug((NumberUtil.randomBoolean() ? "tick" : "tock"));
    Rotation rotation = Rotation.get();
    RotationSlot next = rotation.getNext();

    rotation.setRestart();
    if (!rotation.isRestarting()) {
      next.load(true);
    }

    this.next = next;
    String what = getMessage();
    ChatColor colour = ChatColor.GRAY;
    if (next != null) {
      colour = ChatColor.DARK_AQUA;
    }

    try {
      List<User> players = match.getMap().getWinner().getPlayers();
      if (players.size() > 0 && isFullSecond()) { // check for more than 1 player
        User player = players.get(NumberUtil.getRandom(0, players.size() - 1));

        Location location = player.getPlayer().getLocation();
        Firework firework =
            (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
        FireworkMeta meta = firework.getFireworkMeta();
        meta.clearEffects();
        meta.addEffect(getFirework());
        firework.setFireworkMeta(meta);

        try {
          firework.detonate();
        } catch (Exception e) {
          Log.warning(
              "Server isn't running a version of Bukkit which allows the use of Firework.detonate() - resorting to manual detonation.");
          try {
            Object craft = NMSUtil.getClassBukkit("entity.CraftFirework").cast(firework);
            Method method = craft.getClass().getMethod("getHandle");
            method.setAccessible(true);
            Object handle = method.invoke(craft);
            handle.getClass().getField("expectedLifespan").set(handle, 0);
          } catch (Exception e2) {
            e2.printStackTrace();
          }
        }
      }
    } catch (NullPointerException ignored) {

    }

    if (duration <= 0 && next == null) {
      for (User player : User.getUsers()) {
        player.getPlayer().kickPlayer(ChatColor.GREEN + "Server restarting!");
      }

      complete = true;
      Bukkit.getServer().shutdown();
      return;
    }

    if (duration <= 0) {
      broadcast(what + "!");
      match.stop();
      complete = true;
      rotation.cycle();
      return;
    }

    boolean show = false;
    if (getTicks() % 20 == 0) {
      if (getSeconds() % 30 == 0) show = true;
      else if (getSeconds() < 30 && getSeconds() % 15 == 0) show = true;
      else if (getSeconds() < 15 && getSeconds() % 5 == 0) show = true;
      else if (getSeconds() < 5) show = true;
    }

    if (show)
      broadcast(
          what
              + " in "
              + ChatColor.RED
              + getSeconds()
              + " second"
              + (getSeconds() != 1 ? "s" : "")
              + colour
              + "!");
    setTicks(getTicks() - 1);
  }
Exemplo n.º 19
0
  /**
   * 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);
    }
  }