diff --git a/MCGalaxy/Network/Player.Networking.cs b/MCGalaxy/Network/Player.Networking.cs
index d3214f33f..73af5b844 100644
--- a/MCGalaxy/Network/Player.Networking.cs
+++ b/MCGalaxy/Network/Player.Networking.cs
@@ -62,8 +62,7 @@ namespace MCGalaxy {
case Opcode.CpeTwoWayPing: return 1 + 1 + 2;
default:
- string msg = "Unhandled message id \"" + opcode + "\"!";
- Leave(msg, msg, true);
+ Leave("Unhandled opcode \"" + opcode + "\"!", true);
return -1;
}
}
diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs
index a95b95824..84d927866 100644
--- a/MCGalaxy/Player/Player.Handlers.cs
+++ b/MCGalaxy/Player/Player.Handlers.cs
@@ -188,8 +188,7 @@ namespace MCGalaxy {
byte action = buffer[offset + 7];
if (action > 1) {
- const string msg = "Unknown block action!";
- Leave(msg, msg, true); return;
+ Leave("Unknown block action!", true); return;
}
LastAction = DateTime.UtcNow;
@@ -496,8 +495,7 @@ namespace MCGalaxy {
text = Regex.Replace(text, " +", " ");
if (text.IndexOf('&') >= 0) {
- const string msg = "Illegal character in chat message!";
- Leave(msg, msg, true); return true;
+ Leave("Illegal character in chat message!", true); return true;
}
return text.Length == 0;
}
diff --git a/MCGalaxy/Player/Player.cs b/MCGalaxy/Player/Player.cs
index 126c65d3f..41f954577 100644
--- a/MCGalaxy/Player/Player.cs
+++ b/MCGalaxy/Player/Player.cs
@@ -191,25 +191,20 @@ namespace MCGalaxy {
}
/// Disconnects the players from the server,
- /// with the given message shown in both chat and in the disconnect packet.
+ /// with the given messages shown in chat and in the disconnect packet.
public void Leave(string chatMsg, string discMsg, bool sync = false) {
LeaveServer(chatMsg, discMsg, false, sync);
}
/// Disconnects the players from the server,
- /// with the given messages shown in chat and in the disconnect packet.
- public void Leave(string discMsg) { Leave(discMsg, false); }
- public void Leave(string discMsg, bool sync = false) {
- LeaveServer(discMsg, discMsg, false, sync);
+ /// with the same message shown in chat and in the disconnect packet.
+ public void Leave(string msg) { Leave(msg, false); }
+ public void Leave(string msg, bool sync = false) {
+ LeaveServer(msg, msg, false, sync);
}
[Obsolete("Use Leave() or Kick() instead")]
- public void leftGame(string discMsg = "") {
- string chatMsg = discMsg;
- if (chatMsg.Length > 0) chatMsg = "(" + chatMsg + ")"; // old format
- LeaveServer(chatMsg, discMsg, true);
- }
-
+ public void leftGame(string discMsg = "") { Kick(discMsg); }
bool leftServer = false;
void LeaveServer(string chatMsg, string discMsg, bool isKick, bool sync = false) {