Skip to main content

JoinRejectionRecorder

A static class in TavernLib, TavernLib.Patches.

Client patches on JoinServerPipeline and JoinResult that record a server's mod refusal in last_rejection.json and hand over to the launcher to install the mods and rejoin. Also owns the Quick join preference.

Fields​

4 private and internal fields
MemberWhat it is
private static MelonPreferences_Entry<bool> _quickJoinThe "Quick join" mod preference, which mirrors the quick_join file.
private static DateTime _refusedAtWhen that refusal happened, UTC; a handover only counts within 10 minutes.
private static string _refusedByName of the server that last refused this client over mods, or null when a handover isn't possible.
private static string _shownThe rejection text TavernLib put in the join message, so ShowWhy can recognise it.

Properties​

2 private and internal properties
MemberWhat it is
private static string LauncherExe { get; }Path to the launcher read from the launcher path file, or null if it is missing or gone.
private static bool LauncherWatching { get; }True when the game was started with /force_offline, which the launcher passes and watches for.

Methods​

MemberWhat it is
static bool AttemptToConnectToServer(JoinServerPipeline __instance, ref Task<JoinResult> __result)Prefix on JoinServerPipeline.AttemptToConnectToServer: rejoining a server that refused you in the last 10 minutes quits for the launcher instead.
static void InitQuickJoin()Creates the TavernLib/QuickJoin MelonPreferences entry, mirroring the quick_join file both ways. Called by TavernLib on a client.
static void OnServerRejectedRequest(Connection connection, ref ConfirmJoinMessage joinMessage, JoinServerPipeline __instance)Prefix on JoinServerPipeline.OnServerRejectedRequest: for a mod refusal, writes last_rejection.json, rewrites the message and, with Quick join, quits after 4 seconds.
static void ShowWhy(JoinResult __instance, ref string __result)Postfix on the JoinResult.ErrorMessage getter that shows TavernLib's refusal line instead of the game's fixed one.
3 private and internal methods
MemberWhat it is
private static bool HandOver()Marks the rejection record to rejoin, starts the launcher if it isn't watching, and quits the game; false if that fails.
private static IEnumerator HandOverSoon() (iterator)Coroutine that waits 4 seconds so the player can read the message, then calls HandOver.
private static void Save(string json)Writes the rejection JSON to last_rejection.json through a temp file.