Patch GameManager.ChatMessage instead of ChatMessageServer
This should properly intercept and block /bot messages from appearing in chat
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class BotCommandMod : IModApi
|
public class BotCommandMod : IModApi
|
||||||
@@ -14,11 +13,10 @@ public class BotCommandMod : IModApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(GameManager))]
|
[HarmonyPatch(typeof(GameManager), "ChatMessage")]
|
||||||
[HarmonyPatch("ChatMessageServer")]
|
|
||||||
public class ChatMessagePatch
|
public class ChatMessagePatch
|
||||||
{
|
{
|
||||||
static bool Prefix(ClientInfo _cInfo, EChatType _type, int _senderId, string _msg, string _mainName, bool _localizeMain, List<int> _recipientEntityIds)
|
static bool Prefix(ClientInfo _cInfo, EChatType _type, string _msg, string _playerName)
|
||||||
{
|
{
|
||||||
if (_msg != null && _msg.StartsWith("/bot "))
|
if (_msg != null && _msg.StartsWith("/bot "))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user