diff --git a/modules/structs/WebClient.go b/modules/structs/WebClient.go index 4501131..abb5b0e 100644 --- a/modules/structs/WebClient.go +++ b/modules/structs/WebClient.go @@ -71,6 +71,18 @@ func (webClient *WebClient) RemoveMobileCmdID(cmdID int) { } } +func (webClient *WebClient) RemoveVoiceCMDIDsByBackend(cmdID int) { + logger.Web.Debugln("before", webClient.VoiceCMDIDsByBackend) + for i, data := range webClient.VoiceCMDIDsByBackend { + if data.WebCmdID == cmdID { + newArr := append(webClient.VoiceCMDIDsByBackend[:i], webClient.VoiceCMDIDsByBackend[i+1:]...) + webClient.VoiceCMDIDsByBackend = newArr + logger.Web.Debugln("after", webClient.VoiceCMDIDsByBackend) + return + } + } +} + func removeCmdIDFromList(arr []int, cmdID int) ([]int, error) { index := getCmdIDIndexFromList(arr, cmdID) diff --git a/serverCommunication/web.go b/serverCommunication/web.go index ede7f82..2819b8e 100644 --- a/serverCommunication/web.go +++ b/serverCommunication/web.go @@ -53,11 +53,9 @@ func HandleWebMessage(isVoice bool, conn *websocket.Conn, uuid string, msg []byt } // remove cmdID from VoiceCMDIDsByBackend list - //delete(webClient.VoiceCMDIDsByBackend, cmdID) - - // remove cmdID from voiceCmdIDs - webClient.RemoveVoiceCmdID(cmdID) + // remove cmdID from minecraftCmdIDs + mcClient.RemoveCmdID(cmdID) return } }