Decompiled source of LC Blacklist v1.0.0

LC_Blacklist.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LC_Blacklist.Utils;
using Microsoft.CodeAnalysis;

[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("LC_Blacklist")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LC_Blacklist")]
[assembly: AssemblyTitle("LC_Blacklist")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 LC_SteamIdOfMisfortuneToBlackList
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LC_Blacklist";

		public const string PLUGIN_NAME = "LC_Blacklist";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LC_Blacklist
{
	internal class ModInfo
	{
		public const string GUID = "x8c8r.LCBblacklist";

		public const string NAME = "LC_Blacklist";

		public const string VER = "1.0.0";
	}
	[BepInPlugin("x8c8r.LCBblacklist", "LC_Blacklist", "1.0.0")]
	public class LC_Blacklist : BaseUnityPlugin
	{
		private Harmony harmony = new Harmony("x8c8r.LCBblacklist");

		public static readonly ManualLogSource LogSource = Logger.CreateLogSource("x8c8r.LCBblacklist");

		public static LC_Blacklist Instance;

		public LCBConfig LcbConfig = new LCBConfig();

		private void Awake()
		{
			Instance = this;
			LcbConfig.Bind();
			harmony.PatchAll(typeof(LCBPatches));
			LogSource.LogInfo((object)"LC_Blacklist(x8c8r.LCBblacklist) v1.0.0 has loaded!");
			LogSource.LogInfo((object)"trans rights");
		}
	}
}
namespace LC_Blacklist.Utils
{
	public class LCBConfig
	{
		internal ConfigEntry<string> blockedPlayers;

		public void Bind()
		{
			blockedPlayers = ((BaseUnityPlugin)LC_Blacklist.Instance).Config.Bind<string>("Data", "blockedPlayers", "", "List of comma seperated SteamID's (no spaces, steamID64 format)");
		}

		public T Get<T>(ConfigEntry<T> entry)
		{
			return entry.Value;
		}

		public T Set<T>(ConfigEntry<T> entry, T newValue)
		{
			return entry.Value = newValue;
		}
	}
	[HarmonyPatch]
	public class LCBPatches
	{
		[HarmonyPatch(typeof(StartOfRound))]
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void SOR_Awake_Prefix(StartOfRound __instance)
		{
			LCBConfig lcbConfig = LC_Blacklist.Instance.LcbConfig;
			string text = lcbConfig.Get<string>(lcbConfig.blockedPlayers);
			string[] array = text.Split(",");
			List<ulong> list = new List<ulong>();
			string[] array2 = array;
			foreach (string s in array2)
			{
				if (ulong.TryParse(s, out var result))
				{
					list.Add(result);
				}
			}
			foreach (ulong item in list)
			{
				__instance.KickedClientIds.Add(item);
			}
		}
	}
}