// Reference: 0Harmony using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Reflection.Emit; using HarmonyLib; // Update this to HarmonyLib for Harmony 2.x using Oxide.Plugins.BulletsFixExt; namespace Oxide.Plugins { [Info("BulletsFix", "Unknown", "1.0.0")] [Description("Makes bullets and impact effects invisible for vanished players")] public class BulletsFix : RustPlugin { #region Fields private const string InstanceId = "com.unk.bulletsfix"; private static Harmony _harmony; // Use Harmony instead of HarmonyInstance #endregion #region Hooks private void Loaded() { if (_harmony == null) _harmony = new Harmony(InstanceId); // Harmony 2.x syntax _harmony.Patch(AccessTools.Method(typeof(Effect.server), "ImpactEffect"), new HarmonyMethod(typeof(ImpactPatch), "Prefix")); _harmony.Patch(AccessTools.Method(typeof(BaseProjectile), "CLProject"), transpiler: new HarmonyMethod(typeof(ProjectilePatch), "Transpiler")); _harmony.Patch(AccessTools.Method(typeof(BasePlayer), "OnAttacked"), transpiler: new HarmonyMethod(typeof(HeadshotPatch), "Transpiler")); } private void Unload() => _harmony.UnpatchAll(InstanceId); #endregion #region Patch Utils private static Label GetLabel(CodeInstruction inst, ILGenerator generator = null) { Label lbl; if (inst.labels == null) inst.labels = new List