0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 19:25:16 +00:00

Added quotable arguments, potential fix for ban * not banning anyone.

This commit is contained in:
TheUbMunster 2022-07-26 17:09:44 -06:00 committed by Sanae
parent d604c59a77
commit db05586dd0

View file

@ -205,7 +205,7 @@ CommandHandler.RegisterCommand("rejoin", args => {
Client[] clients = (args[0].Trim() == "*" Client[] clients = (args[0].Trim() == "*"
? server.Clients.Where(c => c.Connected) ? server.Clients.Where(c => c.Connected)
: server.Clients.Where(c => : server.Clients.Where(c =>
c.Connected && args.Any(x => c.Name.StartsWith(x) || (Guid.TryParse(x, out Guid result) && result == c.Id)))).ToArray(); c.Connected && args.Any(x => c.Name == x || (Guid.TryParse(x, out Guid result) && result == c.Id)))).ToArray();
foreach (Client user in clients) { foreach (Client user in clients) {
if (moreThanOne) builder.Append(", "); if (moreThanOne) builder.Append(", ");
builder.Append(user.Name); builder.Append(user.Name);
@ -225,7 +225,7 @@ CommandHandler.RegisterCommand("crash", args => {
Client[] clients = (args[0].Trim() == "*" Client[] clients = (args[0].Trim() == "*"
? server.Clients.Where(c => c.Connected) ? server.Clients.Where(c => c.Connected)
: server.Clients.Where(c => : server.Clients.Where(c =>
c.Connected && args.Any(x => c.Name.StartsWith(x) || (Guid.TryParse(x, out Guid result) && result == c.Id)))).ToArray(); c.Connected && args.Any(x => c.Name == x || (Guid.TryParse(x, out Guid result) && result == c.Id)))).ToArray();
foreach (Client user in clients) { foreach (Client user in clients) {
if (moreThanOne) builder.Append(", "); if (moreThanOne) builder.Append(", ");
moreThanOne = true; moreThanOne = true;
@ -254,7 +254,7 @@ CommandHandler.RegisterCommand("ban", args => {
Client[] clients = (args[0].Trim() == "*" Client[] clients = (args[0].Trim() == "*"
? server.Clients.Where(c => c.Connected) ? server.Clients.Where(c => c.Connected)
: server.Clients.Where(c => : server.Clients.Where(c =>
c.Connected && args.Any(x => c.Name.StartsWith(x) || (Guid.TryParse(x, out Guid result) && result == c.Id)))).ToArray(); c.Connected && args.Any(x => c.Name == x || (Guid.TryParse(x, out Guid result) && result == c.Id)))).ToArray();
foreach (Client user in clients) { foreach (Client user in clients) {
if (moreThanOne) builder.Append(", "); if (moreThanOne) builder.Append(", ");
moreThanOne = true; moreThanOne = true;