Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LCWishlist v1.0.0
LCWhitelist.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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 GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; [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("LCWhitelist")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A whitelist for LLethal CompNYany")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LCWhitelist")] [assembly: AssemblyTitle("LCWhitelist")] [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 LethalCompanyTemplate { [BepInPlugin("Eyan17.whitelist", "Whitelist", "1.0.1")] internal class Whitelist : BaseUnityPlugin { private const string modGUID = "Eyan17.whitelist"; private const string modName = "Whitelist"; private const string modVersion = "1.0.1"; public static List<string> whitelist; public ConfigEntry<bool> isWhitelistOn; private ConfigEntry<string> allowedUsernames; internal static ManualLogSource mls; private void Awake() { mls = Logger.CreateLogSource("Whitelist"); mls.LogInfo((object)"The whitelist has been initiated."); isWhitelistOn = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "isWhitelistOn", true, "Toggles whether the whitelist is on."); allowedUsernames = ((BaseUnityPlugin)this).Config.Bind<string>("Whitelist", "allowedUsenames", "Player", "A list of usernames seperated by a semicolon. All spaces before and after the name are trimed."); List<string> list = splitString(allowedUsernames.Value); whitelist = list; mls.LogInfo((object)"Whitelisted players:"); for (int i = 0; i < whitelist.Count; i++) { mls.LogInfo((object)whitelist[i]); } if (isWhitelistOn.Value) { Harmony.CreateAndPatchAll(typeof(HarmonyUpdatePatch), (string)null); mls.LogInfo((object)"Update has been patched."); } } private static List<string> splitString(string input) { List<string> list = new List<string>(); string text = ""; bool flag = false; for (int i = 0; i < input.Length; i++) { char c = input[i]; if (c == '\\' && !flag) { flag = true; } else if (c == ';' && !flag) { list.Add(text.Trim()); text = ""; } else if (c == '\\' && flag) { text += c; flag = false; } else { text += c; flag = false; } } list.Add(text.Trim()); return list; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class HarmonyUpdatePatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(ref string ___playerUsername, ref ulong ___actualClientId) { if (___actualClientId != 0 && !Enumerable.Contains(Whitelist.whitelist, ___playerUsername)) { Whitelist.mls.LogInfo((object)"Checking whitelist..."); NetworkManager.Singleton.DisconnectClient(___actualClientId, "Not on whitelist."); Whitelist.mls.LogInfo((object)("Disconnected " + ___playerUsername + "; Client id: " + ___actualClientId)); } } } public static class PluginInfo { public const string PLUGIN_GUID = "LCWhitelist"; public const string PLUGIN_NAME = "LCWhitelist"; public const string PLUGIN_VERSION = "1.0.0"; } }