public static void updateMarker(Spawn point) { Marker m = set.findMarker(point.getName()); if (m != null) { if (m.getX() != point.getX() || m.getY() != point.getY() || m.getZ() != point.getZ()) { m.setLocation(point.getWorldName(), point.getX(), point.getY(), point.getZ()); } } set.createMarker( point.getName(), point.getName(), point.getWorldName(), point.getX(), point.getY(), point.getZ(), icon, true); }
public ReaperMarkers(FearTheReaper plugin, DynmapAPI dm) { // Setup the API api = dm; mApi = api.getMarkerAPI(); if (mApi == null) { return; } icon = mApi.getMarkerIcon("tomb"); if (icon == null) { InputStream in = getClass().getResourceAsStream("/tomb.png"); icon = mApi.createMarkerIcon("tomb", "Graveyards", in); } set = mApi.getMarkerSet("graveyard.markerset"); if (set == null) { set = mApi.createMarkerSet("graveyard.markerset", "Graveyards", null, true); set.setLayerPriority(10); set.setHideByDefault(false); set.setMinZoom(0); } for (Entry<String, Spawn> entry : FearTheReaper.getSpawnList().entrySet()) { Marker m = set.findMarker(entry.getKey()); Spawn s = entry.getValue(); if (m != null) { if (m.getX() != s.getX() || m.getY() != s.getY() || m.getZ() != s.getZ()) { m.setLocation(s.getWorldName(), s.getX(), s.getY(), s.getZ()); } } set.createMarker( entry.getKey(), entry.getKey(), s.getWorldName(), s.getX(), s.getY(), s.getZ(), icon, true); } }
private void processNPC(MarkerSet set, NPC npc, Set<String> toremove) { UUID uuid = npc.getUniqueId(); String id = "npc_" + Long.toHexString(uuid.getMostSignificantBits() ^ uuid.getLeastSignificantBits()); Entity ent = null; if (npc.isSpawned()) { ent = npc.getEntity(); } if (ent == null) { // If null, see if we need to remove it if (existingnpcs.contains(id)) { // Found? Marker m = set.findMarker(id); if (m != null) { m.deleteMarker(); } existingnpcs.remove(id); } } else { Location loc = ent.getLocation(); Marker m = set.findMarker(id); if (m == null) { m = set.createMarker( id, npc.getName(), false, loc.getWorld().getName(), loc.getX(), loc.getY(), loc.getZ(), deficon, false); existingnpcs.add(id); } else { m.setLocation(loc.getWorld().getName(), loc.getX(), loc.getY(), loc.getZ()); m.setLabel(npc.getName()); } if (toremove != null) { toremove.remove(id); } } }
private void SetupDynMap() { // Pull references to Dynmap if (cDyn_Plugin == null) cDyn_Plugin = (DynmapAPI) getServer().getPluginManager().getPlugin("dynmap"); if (cDyn_MarkAPI == null) cDyn_MarkAPI = (MarkerAPI) cDyn_Plugin.getMarkerAPI(); if (cDyn_Markers == null) cDyn_Markers = cDyn_MarkAPI.getMarkerSet(this.getConfig().getString("markerset_name")); // Does this set exist? if (cDyn_Markers == null) { // Need to create a new icon set cDyn_Markers = cDyn_MarkAPI.createMarkerSet( this.getConfig().getString("markerset_name"), "DynmapNPCs", null, false); } cDyn_Markers.setHideByDefault(false); cDyn_Markers.setLabelShow(false); cDyn_Markers.setMinZoom(this.getConfig().getInt("zoomlevels.min")); cDyn_Markers.setMaxZoom(this.getConfig().getInt("zoomlevels.max")); cDyn_Markers.setMinZoom(0); cDyn_Markers.setMaxZoom(10); }
private void updateAllNPCs(MarkerSet npcset) { Iterable<NPCRegistry> reg = CitizensAPI.getNPCRegistries(); HashSet<String> toremove = new HashSet<String>(existingnpcs); if (reg != null) { for (NPCRegistry r : reg) { for (NPC npc : r) { processNPC(npcset, npc, toremove); } } } for (String s : toremove) { Marker m = npcset.findMarker(s); if (m != null) { m.deleteMarker(); } existingnpcs.remove(s); } }
public static void deleteMarker(Spawn point) { Marker m = set.findMarker(point.getName()); if (m != null) { m.deleteMarker(); } }