diff --git a/pom.xml b/pom.xml index d85287b..a631ba0 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 de.craftlancer.imagemaps ImageMaps - 0.4.4 + 0.4.5 ImageMaps Draw Images on maps! diff --git a/src/main/java/de/craftlancer/imagemaps/ImageMaps.java b/src/main/java/de/craftlancer/imagemaps/ImageMaps.java index db0c91d..5a5aded 100644 --- a/src/main/java/de/craftlancer/imagemaps/ImageMaps.java +++ b/src/main/java/de/craftlancer/imagemaps/ImageMaps.java @@ -34,10 +34,10 @@ public class ImageMaps extends JavaPlugin implements Listener { public static final int MAP_WIDTH = 128; public static final int MAP_HEIGHT = 128; - private Map placing = new HashMap(); - private Map maps = new HashMap(); - private Map images = new HashMap(); - private List sendList = new ArrayList(); + private Map placing = new HashMap<>(); + private Map maps = new HashMap<>(); + private Map images = new HashMap<>(); + private List sendList = new ArrayList<>(); private FastSendTask sendTask; @Override @@ -158,7 +158,7 @@ public class ImageMaps extends JavaPlugin implements Listener { ItemStack item = getMapItem(cache.getImage(), x, y, image); i.setItem(item); - short id = item.getDurability(); + short id = (short) ((MapMeta) item.getItemMeta()).getMapId(); if (cache.isFastSend() && !sendList.contains(id)) { sendList.add(id); @@ -187,7 +187,9 @@ public class ImageMaps extends JavaPlugin implements Listener { map.addRenderer(new ImageMapRenderer(image, x, y)); - ((MapMeta) item.getItemMeta()).setMapId(map.getId()); + MapMeta meta = ((MapMeta) item.getItemMeta()); + meta.setMapId(map.getId()); + item.setItemMeta(meta); return item; } @@ -223,6 +225,9 @@ public class ImageMaps extends JavaPlugin implements Listener { MapView map = getServer().getMap(id); + if(map == null) + continue; + for (MapRenderer r : map.getRenderers()) map.removeRenderer(r); @@ -279,7 +284,7 @@ public class ImageMaps extends JavaPlugin implements Listener { for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) { - short id = getMapItem(file, x * MAP_WIDTH, y * MAP_HEIGHT, image).getDurability(); + short id = (short) ((MapMeta) getMapItem(file, x * MAP_WIDTH, y * MAP_HEIGHT, image).getItemMeta()).getMapId(); MapView map = getServer().getMap(id); for (MapRenderer renderer : map.getRenderers())