Allow spectators to be kicked after the game starts.
This commit is contained in:
@@ -67,6 +67,10 @@ namespace OpenRA.Mods.Common.Server
|
||||
|
||||
public static bool ValidateCommand(S server, Connection conn, Session.Client client, string cmd)
|
||||
{
|
||||
// Kick command is always valid for the host
|
||||
if (cmd.StartsWith("kick "))
|
||||
return true;
|
||||
|
||||
if (server.State == ServerState.GameStarted)
|
||||
{
|
||||
server.SendOrderTo(conn, "Message", "Cannot change state when game started. ({0})".F(cmd));
|
||||
@@ -584,6 +588,11 @@ namespace OpenRA.Mods.Common.Server
|
||||
}
|
||||
|
||||
var kickClient = server.GetClient(kickConn);
|
||||
if (server.State == ServerState.GameStarted && !kickClient.IsObserver)
|
||||
{
|
||||
server.SendOrderTo(conn, "Message", "Only spectators can be kicked after the game has started.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Log.Write("server", "Kicking client {0}.", kickClientID);
|
||||
server.SendMessage("{0} kicked {1} from the server.".F(client.Name, kickClient.Name));
|
||||
|
||||
Reference in New Issue
Block a user