Solved Getting map ItemStack from MapView

Discussion in 'Spigot Plugin Development' started by natekfl, Oct 14, 2018.

  1. Right now, I'm doing

    Code (Java):

    // Variable MapView mapView is already created

    ItemStack mapItem = new ItemStack(Material.FILLED_MAP);
    MapMeta meta  = (MapMeta) mapItem.getItemMeta();
    However, MapView.getId() is currently deprecated. Is there another way that I'm supposed to get the ID from the MapView?
  2. Server#getMap(int) -> MapView and MapView#getId() -> int are deprecated because of magic values.

    This means, the way mojang handles maps (by a limited range of numeric ids) is deprecated.
    As long as mojang doesn't change the way they're handled you need to use it this way, too.

    Long story short: Mojang use a deprecated strategy, so do you.
    Currently there's no change of this magic value ids foreseeable.

Share This Page