Skip to content

Commit

Permalink
Add support for marker set persistence, prevent add to non persistent
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeprimm committed Aug 12, 2020
1 parent 7e38c4e commit 252f9af
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,11 @@ else if((x != null) && (y != null) && (z != null) && (world != null)) {
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();
Expand Down Expand Up @@ -1932,6 +1937,9 @@ private static boolean processListSet(DynmapCore plugin, DynmapCommandSender sen
if (set.getMaxZoom() >= 0) {
msg += ", maxzoom:" + set.getMaxZoom();
}
if (set.isMarkerSetPersistent()) {
msg += ", persistent=true";
}
sender.sendMessage(msg);
}
return true;
Expand Down Expand Up @@ -2193,6 +2201,11 @@ private static boolean processAddArea(DynmapCore plugin, DynmapCommandSender sen
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()];
Expand Down Expand Up @@ -2395,6 +2408,11 @@ private static boolean processAddLine(DynmapCore plugin, DynmapCommandSender sen
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()];
Expand Down Expand Up @@ -2611,7 +2629,11 @@ else if((x != null) && (y != null) && (z != null) && (world != null)) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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;
Expand Down Expand Up @@ -141,7 +141,7 @@ public void initializeBlockStates() {
*/
@Override
public MapChunkCache getChunkCache(BukkitWorld dw, List<DynmapChunk> chunks) {
MapChunkCache115 c = new MapChunkCache115();
MapChunkCache116 c = new MapChunkCache116();
c.setChunks(dw, chunks);
return c;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/**
* 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 {
Expand Down

0 comments on commit 252f9af

Please sign in to comment.