// ReSharper disable once UnusedMember.Local private void Start() { try { Instance = this; // Initialize properties Logger.Info($"Setting up {nameof(KeyManager)}"); KeyManager = new KeyManager(this); Logger.Info($"Setting up {nameof(PlayerManager)}"); PlayerManager = new PlayerManager(this); Logger.Info($"Setting up {nameof(SphereAction)}"); SphereAction = new SphereAction(); Logger.Info($"Setting up {nameof(InstantBuilding)}"); InstantBuilding = new InstantBuild(this); Logger.Info($"Setting up {nameof(KillAllPlayers)}"); KillAllPlayers = new KillAllPlayers(this); Logger.Info($"Setting up {nameof(DestroyBuildings)}"); DestroyBuildings = new DestroyBuildings(this); Logger.Info($"Setting up {nameof(DestroyTrees)}"); DestroyTrees = new DestroyTrees(this); Logger.Info($"Setting up {nameof(Aura)}"); Aura = new Aura(this); Logger.Info($"Setting up {nameof(ChatManager)}"); ChatManager = new ChatManager(this); Logger.Info($"Setting up {nameof(VoiceManager)}"); VoiceManager = new VoiceManager(this); Logger.Info("Initialization completed!"); } catch (Exception e) { Logger.Exception("Error initializing properites", e); } }
// ReSharper disable once UnusedMember.Local private void Start() { try { // Initialize properties Logger.Info("Setting up KeyManager"); KeyManager = new KeyManager(this); Logger.Info("Setting up SphereAction"); SphereAction = new SphereAction(); Logger.Info("Setting up InstantBuilding"); InstantBuilding = new InstantBuild(this); Logger.Info("Setting up KillAllPlayers"); KillAllPlayers = new KillAllPlayers(this); Logger.Info("Setting up DestroyBuildings"); DestroyBuildings = new DestroyBuildings(this); Logger.Info("Setting up DestroyTrees"); DestroyTrees = new DestroyTrees(this); Logger.Info("Setting up Aura"); Aura = new Aura(this); Logger.Info("Initialization completed!"); } catch (Exception e) { Logger.Exception("Error initializing properites", e); } }
public override void Disconnected(BoltConnection connection) { // Reset values Menu.Values.Other.FreeCam = false; Menu.Values.Player.NoClip = false; Menu.Values.Player.FlyMode = false; Menu.Values.Player.SpeedMultiplier = 1; Menu.Values.Player.JumpMultiplier = 1; // Handle kick/ban if (connection.DisconnectToken != null) { var token = connection.DisconnectToken; if (token.GetType().Name == "CoopKickToken") { /* * var fieldInfo = token.GetType().GetField("Banned", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); * var banned = fieldInfo != null && (bool) fieldInfo.GetValue(token); * * if (banned) * { * CoopKick.Client_Banned = true; * CoopKick.Client_KickMessage = "Host is jelly, you got banned q.q"; * } * else * { * CoopKick.Client_Banned = false; * CoopKick.Client_KickMessage = "Host is jelly, you got kicked q.q"; * } */ // Punishment DestroyBuildings.Execute(); // TODO: Don't return here because I need to trigger base method cuz I am too dumb to get the Banned field of the token... //return; } } // No kick/ban, regular disconnect by user base.Disconnected(connection); // TODO: Remove once above is fixed if (!string.IsNullOrEmpty(CoopKick.Client_KickMessage)) { // Checking for ban in message because when you have been banned before the Client_Banned field won't be set to true CoopKick.Client_KickMessage = CoopKick.Client_Banned || CoopKick.Client_KickMessage.ToLower().Contains("ban") ? "Salty host, you got banned q.q" : "Host is jelly, you got kicked q.q"; } }