private void OnLvlFinalize()
 {
     if (capi != null && (capi.Settings.Bool["showMinimapHud"] || !capi.Settings.Bool.Exists("showMinimapHud")) && (worldMapDlg == null || !worldMapDlg.IsOpened()))
     {
         ToggleMap(EnumDialogType.HUD);
     }
 }
        private void onWorldMapLinkClicked(LinkTextComponent linkcomp)
        {
            string[] xyzstr = linkcomp.Href.Substring("worldmap://".Length).Split('=');
            int      x      = xyzstr[1].ToInt();
            int      y      = xyzstr[2].ToInt();
            int      z      = xyzstr[3].ToInt();
            string   text   = xyzstr.Length >= 5 ? xyzstr[4] : "";

            if (worldMapDlg == null || !worldMapDlg.IsOpened() || (worldMapDlg.IsOpened() && worldMapDlg.DialogType == EnumDialogType.HUD))
            {
                ToggleMap(EnumDialogType.Dialog);
            }

            bool  exists = false;
            var   elem   = (worldMapDlg.SingleComposer.GetElement("mapElem") as GuiElementMap);
            var   wml    = (elem?.mapLayers.FirstOrDefault(ml => ml is WaypointMapLayer) as WaypointMapLayer);
            Vec3d pos    = new Vec3d(x, y, z);

            if (wml != null)
            {
                foreach (var wp in wml.ownWaypoints)
                {
                    if (wp.Position.Equals(pos, 0.01))
                    {
                        exists = true;
                        break;
                    }
                }
            }

            if (!exists)
            {
                capi.SendChatMessage(string.Format("/waypoint addati {0} ={1} ={2} ={3} {4} {5} {6}", "circle", x, y, z, false, "steelblue", text));
            }

            elem?.CenterMapTo(new BlockPos(x, y, z));
        }