Add fix for changing marker set for areas, circles, lines

This commit is contained in:
Mike Primm 2021-06-26 13:07:40 -05:00
parent bc51a14006
commit bf67de2ab6

View File

@ -2323,7 +2323,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
} }
private static boolean processUpdateArea(DynmapCore plugin, DynmapCommandSender sender, String cmd, String commandLabel, String[] args) { private static boolean processUpdateArea(DynmapCore plugin, DynmapCommandSender sender, String cmd, String commandLabel, String[] args) {
String id, label, setid, newlabel, markup; String id, label, setid, newlabel, markup, newset;
if(args.length > 1) { if(args.length > 1) {
/* Parse arguements */ /* Parse arguements */
Map<String,String> parms = parseArgs(args, sender); Map<String,String> parms = parseArgs(args, sender);
@ -2366,6 +2366,15 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
else if(markup != null) { else if(markup != null) {
marker.setLabel(marker.getLabel(), "true".equals(markup)); marker.setLabel(marker.getLabel(), "true".equals(markup));
} }
newset = parms.get(ARG_NEWSET);
if (newset != null) {
MarkerSet ms = api.getMarkerSet(newset);
if(ms == null) {
sender.sendMessage("Error: invalid new marker set - " + newset);
return true;
}
marker.setMarkerSet(ms);
}
if(!processAreaArgs(sender,marker, parms)) if(!processAreaArgs(sender,marker, parms))
return true; return true;
sender.sendMessage("Updated area id:" + marker.getMarkerID() + " (" + marker.getLabel() + ")"); sender.sendMessage("Updated area id:" + marker.getMarkerID() + " (" + marker.getLabel() + ")");
@ -2524,7 +2533,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
return true; return true;
} }
private static boolean processUpdateLine(DynmapCore plugin, DynmapCommandSender sender, String cmd, String commandLabel, String[] args) { private static boolean processUpdateLine(DynmapCore plugin, DynmapCommandSender sender, String cmd, String commandLabel, String[] args) {
String id, setid, label, newlabel, markup; String id, setid, label, newlabel, markup, newset;
if(args.length > 1) { if(args.length > 1) {
/* Parse arguements */ /* Parse arguements */
Map<String,String> parms = parseArgs(args, sender); Map<String,String> parms = parseArgs(args, sender);
@ -2567,6 +2576,15 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
else if(markup != null) { else if(markup != null) {
marker.setLabel(marker.getLabel(), "true".equals(markup)); marker.setLabel(marker.getLabel(), "true".equals(markup));
} }
newset = parms.get(ARG_NEWSET);
if (newset != null) {
MarkerSet ms = api.getMarkerSet(newset);
if(ms == null) {
sender.sendMessage("Error: invalid new marker set - " + newset);
return true;
}
marker.setMarkerSet(ms);
}
if(!processPolyArgs(sender,marker, parms)) if(!processPolyArgs(sender,marker, parms))
return true; return true;
sender.sendMessage("Updated line id:" + marker.getMarkerID() + " (" + marker.getLabel() + ")"); sender.sendMessage("Updated line id:" + marker.getMarkerID() + " (" + marker.getLabel() + ")");
@ -2742,7 +2760,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
return true; return true;
} }
private static boolean processUpdateCircle(DynmapCore plugin, DynmapCommandSender sender, String cmd, String commandLabel, String[] args) { private static boolean processUpdateCircle(DynmapCore plugin, DynmapCommandSender sender, String cmd, String commandLabel, String[] args) {
String id, setid, label, newlabel, markup; String id, setid, label, newlabel, markup, newset;
if(args.length > 1) { if(args.length > 1) {
/* Parse arguements */ /* Parse arguements */
Map<String,String> parms = parseArgs(args, sender); Map<String,String> parms = parseArgs(args, sender);
@ -2785,6 +2803,15 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
else if(markup != null) { else if(markup != null) {
marker.setLabel(marker.getLabel(), "true".equals(markup)); marker.setLabel(marker.getLabel(), "true".equals(markup));
} }
newset = parms.get(ARG_NEWSET);
if (newset != null) {
MarkerSet ms = api.getMarkerSet(newset);
if(ms == null) {
sender.sendMessage("Error: invalid new marker set - " + newset);
return true;
}
marker.setMarkerSet(ms);
}
if(!processCircleArgs(sender,marker, parms)) if(!processCircleArgs(sender,marker, parms))
return true; return true;
sender.sendMessage("Updated circle id:" + marker.getMarkerID() + " (" + marker.getLabel() + ")"); sender.sendMessage("Updated circle id:" + marker.getMarkerID() + " (" + marker.getLabel() + ")");