Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Essentials/EssentialsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public EssentialsConfig()
public ObservableCollection<InfoCommand> InfoCommands { get; } = new ObservableCollection<InfoCommand>();

private string _motd;
[Display(Name = "Motd", Description = "Message displayed to players upon connection")]
public string Motd { get => _motd; set => SetValue(ref _motd, value); }

public bool _enableRanks = false;
Expand Down
5 changes: 4 additions & 1 deletion Essentials/Patches/ChatMessagePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ public static MethodInfo FindOverLoadMethod( MethodInfo[] methodInfo,string name
}

public static void Patch(PatchContext ctx) {
if (EssentialsPlugin.Instance.Config.EnableRanks) {
try {
var target = FindOverLoadMethod(typeof(MyMultiplayerBase).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static), "OnChatMessageReceived_Server", 1);
var patchMethod = typeof(ChatMessagePatch).GetMethod(nameof(OnChatMessageReceived_Server), BindingFlags.Static | BindingFlags.NonPublic);
ctx.GetPattern(target).Prefixes.Add(patchMethod);

Log.Info("Patched OnChatMessageReceived_Server!");
}
catch {
Log.Error("Failed to patch!");
}
}

private static bool OnChatMessageReceived_Server(ref ChatMsg msg) {
Expand Down