From a0725bfe48ac9e8b13d87e7b0c97c13a6c67877f Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 5 Aug 2017 17:01:13 +1000 Subject: [PATCH] Fix custom chat tokens with : in them --- MCGalaxy/Chat/ChatTokens.cs | 7 ++++--- MCGalaxy/Network/Socket/TcpSocket.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MCGalaxy/Chat/ChatTokens.cs b/MCGalaxy/Chat/ChatTokens.cs index 256bedbb3..6587c6a1b 100644 --- a/MCGalaxy/Chat/ChatTokens.cs +++ b/MCGalaxy/Chat/ChatTokens.cs @@ -116,11 +116,12 @@ namespace MCGalaxy { } string[] lines = tokensFile.GetText(); - string[] parts = new string[2]; + char[] colon = new char[] {':'}; + foreach (string line in lines) { if (line.StartsWith("//")) continue; - line.FixedSplit(parts, ':'); - if (parts[1] == null) continue; // not a proper line + string[] parts = line.Split(colon, 2); + if (parts.Length == 1) continue; // not a proper line string key = parts[0].Trim(), value = parts[1].Trim(); if (key.Length == 0) continue; diff --git a/MCGalaxy/Network/Socket/TcpSocket.cs b/MCGalaxy/Network/Socket/TcpSocket.cs index 7e06bfc15..741e93edc 100644 --- a/MCGalaxy/Network/Socket/TcpSocket.cs +++ b/MCGalaxy/Network/Socket/TcpSocket.cs @@ -155,7 +155,7 @@ namespace MCGalaxy.Network { // DoSendAsync returns false if SendAsync completed sync // If that happens, SendCallback isn't called so we need to send data here instead if (s.DoSendAsync(s.sendQueue.Dequeue())) return; - + if (s.player.disconnected) s.sendQueue.Clear(); } }