title: Java - The method getValue() is undefined for the type Object
body: <p>I'm having this error:</p>
  
  <p>The method getValue() is undefined for the type Object</p>
  
  <p>*This is the code in error: In the line:</p>
  
  <pre><code>final String materialName = BasePlugin.getPlugin().getItemDb().getName(new ItemStack(((Object) ((Map)dataMap).entrySet().iterator().next()).getValue().getItemType(), 1));
  </code></pre>
  
  
  
  <p>Complete Code</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>public class LandMap
  {
      private static final int FACTION_MAP_RADIUS_BLOCKS = 22;
      private static final Material[] BLACKLISK;
  
      @SuppressWarnings("rawtypes")
      public static boolean updateMap(final Player player, final HCF plugin, final VisualType visualType, final boolean inform) {
          final Location location = player.getLocation();
          final World world = player.getWorld();
          final int locationX = location.getBlockX();
          final int locationZ = location.getBlockZ();
          final int minimumX = locationX - 22;
          final int minimumZ = locationZ - 22;
          final int maximumX = locationX + 22;
          final int maximumZ = locationZ + 22;
          final Set&lt;Claim&gt; board = new LinkedHashSet&lt;Claim&gt;();
          boolean subclaimBased;
          if (visualType == VisualType.SUBCLAIM_MAP) {
              subclaimBased = true;
          }
          else {
              if (visualType != VisualType.CLAIM_MAP) {
                  player.sendMessage(ConfigurationService.RED + "Not supported: " + visualType.name().toLowerCase() + '.');
                  return false;
              }
              subclaimBased = false;
          }
          for (int x = minimumX; x &lt;= maximumX; ++x) {
              for (int z = minimumZ; z &lt;= maximumZ; ++z) {
                  final Claim claim = plugin.getFactionManager().getClaimAt(world, x, z);
                  if (claim != null) {
                      if (subclaimBased) {
                          board.addAll(claim.getSubclaims());
                      }
                      else {
                          board.add(claim);
                      }
                  }
              }
          }
          if (board.isEmpty()) {
              player.sendMessage(ConfigurationService.RED + "No claims are in your visual range to display.");
              return false;
          }
          for (final Claim claim2 : board) {
              if (claim2 == null) {
                  continue;
              }
              final int maxHeight = Math.min(world.getMaxHeight(), 256);
              final Location[] corners = claim2.getCornerLocations();
              final List&lt;MemoryBlockLocation&gt; shown = new ArrayList&lt;MemoryBlockLocation&gt;(maxHeight * corners.length);
              for (final Location corner : corners) {
                  for (int y = 0; y &lt; maxHeight; ++y) {
                      shown.add(new MemoryBlockLocation(world, corner.getBlockX(), y, corner.getBlockZ()));
                  }
              }
              final Object dataMap = plugin.getVisualiseHandler().generate(player, shown, visualType, true);
              if (((Map)dataMap).isEmpty()) {
                  continue;
              }
              final String materialName = BasePlugin.getPlugin().getItemDb().getName(new ItemStack(((Object) ((Map)dataMap).entrySet().iterator().next()).getValue().getItemType(), 1));
              if (!inform || claim2.getFaction() == null) {
                  continue;
              }
              player.sendMessage(ConfigurationService.YELLOW + claim2.getFaction().getDisplayName((CommandSender)player) + ConfigurationService.YELLOW + " owns land " + ConfigurationService.GRAY + " (displayed with " + materialName + ")" + ConfigurationService.YELLOW + '.');
          }
          return true;
      }
  
      public static Location getNearestSafePosition(final Player player, final Location origin, final int searchRadius) {
          return getNearestSafePosition(player, origin, searchRadius, false);
      }
  
      public static Location getNearestSafePosition(final Player player, final Location origin, final int searchRadius, final boolean stuck) {
          final FactionManager factionManager = HCF.getPlugin().getFactionManager();
          final Faction playerFaction = factionManager.getPlayerFaction(player.getUniqueId());
          final int max = ConfigurationService.BORDER_SIZES.get(origin.getWorld().getEnvironment());
          final int originalX = Math.max(Math.min(origin.getBlockX(), max), -max);
          final int originalZ = Math.max(Math.min(origin.getBlockZ(), max), -max);
          final int minX = Math.max(originalX - searchRadius, -max) - originalX;
          final int maxX = Math.min(originalX + searchRadius, max) - originalX;
          final int minZ = Math.max(originalZ - searchRadius, -max) - originalZ;
          final int maxZ = Math.min(originalZ + searchRadius, max) - originalZ;
          for (int x = 0; x &lt; searchRadius; ++x) {
              if (x &lt;= maxX) {
                  if (-x &gt;= minX) {
                      for (int z = 0; z &lt; searchRadius; ++z) {
                          if (z &lt;= maxZ) {
                              if (-z &gt;= minZ) {
                                  final Location atPos = origin.clone().add((double)x, 0.0, (double)z);
                                  final Faction factionAtPos = factionManager.getFactionAt(atPos);
                                  if (factionAtPos == null || (!stuck &amp;&amp; playerFaction != null &amp;&amp; playerFaction.equals(factionAtPos)) || !(factionAtPos instanceof PlayerFaction)) {
                                      final Location safe = getSafeLocation(origin.getWorld(), atPos.getBlockX(), atPos.getBlockZ());
                                      if (safe != null) {
                                          return safe.add(0.5, 0.5, 0.5);
                                      }
                                  }
                                  final Location atNeg = origin.clone().add((double)x, 0.0, (double)z);
                                  final Faction factionAtNeg = factionManager.getFactionAt(atNeg);
                                  if (factionAtNeg == null || (!stuck &amp;&amp; playerFaction != null &amp;&amp; playerFaction.equals(factionAtNeg)) || !(factionAtNeg instanceof PlayerFaction)) {
                                      final Location safe2 = getSafeLocation(origin.getWorld(), atNeg.getBlockX(), atNeg.getBlockZ());
                                      if (safe2 != null) {
                                          return safe2.add(0.5, 0.5, 0.5);
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          }
          return null;
      }
  
      private static Location getSafeLocation(final World world, final int x, final int z) {
          Block highest = world.getHighestBlockAt(x, z);
          Material type = highest.getType();
          if (Arrays.asList(LandMap.BLACKLISK).contains(type)) {
              return null;
          }
          while (!type.isSolid()) {
              if (highest.getY() &lt;= 1 || Arrays.asList(LandMap.BLACKLISK).contains(type)) {
                  return null;
              }
              highest = highest.getRelative(BlockFace.DOWN);
              type = highest.getType();
          }
          return highest.getRelative(BlockFace.UP).getLocation();
      }
  
      static {
          BLACKLISK = new Material[] { Material.LEAVES, Material.LEAVES_2, Material.FENCE_GATE, Material.WATER, Material.LAVA, Material.STATIONARY_LAVA, Material.STATIONARY_WATER };
      }
  }
  </code></pre>
  
  <p>Imports:</p>
  
  <pre><code>import org.bukkit.entity.*;
  import net.tutorialesaful.hardcorefactions.faction.claim.*;
  import net.tutorialesaful.hardcorefactions.*;
  import net.tutorialesaful.hardcorefactions.util.location.*;
  import net.tutorialesaful.framework.*;
  import net.tutorialesaful.hardcorefactions.visualise.*;
  import org.bukkit.inventory.*;
  import org.bukkit.command.*;
  import org.bukkit.*;
  import net.tutorialesaful.hardcorefactions.faction.type.*;
  import java.util.*;
  import org.bukkit.block.*;
  </code></pre>
  
  <p>This is a class of bukkit</p>