From d5b15b78bf14f874ee5f20c3812cf006253e3e0b Mon Sep 17 00:00:00 2001 From: SydMontague Date: Tue, 24 Jul 2018 20:13:42 +0200 Subject: [PATCH] Update to Version 0.4.4 Fixed new maps not working in 1.13, should break for anything older! Removed Metrics --- pom.xml | 37 ++++--------------- .../de/craftlancer/imagemaps/ImageMaps.java | 21 ++++------- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/pom.xml b/pom.xml index 047e99f..d85287b 100644 --- a/pom.xml +++ b/pom.xml @@ -3,49 +3,28 @@ 4.0.0 de.craftlancer.imagemaps ImageMaps - 0.4.3 + 0.4.4 ImageMaps Draw Images on maps! UTF-8 - - - Craftlancer Releases - releases - http://repo.craftlancer.de/content/repositories/releases - - - Craftlancer Snapshots - snapshots - http://repo.craftlancer.de/content/repositories/snapshots - - - - bukkit-repo - http://repo.bukkit.org/content/groups/public/ - - - Plugin Metrics - http://repo.mcstats.org/content/repositories/public + spigot-repo + http://hub.spigotmc.org/nexus/content/groups/public/ + org.bukkit bukkit - 1.9-R0.1-SNAPSHOT - - - org.mcstats.bukkit - metrics - R8-SNAPSHOT - compile + 1.13-R0.1-SNAPSHOT + @@ -60,8 +39,8 @@ maven-compiler-plugin 2.5.1 - 1.6 - 1.6 + 1.8 + 1.8 diff --git a/src/main/java/de/craftlancer/imagemaps/ImageMaps.java b/src/main/java/de/craftlancer/imagemaps/ImageMaps.java index 41e85da..db0c91d 100644 --- a/src/main/java/de/craftlancer/imagemaps/ImageMaps.java +++ b/src/main/java/de/craftlancer/imagemaps/ImageMaps.java @@ -25,10 +25,10 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.MapMeta; import org.bukkit.map.MapRenderer; import org.bukkit.map.MapView; import org.bukkit.plugin.java.JavaPlugin; -import org.mcstats.Metrics; public class ImageMaps extends JavaPlugin implements Listener { public static final int MAP_WIDTH = 128; @@ -54,14 +54,6 @@ public class ImageMaps extends JavaPlugin implements Listener { sendTask = new FastSendTask(this, mapsPerSend); getServer().getPluginManager().registerEvents(sendTask, this); sendTask.runTaskTimer(this, sendPerTicks, sendPerTicks); - - try { - Metrics metrics = new Metrics(this); - metrics.start(); - } - catch (IOException e) { - getLogger().severe("Failed to load Metrics!"); - } } @Override @@ -180,19 +172,22 @@ public class ImageMaps extends JavaPlugin implements Listener { private ItemStack getMapItem(String file, int x, int y, BufferedImage image) { ItemStack item = new ItemStack(Material.MAP); - for (Entry entry : maps.entrySet()) + for (Entry entry : maps.entrySet()) { if (entry.getValue().isSimilar(file, x, y)) { - item.setDurability(entry.getKey()); + MapMeta meta = (MapMeta) item.getItemMeta(); + meta.setMapId(entry.getKey()); + item.setItemMeta(meta); return item; } + } MapView map = getServer().createMap(getServer().getWorlds().get(0)); for (MapRenderer r : map.getRenderers()) map.removeRenderer(r); map.addRenderer(new ImageMapRenderer(image, x, y)); - - item.setDurability(map.getId()); + + ((MapMeta) item.getItemMeta()).setMapId(map.getId()); return item; }