mirror of
https://github.com/oliverbooth/VPLink
synced 2024-11-23 00:28:47 +00:00
fix: suppress events if current world is null
This commit is contained in:
parent
1008d267cc
commit
c093a701f8
@ -43,6 +43,8 @@ internal sealed class VirtualParadiseMessageService : BackgroundService, IVirtua
|
||||
/// <inheritdoc />
|
||||
public Task SendMessageAsync(RelayedMessage message)
|
||||
{
|
||||
if (_virtualParadiseClient.CurrentWorld is null) return Task.CompletedTask;
|
||||
|
||||
IChatConfiguration configuration = _configurationService.VirtualParadiseConfiguration.Chat;
|
||||
|
||||
Color color = Color.FromArgb((int)(message.IsReply ? configuration.ReplyColor : configuration.Color));
|
||||
@ -62,6 +64,7 @@ internal sealed class VirtualParadiseMessageService : BackgroundService, IVirtua
|
||||
private void OnVPMessageReceived(VirtualParadiseMessage message)
|
||||
{
|
||||
if (message is null) throw new ArgumentNullException(nameof(message));
|
||||
if (_virtualParadiseClient.CurrentWorld is null) return;
|
||||
if (message.Type != MessageType.ChatMessage) return;
|
||||
if (message.Author == _virtualParadiseClient.CurrentAvatar) return;
|
||||
if (message.Author.IsBot && !_configurationService.BotConfiguration.RelayBotMessages) return;
|
||||
|
Loading…
Reference in New Issue
Block a user