using System.Collections; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ConfigurableJesterFear")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConfigurableJesterFear")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b0a5a24d-58b0-4c44-95ec-dfeec6436431")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ItemBlacklist; public class ConfigHandler : SyncedConfig2 { public ConfigEntry debugMode; [SyncedEntryField] public SyncedEntry blacklist; public ConfigHandler(ConfigFile cfg) : base("ZetaArcade.ItemBlacklist") { blacklist = SyncedBindingExtensions.BindSyncedEntry(cfg, "Blacklist", "Item Blacklist", "", "Comma seperated list of items to be blacklisted. When picked up, they are destroyed immediately."); debugMode = cfg.Bind("Debugging", "Print Debug Info", false, "If true, prints debug info into the log, such as the name of the item you last picked up."); ConfigManager.Register((SyncedConfig2)this); } } [BepInDependency("com.sigurd.csync", "5.0.0")] [BepInPlugin("ZetaArcade.ItemBlacklist", "ItemBlacklist", "1.1.1")] public class ItemBlacklist : BaseUnityPlugin { [HarmonyPatch(typeof(GrabbableObject), "GrabItem")] internal class EquipItemPatch { [HarmonyPostfix] private static void Postfix(GrabbableObject __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.itemProperties == (Object)null) { return; } if (Config.debugMode.Value) { Logger.LogInfo((object)("Detected item. itemName: " + __instance.itemProperties.itemName)); } string itemName = __instance.itemProperties.itemName; string[] source = (from s in Config.blacklist.Value.Split(new char[1] { ',' }) select s.Trim().ToLowerInvariant()).ToArray(); if (source.Contains(itemName.ToLowerInvariant())) { Logger.LogInfo((object)("Item " + itemName + " is blacklisted!")); PlayerControllerB playerHeldBy = __instance.playerHeldBy; if (!((Object)(object)playerHeldBy == (Object)null) && ((NetworkBehaviour)playerHeldBy).IsOwner && playerHeldBy.currentlyHeldObjectServer.itemProperties.itemName == itemName) { ((MonoBehaviour)Instance).StartCoroutine(Instance.RemoveBlacklistedItem(playerHeldBy, __instance)); } } } } private Harmony harmony = new Harmony("ZetaArcade.ItemBlacklist"); public static ManualLogSource Logger; public static ItemBlacklist Instance; internal static ConfigHandler Config; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; Config = new ConfigHandler(((BaseUnityPlugin)this).Config); Logger.LogInfo((object)"Plugin is loaded!"); harmony.PatchAll(); } private IEnumerator RemoveBlacklistedItem(PlayerControllerB player, GrabbableObject item) { yield return null; if (!((Object)(object)player == (Object)null) && !((Object)(object)item == (Object)null) && !((Object)(object)item.playerHeldBy != (Object)(object)player)) { player.DespawnHeldObject(); } } } public class PluginInfo { public const string modGUID = "ZetaArcade.ItemBlacklist"; public const string modName = "ItemBlacklist"; public const string modVersion = "1.1.1"; }