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.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PlatformAbstractionLayer; using UnityEngine; using VoidManager; using VoidManager.CustomGUI; using VoidManager.MPModChecks; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("BlockGameInvites")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6cf51bb958732feebc9f252c3fd3bbb95c25c768")] [assembly: AssemblyProduct("BlockGameInvites")] [assembly: AssemblyTitle("Blocks in-game invites, saving you from unwanted non-friends popup spam.")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 BlockGameInvites { public class Configs { public static ConfigEntry BlockInvites; public static void Load(BepinPlugin plugin) { BlockInvites = ((BaseUnityPlugin)plugin).Config.Bind("General", "BlockInvites", true, ""); } } internal class GUI : ModSettingsMenu { public override string Name() { return "Block Game Invites"; } public override void Draw() { string text = (Configs.BlockInvites.Value ? "User Invites Blocked" : "User Invites Allowed"); if (GUILayout.Button(text, Array.Empty())) { Configs.BlockInvites.Value = !Configs.BlockInvites.Value; } } } public class MyPluginInfo { public const string PLUGIN_GUID = "Dragon.BlockGameInvites"; public const string PLUGIN_NAME = "BlockGameInvites"; public const string USERS_PLUGIN_NAME = "Block Game Invites"; public const string PLUGIN_VERSION = "1.0.0"; public const string PLUGIN_DESCRIPTION = "Blocks in-game invites, saving you from unwanted non-friends popup spam."; public const string PLUGIN_ORIGINAL_AUTHOR = "Dragon"; public const string PLUGIN_AUTHORS = "Dragon"; public const string PLUGIN_THUNDERSTORE_ID = "NihilityShift/BlockGameInvites"; } [HarmonyPatch(typeof(PlatformService), "OnLobbyInvite")] internal class Patch { private static bool Prefix(UserID userID, string platformLobbyID) { if (Configs.BlockInvites.Value) { BepinPlugin.Log.LogInfo((object)("Blocking invite from " + ((UserID)(ref userID)).Value)); return false; } return true; } } [BepInPlugin("Dragon.BlockGameInvites", "Block Game Invites", "1.0.0")] [BepInProcess("Void Crew.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BepinPlugin : BaseUnityPlugin { internal static ManualLogSource Log; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Configs.Load(this); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Dragon.BlockGameInvites is loaded!"); } } public class VoidManagerPlugin : VoidPlugin { public override MultiplayerType MPType => (MultiplayerType)8; public override string Author => "Dragon"; public override string Description => "Blocks in-game invites, saving you from unwanted non-friends popup spam."; public override string ThunderstoreID => "NihilityShift/BlockGameInvites"; } }