mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 12:42:22 -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();
|
void ReceiveNextAsync();
|
||||||
|
|
||||||
/// <summary> Sends a block of data, either synchronously or asynchronously. </summary>
|
/// <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>
|
/// <summary> Sends a block of low-priority data, either synchronously or asynchronously. </summary>
|
||||||
void SendLowPriority(byte[] buffer);
|
void SendLowPriority(byte[] buffer);
|
||||||
|
@ -189,7 +189,7 @@ namespace MCGalaxy {
|
|||||||
int processedLen = 0;
|
int processedLen = 0;
|
||||||
try {
|
try {
|
||||||
while (processedLen < bufferLen) {
|
while (processedLen < bufferLen) {
|
||||||
int packetLen = PacketSize(buffer[processedLen]);
|
int packetLen = PacketSize(buffer[processedLen]);
|
||||||
if (packetLen == -1) return -1;
|
if (packetLen == -1) return -1;
|
||||||
|
|
||||||
// Partial packet data received
|
// Partial packet data received
|
||||||
@ -499,17 +499,17 @@ namespace MCGalaxy {
|
|||||||
text = text.Replace("^detail.user=", "");
|
text = text.Replace("^detail.user=", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (partialMessage.Length > 0 && !text.EndsWith(">") && !text.EndsWith("<")) {
|
if (partialMessage.Length > 0 && !(IsPartialSpaced(text) || IsPartialJoined(text))) {
|
||||||
text = partialMessage + text;
|
text = partialMessage + text;
|
||||||
partialMessage = "";
|
partialMessage = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.EndsWith(">")) {
|
if (IsPartialSpaced(text)) {
|
||||||
partialMessage += text.Substring(0, text.Length - 1) + " ";
|
partialMessage += text.Substring(0, text.Length - 2) + " ";
|
||||||
SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
|
SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
|
||||||
return true;
|
return true;
|
||||||
} else if (text.EndsWith("<")) {
|
} else if (IsPartialJoined(text)) {
|
||||||
partialMessage += text.Substring(0, text.Length - 1);
|
partialMessage += text.Substring(0, text.Length - 2);
|
||||||
SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
|
SendMessage(Colors.teal + "Partial message: &f" + partialMessage);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -522,6 +522,14 @@ namespace MCGalaxy {
|
|||||||
return text.Length == 0;
|
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) {
|
bool DoCommand(string text) {
|
||||||
// Typing / repeats last command executed
|
// Typing / repeats last command executed
|
||||||
if (text == "/") {
|
if (text == "/") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user