Add support for marker set persistence, prevent add to non persistent

This commit is contained in:
Mike Primm 2020-08-12 10:08:36 -05:00
parent 7e38c4ef23
commit 252f9afcdb
3 changed files with 26 additions and 4 deletions

View File

@ -1394,6 +1394,11 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
sender.sendMessage("Error: invalid set - " + setid);
return true;
}
// Prevent adding persistent markers to a non-persistent set
if (!set.isMarkerSetPersistent()) {
sender.sendMessage("Error: cannot add to non-persistent marker set - set is likely plugin owned");
return true;
}
MarkerIcon ico = null;
if(iconid == null) {
ico = set.getDefaultMarkerIcon();
@ -1932,6 +1937,9 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
if (set.getMaxZoom() >= 0) {
msg += ", maxzoom:" + set.getMaxZoom();
}
if (set.isMarkerSetPersistent()) {
msg += ", persistent=true";
}
sender.sendMessage(msg);
}
return true;
@ -2193,6 +2201,11 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
sender.sendMessage("Error: invalid set - " + setid);
return true;
}
// Prevent adding persistent markers to a non-persistent set
if (!set.isMarkerSetPersistent()) {
sender.sendMessage("Error: cannot add to non-persistent marker set - set is likely plugin owned");
return true;
}
/* Make coord list */
double[] xx = new double[ll.size()];
double[] zz = new double[ll.size()];
@ -2395,6 +2408,11 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
sender.sendMessage("Error: invalid set - " + setid);
return true;
}
// Prevent adding persistent markers to a non-persistent set
if (!set.isMarkerSetPersistent()) {
sender.sendMessage("Error: cannot add to non-persistent marker set - set is likely plugin owned");
return true;
}
/* Make coord list */
double[] xx = new double[ll.size()];
double[] yy = new double[ll.size()];
@ -2611,7 +2629,11 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
sender.sendMessage("Error: invalid set - " + setid);
return true;
}
// Prevent adding persistent markers to a non-persistent set
if (!set.isMarkerSetPersistent()) {
sender.sendMessage("Error: cannot add to non-persistent marker set - set is likely plugin owned");
return true;
}
/* Make circle marker */
CircleMarker m = set.createCircleMarker(id, label, "true".equals(markup), loc.world, loc.x, loc.y, loc.z, 1, 1, true);
if(m == null) {

View File

@ -22,7 +22,7 @@ import org.dynmap.bukkit.helper.BukkitMaterial;
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
import org.dynmap.bukkit.helper.BukkitVersionHelperGeneric;
import org.dynmap.bukkit.helper.BukkitWorld;
import org.dynmap.bukkit.helper.v116.MapChunkCache115;
import org.dynmap.bukkit.helper.v116.MapChunkCache116;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.Polygon;
@ -141,7 +141,7 @@ public class BukkitVersionHelperSpigot116 extends BukkitVersionHelperGeneric {
*/
@Override
public MapChunkCache getChunkCache(BukkitWorld dw, List<DynmapChunk> chunks) {
MapChunkCache115 c = new MapChunkCache115();
MapChunkCache116 c = new MapChunkCache116();
c.setChunks(dw, chunks);
return c;
}

View File

@ -32,7 +32,7 @@ import net.minecraft.server.v1_16_R1.NBTTagList;
/**
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
*/
public class MapChunkCache115 extends AbstractMapChunkCache {
public class MapChunkCache116 extends AbstractMapChunkCache {
public static class NBTSnapshot implements Snapshot {
private static interface Section {