Cleanup partial message handling

This commit is contained in:
UnknownShadow200 2017-07-21 17:40:05 +10:00
parent fa7da22a43
commit cd83c2766b
3 changed files with 12 additions and 12 deletions

View File

@ -676,8 +676,8 @@ namespace MCGalaxy.Commands.CPE {
new string[] { "Enter the three maximum coordinates of the cube in units (separated by spaces). 1 block = 16 units.", new string[] { "Enter the three maximum coordinates of the cube in units (separated by spaces). 1 block = 16 units.",
"Maximum coordinates for a normal block are &416 &216 &116." }, "Maximum coordinates for a normal block are &416 &216 &116." },
new string[] { "Type a number between '0' and '2' for collision type of this block.", new string[] { "Type a number between '0' and '6' for collision type of this block.",
"0 - block is walk-through (e.g. air).", "1 - block is swim-through (e.g. water).", "0 - block is walk-through (e.g. air).", "1 - block is swim-through/climable (e.g. rope).",
"2 - block is solid (e.g. dirt).", "2 - block is solid (e.g. dirt).",
}, },
new string[] { "Type a number between '0.25' (25% speed) and '3.96' (396% speed).", new string[] { "Type a number between '0.25' (25% speed) and '3.96' (396% speed).",

View File

@ -105,7 +105,7 @@ namespace MCGalaxy {
public string whisperTo = ""; public string whisperTo = "";
public bool ignoreAll, ignoreGlobal, ignoreIRC, ignoreTitles, ignoreNicks, ignore8ball, ignoreDrawOutput; public bool ignoreAll, ignoreGlobal, ignoreIRC, ignoreTitles, ignoreNicks, ignore8ball, ignoreDrawOutput;
public string storedMessage = ""; string partialMessage = "";
public bool trainGrab; public bool trainGrab;
public bool onTrain, trainInvincible; public bool onTrain, trainInvincible;

View File

@ -495,8 +495,8 @@ namespace MCGalaxy {
} }
if (HasCpeExt(CpeExt.LongerMessages) && continued != 0) { if (HasCpeExt(CpeExt.LongerMessages) && continued != 0) {
if (text.Length < NetUtils.StringSize) storedMessage = storedMessage + text + " "; partialMessage += text;
else storedMessage = storedMessage + text; if (text.Length < NetUtils.StringSize) partialMessage += " ";
return true; return true;
} }
@ -505,18 +505,18 @@ namespace MCGalaxy {
text = text.Replace("^detail.user=", ""); text = text.Replace("^detail.user=", "");
} }
if (storedMessage != "" && !text.EndsWith(">") && !text.EndsWith("<")) { if (partialMessage != "" && !text.EndsWith(">") && !text.EndsWith("<")) {
text = storedMessage.Replace("|>|", " ").Replace("|<|", "") + text; text = partialMessage + text;
storedMessage = ""; partialMessage = "";
} }
if (text.EndsWith(">")) { if (text.EndsWith(">")) {
storedMessage += text.Substring(0, text.Length - 1) + "|>|"; partialMessage += text.Substring(0, text.Length - 1) + " ";
SendMessage(Colors.teal + "Partial message: &f" + storedMessage.Replace("|>|", " ").Replace("|<|", "")); SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
return true; return true;
} else if (text.EndsWith("<")) { } else if (text.EndsWith("<")) {
storedMessage += text.Substring(0, text.Length - 1) + "|<|"; partialMessage += text.Substring(0, text.Length - 1);
SendMessage(Colors.teal + "Partial message: &f" + storedMessage.Replace("|<|", "").Replace("|>|", " ")); SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
return true; return true;
} }