@EventHandler
  public void onPlayerInteract(PlayerInteractEvent event) {
    int BLWand = getConfig().getInt("blocklog.wand");
    boolean WandEnabled = plugin.users.contains(event.getPlayer().getName());
    if (!event.isCancelled()) {
      if (event.getPlayer().getItemInHand().getTypeId() == BLWand && WandEnabled) {
        if ((event.getAction() == Action.RIGHT_CLICK_BLOCK
                && (!event.getPlayer().getItemInHand().getType().isBlock())
            || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
          Material type = event.getClickedBlock().getType();
          if (type == Material.WOODEN_DOOR
              || type == Material.TRAP_DOOR
              || type == Material.CHEST
              || type == Material.DISPENSER
              || type == Material.STONE_BUTTON
              || type == Material.LEVER)
            getBlockInteractions(
                event.getPlayer(), event.getClickedBlock(), Interaction.getByMaterial(type));
          else getBlockEdits(event.getPlayer(), event.getClickedBlock());

          event.setCancelled(true);
        }
      }
    }
  }
  public void getBlockInteractions(Player player, Block block, Interaction interaction) {
    try {
      player.sendMessage(
          ChatColor.DARK_RED
              + "BlockLog History ("
              + getConfig().getString("blocklog.results")
              + " Last Edits)");

      ArrayList<LoggedInteraction> Interactions = plugin.getInteractions();
      int BlockNumber = 0;
      int BlockCount = 0;
      int BlockSize = Interactions.size();
      Location BlockLocation = block.getLocation();

      while (BlockSize > BlockNumber) {
        LoggedInteraction LInteraction = Interactions.get(BlockNumber);
        if (LInteraction.getX() == BlockLocation.getX()
            && LInteraction.getY() == BlockLocation.getY()
            && LInteraction.getZ() == BlockLocation.getZ()
            && LInteraction.getWorld() == BlockLocation.getWorld()) {
          if (BlockCount == getConfig().getInt("blocklog.results")) break;

          String str = "";
          if (interaction == Interaction.CHEST || interaction == Interaction.DISPENSER)
            str = "opened this";
          else str = "used this";

          String name = interaction.getMaterial().name();

          Calendar calendar = GregorianCalendar.getInstance();
          calendar.setTimeInMillis(LInteraction.getDate() * 1000);

          String date =
              calendar.get(Calendar.DAY_OF_MONTH)
                  + "-"
                  + (calendar.get(Calendar.MONTH) + 1)
                  + "-"
                  + calendar.get(Calendar.YEAR)
                  + " "
                  + calendar.get(Calendar.HOUR_OF_DAY)
                  + ":"
                  + calendar.get(Calendar.MINUTE)
                  + ":"
                  + calendar.get(Calendar.SECOND);

          player.sendMessage(
              ChatColor.BLUE
                  + "["
                  + date
                  + "] "
                  + ChatColor.GOLD
                  + LInteraction.getPlayerName()
                  + " "
                  + ChatColor.DARK_GREEN
                  + str
                  + " "
                  + ChatColor.GOLD
                  + name);
          BlockCount++;
        }
        BlockNumber++;
      }

      if (BlockCount < getConfig().getInt("blocklog.results")) {
        Connection conn = plugin.conn;
        Statement stmt = conn.createStatement();

        double x = BlockLocation.getX();
        double y = BlockLocation.getY();
        double z = BlockLocation.getZ();

        ResultSet rs =
            stmt.executeQuery(
                "SELECT player, FROM_UNIXTIME(date, '%d-%m-%Y %H:%i:%s') AS date FROM blocklog_interactions WHERE x = '"
                    + x
                    + "' AND y = '"
                    + y
                    + "' AND z = '"
                    + z
                    + "' AND world = '"
                    + BlockLocation.getWorld().getName()
                    + "' ORDER BY date DESC LIMIT "
                    + (getConfig().getInt("blocklog.results") - BlockCount));

        while (rs.next()) {
          String str = "";
          if (interaction == Interaction.CHEST
              || interaction == Interaction.DISPENSER
              || interaction == Interaction.DOOR
              || interaction == Interaction.TRAP_DOOR) str = "opened a";
          else str = "used a";

          String name = interaction.getMaterial().name();

          player.sendMessage(
              ChatColor.BLUE
                  + "["
                  + rs.getString("date")
                  + "] "
                  + ChatColor.GOLD
                  + rs.getString("player")
                  + " "
                  + ChatColor.DARK_GREEN
                  + str
                  + " "
                  + ChatColor.GOLD
                  + name);
        }
      }
    } catch (SQLException e) {
      e.getStackTrace();
    }
  }