Fix 1.13 incompatibility

This commit is contained in:
SydMontague 2021-02-13 17:06:36 +01:00
parent f12302c800
commit 8a509043a5
2 changed files with 11 additions and 3 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.craftcitizen</groupId>
<artifactId>imagemaps</artifactId>
<version>1.0.4</version>
<version>1.0.5</version>
<name>ImageMaps</name>
<description>Render Images onto maps!</description>

View File

@ -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);