Auto-fixer for multiple spaces in commands
This commit is contained in:
parent
a7c4217068
commit
e70c6aa946
1 changed files with 7 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using GameServer.Controllers.Attributes;
|
||||
using GameServer.Controllers.ChatCommands;
|
||||
using GameServer.Models;
|
||||
|
@ -8,7 +9,7 @@ using GameServer.Network.Messages;
|
|||
using Protocol;
|
||||
|
||||
namespace GameServer.Controllers;
|
||||
internal class ChatController : Controller
|
||||
internal partial class ChatController : Controller
|
||||
{
|
||||
private readonly ModelManager _modelManager;
|
||||
|
||||
|
@ -42,7 +43,8 @@ internal class ChatController : Controller
|
|||
}
|
||||
else
|
||||
{
|
||||
string[] split = request.Content[1..].Split(' ');
|
||||
string content = MultipleSpacesRegex().Replace(request.Content, " ");
|
||||
string[] split = content[1..].Split(' ');
|
||||
if (split.Length >= 2)
|
||||
{
|
||||
await chatCommandManager.InvokeCommandAsync(split[0], split[1], split[2..]);
|
||||
|
@ -85,4 +87,7 @@ internal class ChatController : Controller
|
|||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"\s+")]
|
||||
private static partial Regex MultipleSpacesRegex();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue