diff --git a/Helpers/Utils.cs b/Helpers/Utils.cs index 2c18b92..7b815b3 100644 --- a/Helpers/Utils.cs +++ b/Helpers/Utils.cs @@ -267,7 +267,7 @@ public static class Utils sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f), pixelsPerUnit); sprite.hideFlags |= HideFlags.HideAndDontSave | HideFlags.DontSaveInEditor; - Logger.Log($"Successfully loaded sprite from {path}"); + // Logger.Log($"Successfully loaded sprite from {path}"); return CachedSprites[path + pixelsPerUnit] = sprite; } catch (Exception ex) @@ -293,7 +293,7 @@ public static class Utils return null; } - Logger.Log($"Successfully loaded texture from {path}"); + // Logger.Log($"Successfully loaded texture from {path}"); return texture; } catch (Exception ex) diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 1cca413..490be25 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -27,7 +27,7 @@ class PlayerControlPatch public static void SetPlayerHighlight(PlayerControl player) { string hashPuid = Utils.GetHashPuid(player); - string friendCode = ValidateFriendCode(player, out string _); + string friendCode = player.Data.FriendCode; SetPlayerOutline(player, hashPuid, friendCode, new()); } @@ -150,22 +150,26 @@ class PlayerControlPatch private static void SetPlayerOutline(PlayerControl player, string hashPuid, string friendCode, StringBuilder sbTag) { - if (BAUAntiCheat.SickoData.ContainsKey(hashPuid) || BAUAntiCheat.SickoData.ContainsValue(friendCode)) + if (hashPuid != "" && BAUAntiCheat.SickoData.ContainsKey(hashPuid) + || friendCode != "" && BAUAntiCheat.SickoData.ContainsValue(friendCode)) { sbTag.Append($"{Translator.GetString("Player.SickoUser")}+++"); player.SetOutlineByHex(true, "#00f583"); } - else if (BAUAntiCheat.AUMData.ContainsKey(hashPuid) || BAUAntiCheat.AUMData.ContainsValue(friendCode)) + else if (hashPuid != "" && BAUAntiCheat.AUMData.ContainsKey(hashPuid) + || friendCode != "" && BAUAntiCheat.AUMData.ContainsValue(friendCode)) { sbTag.Append($"{Translator.GetString("Player.AUMUser")}+++"); player.SetOutlineByHex(true, "#4f0000"); } - else if (BAUAntiCheat.KNData.ContainsKey(hashPuid) || BAUAntiCheat.KNData.ContainsValue(friendCode)) + else if (hashPuid != "" && BAUAntiCheat.KNData.ContainsKey(hashPuid) + || friendCode != "" && BAUAntiCheat.KNData.ContainsValue(friendCode)) { sbTag.Append($"{Translator.GetString("Player.KNUser")}+++"); player.SetOutlineByHex(true, "#8731e7"); } - else if (BAUAntiCheat.PlayerData.ContainsKey(hashPuid) || BAUAntiCheat.PlayerData.ContainsValue(friendCode)) + else if (hashPuid != "" && BAUAntiCheat.PlayerData.ContainsKey(hashPuid) + || friendCode != "" && BAUAntiCheat.PlayerData.ContainsValue(friendCode)) { sbTag.Append($"{Translator.GetString("Player.KnownCheater")}+++"); player.SetOutlineByHex(true, "#fc0000"); diff --git a/main.cs b/main.cs index ed5091b..ce887f1 100644 --- a/main.cs +++ b/main.cs @@ -156,14 +156,22 @@ public class Main : BasePlugin { try { - ConsoleManager.DetachConsole(); + foreach (var listener in BepInEx.Logging.Logger.Listeners) + { + if (listener.GetType().Name.ToLower().Contains("Unity")) + { + BepInEx.Logging.Logger.Listeners.Remove(listener); + break; + } + } + ConsoleManager.CreateConsole(); - ConsoleManager.ConfigConsoleEnabled.BoxedValue = false; - ConsoleManager.SetConsoleTitle("Among Us - BAU Console"); ConsoleManager.ConfigPreventClose.Value = true; + if (ConsoleManager.ConfigConsoleEnabled.Value) ConsoleManager.DetachConsole(); + ConsoleManager.ConfigConsoleEnabled.Value = false; + ConsoleManager.SetConsoleTitle("Among Us - BAU Console"); Logger = BepInEx.Logging.Logger.CreateLogSource(PluginGuid); var customLogListener = new CustomLogListener(); - BepInEx.Logging.Logger.Listeners.Clear(); BepInEx.Logging.Logger.Listeners.Add(customLogListener); ConsoleManager.SetConsoleColor(ConsoleColor.Green); ConsoleManager.ConsoleStream.WriteLine($".--------------------------------------------------------------------------------.\r\n| ____ _ _ _ _ _ |\r\n| | __ ) ___| |_| |_ ___ _ __ / \\ _ __ ___ ___ _ __ __ _ | | | |___ |\r\n| | _ \\ / _ \\ __| __/ _ \\ '__| / _ \\ | '_ ` _ \\ / _ \\| '_ \\ / _` | | | | / __||\r\n| | |_) | __/ |_| || __/ | / ___ \\| | | | | | (_) | | | | (_| | | |_| \\__ \\|\r\n| |____/ \\___|\\__|\\__\\___|_| /_/ \\_\\_| |_| |_|\\___/|_| |_|\\__, | \\___/|___/|\r\n| |___/ |\r\n'--------------------------------------------------------------------------------'");