Decompiled source of IgnorePlayerJoiningInLobby v1.0.1

IgnorePlayerJoiningInLobby.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("IgnorePlayerJoiningInLobby")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("Ignore Player Joining In Lobby")]
[assembly: AssemblyTitle("IgnorePlayerJoiningInLobby")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace IgnorePlayerJoiningInLobby
{
	[BepInPlugin("com.kacpermarcinkiewicz.repo.IgnorePlayerJoiningInLobby", "Ignore Player Joining In Lobby", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch]
		public static class UpdatePatch
		{
			[HarmonyPatch(typeof(MenuPageLobby), "Update")]
			[HarmonyPostfix]
			public static void Postfix(MenuPageLobby __instance)
			{
				if ((Object)(object)__instance.startButton != (Object)null)
				{
					FieldInfo fieldInfo = AccessTools.Field(((object)__instance.startButton).GetType(), "disabled");
					if (fieldInfo != null)
					{
						fieldInfo.SetValue(__instance.startButton, false);
					}
					else
					{
						Logger.LogError((object)"Private field 'disabled' not found for btn!");
					}
				}
				else if ((Object)(object)__instance == (Object)null)
				{
					Logger.LogError((object)"MenuPageLobby instance is null!");
				}
				else if ((Object)(object)__instance.startButton == (Object)null)
				{
					Logger.LogError((object)"Start button is null!");
				}
			}
		}

		[HarmonyPatch]
		public static class LobbyMenuPatch
		{
			[HarmonyPatch(typeof(MenuPageLobby), "ButtonStart")]
			[HarmonyPrefix]
			public static void Prefix(MenuPageLobby __instance)
			{
				FieldInfo fieldInfo = AccessTools.Field(typeof(MenuPageLobby), "joiningPlayer");
				if (fieldInfo != null)
				{
					fieldInfo.SetValue(__instance, false);
					Logger.LogInfo((object)"I'm disabling 'Player joining...' btn lock");
				}
				else
				{
					Logger.LogError((object)"Private field 'joiningPlayer' not found!");
				}
			}
		}

		internal static ManualLogSource Logger;

		public static string GUID => "com.kacpermarcinkiewicz.repo.IgnorePlayerJoiningInLobby";

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Loaded!");
			Harmony val = new Harmony(GUID);
			val.PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "IgnorePlayerJoiningInLobby";

		public const string PLUGIN_NAME = "Ignore Player Joining In Lobby";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}