fix pending message

This commit is contained in:
linmeideli committed 2026-05-23 21:04:52 +08:00
1 parent 3681f5f9a5
commit f470c070bc
5 files changed
+7 -22

No files matched your search

Binary file not shown.
@@ -150,7 +150,6 @@
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
}
},
".NETStandard,Version=v2.0/linux-x64": {}
}
}
}
+1 -8
View File
@@ -34,12 +34,6 @@
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
}
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.27, )",
"resolved": "8.0.27",
"contentHash": "rQi9TxifHRnXP7lVRZH05DxD2/XGbJp12q0ozcbrlBlBnyyzssFTH/2vLhtKWUp2CT1qVscTrcYTFiwTyKPKRg=="
},
"StyleCop.Analyzers": {
"type": "Direct",
"requested": "[1.2.0-beta.556, )",
@@ -145,7 +139,6 @@
"NextFast.Hazel.Abstractions": {
"type": "Project"
}
},
"net8.0/linux-x64": {}
}
}
}
@@ -2,6 +2,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Empostor.Api.Events;
using Empostor.Api.Events.Game.Player;
using Empostor.Api.Events.Player;
namespace Empostor.Plugins.Message;
@@ -15,17 +17,14 @@ public sealed class MessageEventListener : IEventListener
}
[EventListener]
public async ValueTask OnPlayerJoined(IGamePlayerJoinedEvent e)
public async ValueTask OnPlayerReady(IPlayerReadyEvent e)
{
var fc = e.Player.Client.FriendCode;
var fc = e.ClientPlayer.Client.FriendCode;
if (string.IsNullOrEmpty(fc)) return;
var messages = _store.TakeAll(fc);
if (messages.Count == 0) return;
var ctrl = e.Player.Character;
if (ctrl == null) return;
var sb = new StringBuilder();
sb.AppendLine(string.Format("--- You have {0} pending message(s) ---", messages.Count));
@@ -35,6 +34,6 @@ public sealed class MessageEventListener : IEventListener
sb.AppendLine($"[{time}] <{msg.SenderName}> {msg.Content}");
}
await ctrl.SendChatToPlayerAsync(sb.ToString(), ctrl);
await e.PlayerControl.SendChatToPlayerAsync(sb.ToString(), e.PlayerControl);
}
}
-6
View File
@@ -58,12 +58,6 @@
"resolved": "8.0.1",
"contentHash": "X21b8D6z58EG34OMLH955750mFaEaGs5xLGe9Vyi3059Cgb3sk+p2k/JlQXaieEBRrk+SVlFzDei3Q6PdVzJOA=="
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.27, )",
"resolved": "8.0.27",
"contentHash": "rQi9TxifHRnXP7lVRZH05DxD2/XGbJp12q0ozcbrlBlBnyyzssFTH/2vLhtKWUp2CT1qVscTrcYTFiwTyKPKRg=="
},
"Serilog.Extensions.Hosting": {
"type": "Direct",
"requested": "[8.0.0, )",