Decompiled source of DeathKick v1.0.0

DeathKick.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 DeathKick
{
	[BepInPlugin("com.kirderf.deathkick", "Death Kick", "1.0.0")]
	public class DeathKick : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.kirderf.deathkick");

		private const string PluginId = "com.kirderf.deathkick";

		private void Awake()
		{
			_harmony.PatchAll();
		}
	}
	[HarmonyPatch(typeof(Player), "CreateTombStone")]
	public class DeathKickPatch
	{
		[HarmonyAfter(new string[] { "org.bepinex.plugins.servercharacters" })]
		private static void Postfix(Player __instance)
		{
			ZNet instance = ZNet.instance;
			if (((Character)__instance).IsDead())
			{
				Debug.LogWarning((object)("[DeathKick] KICKING PLAYER: " + __instance.GetPlayerName()));
				string playerName = __instance.GetPlayerName();
				((Component)ZNet.instance).BroadcastMessage("[DeathKick] " + playerName + " has died and will be kicked from the server.");
				ZNet.instance.Kick(playerName);
				Debug.LogWarning((object)("[DeathKick] " + playerName + " got kicked"));
			}
		}
	}
}