mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Instead of '>'/'<' for partial messages, use ' >'/' <'. Also support fCraft's ' /'/' \' partial messages. Fixes #399.
This commit is contained in:
parent
74a08df332
commit
eb94e5f333
@ -33,7 +33,7 @@ namespace MCGalaxy.Network {
|
||||
void ReceiveNextAsync();
|
||||
|
||||
/// <summary> Sends a block of data, either synchronously or asynchronously. </summary>
|
||||
void Send(byte[] buffer, bool sync = false);
|
||||
void Send(byte[] buffer, bool sync);
|
||||
|
||||
/// <summary> Sends a block of low-priority data, either synchronously or asynchronously. </summary>
|
||||
void SendLowPriority(byte[] buffer);
|
||||
|
@ -189,7 +189,7 @@ namespace MCGalaxy {
|
||||
int processedLen = 0;
|
||||
try {
|
||||
while (processedLen < bufferLen) {
|
||||
int packetLen = PacketSize(buffer[processedLen]);
|
||||
int packetLen = PacketSize(buffer[processedLen]);
|
||||
if (packetLen == -1) return -1;
|
||||
|
||||
// Partial packet data received
|
||||
@ -499,17 +499,17 @@ namespace MCGalaxy {
|
||||
text = text.Replace("^detail.user=", "");
|
||||
}
|
||||
|
||||
if (partialMessage.Length > 0 && !text.EndsWith(">") && !text.EndsWith("<")) {
|
||||
if (partialMessage.Length > 0 && !(IsPartialSpaced(text) || IsPartialJoined(text))) {
|
||||
text = partialMessage + text;
|
||||
partialMessage = "";
|
||||
}
|
||||
|
||||
if (text.EndsWith(">")) {
|
||||
partialMessage += text.Substring(0, text.Length - 1) + " ";
|
||||
if (IsPartialSpaced(text)) {
|
||||
partialMessage += text.Substring(0, text.Length - 2) + " ";
|
||||
SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
|
||||
return true;
|
||||
} else if (text.EndsWith("<")) {
|
||||
partialMessage += text.Substring(0, text.Length - 1);
|
||||
} else if (IsPartialJoined(text)) {
|
||||
partialMessage += text.Substring(0, text.Length - 2);
|
||||
SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
|
||||
return true;
|
||||
}
|
||||
@ -522,6 +522,14 @@ namespace MCGalaxy {
|
||||
return text.Length == 0;
|
||||
}
|
||||
|
||||
static bool IsPartialSpaced(string text) {
|
||||
return text.EndsWith(" >") || text.EndsWith(" /");
|
||||
}
|
||||
|
||||
static bool IsPartialJoined(string text) {
|
||||
return text.EndsWith(" <") || text.EndsWith(" \\");
|
||||
}
|
||||
|
||||
bool DoCommand(string text) {
|
||||
// Typing / repeats last command executed
|
||||
if (text == "/") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user