From 4c50bd502c1b1b699fdf4b53bf89af673f1908a9 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Fri, 9 Sep 2011 00:59:56 +0800 Subject: [PATCH 1/4] Fix typo in setMarkerSetLabel() API --- src/main/java/org/dynmap/markers/MarkerSet.java | 2 +- src/main/java/org/dynmap/markers/impl/MarkerSetImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/dynmap/markers/MarkerSet.java b/src/main/java/org/dynmap/markers/MarkerSet.java index f1ac9619..9cdca429 100644 --- a/src/main/java/org/dynmap/markers/MarkerSet.java +++ b/src/main/java/org/dynmap/markers/MarkerSet.java @@ -55,7 +55,7 @@ public interface MarkerSet { * Update label for marker set * @param lbl - label for marker set */ - public void setMarketSetLabel(String lbl); + public void setMarkerSetLabel(String lbl); /** * Test if marker set is persistent * @return true if the set is persistent diff --git a/src/main/java/org/dynmap/markers/impl/MarkerSetImpl.java b/src/main/java/org/dynmap/markers/impl/MarkerSetImpl.java index 3d732b67..e81245c0 100644 --- a/src/main/java/org/dynmap/markers/impl/MarkerSetImpl.java +++ b/src/main/java/org/dynmap/markers/impl/MarkerSetImpl.java @@ -112,7 +112,7 @@ class MarkerSetImpl implements MarkerSet { } @Override - public void setMarketSetLabel(String lbl) { + public void setMarkerSetLabel(String lbl) { label = lbl; MarkerAPIImpl.markerSetUpdated(this, MarkerUpdate.UPDATED); if(ispersistent) From 6d2193d597588cb336363290bb080a83166b9ff7 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Fri, 9 Sep 2011 11:02:32 +0800 Subject: [PATCH 2/4] Add hide-by-default attribute to marker sets, /dmarker updateset --- .../java/org/dynmap/markers/MarkerSet.java | 10 ++++ .../dynmap/markers/impl/MarkerAPIImpl.java | 55 +++++++++++++++++-- .../dynmap/markers/impl/MarkerSetImpl.java | 17 +++++- src/main/resources/configuration.txt | 2 - src/main/resources/plugin.yml | 4 ++ web/js/markers.js | 5 +- 6 files changed, 84 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/dynmap/markers/MarkerSet.java b/src/main/java/org/dynmap/markers/MarkerSet.java index 9cdca429..5409517b 100644 --- a/src/main/java/org/dynmap/markers/MarkerSet.java +++ b/src/main/java/org/dynmap/markers/MarkerSet.java @@ -86,4 +86,14 @@ public interface MarkerSet { * Delete marker set */ public void deleteMarkerSet(); + /** + * Set hide/show default + * @param hide - if true, layer for set will be hidden by default + */ + public void setHideByDefault(boolean hide); + /** + * Get hide/show default + * @return true if layer for set will be hidden by default + */ + public boolean getHideByDefault(); } diff --git a/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java b/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java index 80266849..14f263a1 100644 --- a/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java +++ b/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java @@ -123,9 +123,11 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener { /* Load persistence */ api.loadMarkers(); /* Initialize default marker set, if needed */ - if(api.getMarkerSet(MarkerSet.DEFAULT) == null) { - api.createMarkerSet(MarkerSet.DEFAULT, "Markers", null, true); + MarkerSet set = api.getMarkerSet(MarkerSet.DEFAULT); + if(set == null) { + set = api.createMarkerSet(MarkerSet.DEFAULT, "Markers", null, true); } + /* Build paths for markers */ api.markerdir = new File(plugin.getDataFolder(), "markers"); if(api.markerdir.isDirectory() == false) { @@ -404,7 +406,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener { } private static final Set commands = new HashSet(Arrays.asList(new String[] { - "add", "movehere", "update", "delete", "list", "icons", "addset", "deleteset", "listsets", "addicon" + "add", "movehere", "update", "delete", "list", "icons", "addset", "updateset", "deleteset", "listsets", "addicon" })); /* Parse argument strings : handle 'attrib:value' and quoted strings */ @@ -708,6 +710,9 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener { sender.sendMessage("Error creating marker set"); } else { + String h = parms.get("hide"); + if((h != null) && (h.equals("true"))) + set.setHideByDefault(true); sender.sendMessage("Added marker set id:'" + set.getMarkerSetID() + "' (" + set.getMarkerSetLabel() + ")"); } } @@ -715,6 +720,47 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener { sender.sendMessage("