示例#1
0
        public void Handle(NetworkManager nm, Bot core)
        {
            if (!core.EnableCpe)
                core.RaiseErrorMessage("Protocol error: Received SetTextHotKey while CPE Disabled.");

            if (!core.ClientSupportedExtensions.Contains(CPEExtensions.CustomBlocks))
                core.RaiseErrorMessage("Protocol error: Received SetTextHotKey, which client does not support.");

            var myHotkey = new TextHotKeyEntry {
                Label = Label,
                Action = Action,
                Keycode = KeyCode,
                Modifier = (HotkeyModifier) KeyMods
            };

            if (core.Hotkeys == null)
                core.Hotkeys = new List<TextHotKeyEntry>();

            core.Hotkeys.Add(myHotkey);
            core.RaiseHotkeyAdded();
        }