From 8a509043a52d6f2091bb08fbe0c8b57df1e9350f Mon Sep 17 00:00:00 2001 From: SydMontague Date: Sat, 13 Feb 2021 17:06:36 +0100 Subject: [PATCH] Fix 1.13 incompatibility --- pom.xml | 2 +- .../java/net/craftcitizen/imagemaps/ImageMaps.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 7a961f6..1ea65b5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.craftcitizen imagemaps - 1.0.4 + 1.0.5 ImageMaps Render Images onto maps! diff --git a/src/main/java/net/craftcitizen/imagemaps/ImageMaps.java b/src/main/java/net/craftcitizen/imagemaps/ImageMaps.java index c5e49a4..2063634 100644 --- a/src/main/java/net/craftcitizen/imagemaps/ImageMaps.java +++ b/src/main/java/net/craftcitizen/imagemaps/ImageMaps.java @@ -143,6 +143,12 @@ public class ImageMaps extends JavaPlugin implements Listener { return version.getMinor() > 14; } + public boolean isSetTrackingSupported() { + SemanticVersion version = Utils.getMCVersion(); + + return version.getMajor() >= 1 && version.getMinor() >= 14; + } + private void saveMaps() { FileConfiguration config = new YamlConfiguration(); config.set(CONFIG_VERSION_KEY, CONFIG_VERSION); @@ -193,7 +199,8 @@ public class ImageMaps extends JavaPlugin implements Listener { return; } - map.setTrackingPosition(false); + if(isSetTrackingSupported()) + map.setTrackingPosition(false); map.getRenderers().forEach(map::removeRenderer); map.addRenderer(new ImageMapRenderer(image, imageMap.getX(), imageMap.getY(), imageMap.getScale())); maps.put(imageMap, id); @@ -395,7 +402,8 @@ public class ImageMaps extends JavaPlugin implements Listener { MapView map = getServer().createMap(getServer().getWorlds().get(0)); map.getRenderers().forEach(map::removeRenderer); map.addRenderer(new ImageMapRenderer(image, x, y, getScale(image, data.getSize()))); - map.setTrackingPosition(false); + if(isSetTrackingSupported()) + map.setTrackingPosition(false); MapMeta meta = ((MapMeta) item.getItemMeta()); meta.setMapView(map);