From f40f151bdc7544918675bdc60331335d8c0eb675 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Mon, 2 Dec 2024 00:03:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E6=94=B9?= =?UTF-8?q?=E4=B8=BAstring[]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Lagrange.XocMat.Adapter/Plugin.cs | 4 ++-- src/Lagrange.XocMat.Adapter/README.md | 7 ++++++- src/Lagrange.XocMat.Adapter/Setting/Config.cs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Lagrange.XocMat.Adapter/Plugin.cs b/src/Lagrange.XocMat.Adapter/Plugin.cs index fae40c8a..9b633401 100644 --- a/src/Lagrange.XocMat.Adapter/Plugin.cs +++ b/src/Lagrange.XocMat.Adapter/Plugin.cs @@ -28,7 +28,7 @@ public class Plugin : TerrariaPlugin public override string Name => "机器人适配插件"; - public override Version Version => new(1, 0, 0, 0); + public override Version Version => new(1, 0, 0, 1); internal static readonly List ServerPlayers = new(); @@ -320,7 +320,7 @@ private void OnJoin(JoinEventArgs args) { if (Config.LimitJoin && TShock.UserAccounts.GetUserAccountByName(player.Name) == null) { - player.Disconnect(Config.DisConnentFormat); + player.Disconnect(string.Join("\n", Config.DisConnentFormat)); } } } diff --git a/src/Lagrange.XocMat.Adapter/README.md b/src/Lagrange.XocMat.Adapter/README.md index 21a513d9..58680ee3 100644 --- a/src/Lagrange.XocMat.Adapter/README.md +++ b/src/Lagrange.XocMat.Adapter/README.md @@ -7,7 +7,12 @@ - [Lagrange.XocMat](https://github.com/UnrealMultiple/XocMat) +## 更新日志 +``` +v1.0.0.1 +阻止语句改string[] +``` ## 指令 ``` @@ -21,7 +26,7 @@ ```json { "阻止未注册进入": true, - "阻止语句": "未注禁止进入服务器!", + "阻止语句": ["未注禁止进入服务器!"], "Socket": { "套字节地址": "127.0.0.1", "服务器名称": "玄荒", // 名称要求相同 diff --git a/src/Lagrange.XocMat.Adapter/Setting/Config.cs b/src/Lagrange.XocMat.Adapter/Setting/Config.cs index da4582ba..08d6c58c 100644 --- a/src/Lagrange.XocMat.Adapter/Setting/Config.cs +++ b/src/Lagrange.XocMat.Adapter/Setting/Config.cs @@ -10,7 +10,7 @@ public class Config public bool LimitJoin { get; set; } [JsonProperty("阻止语句")] - public string DisConnentFormat { get; set; } = "未注禁止进入服务器!"; + public string[] DisConnentFormat { get; set; } = { "未注禁止进入服务器!" }; [JsonProperty("Socket")] public SocketConfig SocketConfig { get; set; } = new(); From 6fba753c9a57b6f7b52f0edf155032c7e9a7ccb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=91=E5=8F=B8=E5=91=BD?= <79201070+Controllerdestiny@users.noreply.github.com> Date: Mon, 2 Dec 2024 01:21:22 +0800 Subject: [PATCH 2/2] Update WebSocketReceive.cs --- src/Lagrange.XocMat.Adapter/Net/WebSocketReceive.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Lagrange.XocMat.Adapter/Net/WebSocketReceive.cs b/src/Lagrange.XocMat.Adapter/Net/WebSocketReceive.cs index ee253e96..72e458c3 100644 --- a/src/Lagrange.XocMat.Adapter/Net/WebSocketReceive.cs +++ b/src/Lagrange.XocMat.Adapter/Net/WebSocketReceive.cs @@ -45,7 +45,7 @@ public static void Start(string Host, int Port) try { ClientWebSocket = new(); - ClientWebSocket.ConnectAsync(new Uri($"ws://{Host}:{Port}/momo?name={Plugin.Config.SocketConfig.ServerName}"), CancellationToken.None).Wait(); + ClientWebSocket.ConnectAsync(new Uri($"ws://{Host}:{Port}/"), CancellationToken.None).Wait(); OnConnect?.Invoke(); while (true) { @@ -68,7 +68,7 @@ public static void Start(string Host, int Port) catch { ClientWebSocket.Dispose(); - TShock.Log.ConsoleError($"[Lagrange.XocMat.Adapter]({count}) 未连接至MorMor机器人,正在进行连接.."); + TShock.Log.ConsoleError($"[Lagrange.XocMat.Adapter]({count}) 未连接至XocMat机器人,正在进行连接.."); } count++;