diff --git a/src/Managers/BetterNotificationManager.cs b/src/Managers/BetterNotificationManager.cs
index fd2a7cc..211d66e 100644
--- a/src/Managers/BetterNotificationManager.cs
+++ b/src/Managers/BetterNotificationManager.cs
@@ -85,10 +85,11 @@ internal static class BetterNotificationManager
/// Displays a notification message in-game.
///
/// The text to display in the notification.
- /// The duration in seconds to show the notification.
- internal static void Notify(string text, float Time = 5f)
+ /// The duration in seconds to show the notification.
+ /// /// If notification should be forced even if better notifications is disabled.
+ internal static void Notify(string text, float time = 5f, bool force = false)
{
- if (!BAUConfigs.BetterNotifications.Value)
+ if (!BAUConfigs.BetterNotifications.Value && !force)
return;
if (BAUNotificationManagerObj == null)
@@ -99,11 +100,11 @@ internal static class BetterNotificationManager
if (text == TextArea.text)
return;
- NotifyQueue[text] = Time;
+ NotifyQueue[text] = time;
return;
}
- showTime = Time;
+ showTime = time;
BAUNotificationManagerObj.SetActive(true);
NameText.text = $"{Translator.GetString("SystemNotification")}";
TextArea.text = text;
@@ -167,7 +168,7 @@ internal static class BetterNotificationManager
{
BetterDataManager.Files.BetterDataFile.CheatData.Add(new(player?.ExtendedData().RealName ?? player.Data.PlayerName, player.GetHashPuid(), player.Data.FriendCode, reason));
BetterDataManager.Files.BetterDataFile.Save();
- Notify(text, Time: 8f);
+ Notify(text, time: 8f);
}
Logger_.LogCheat($"{player.cosmetics.nameText.text} Info: {player.Data.PlayerName} - {player.Data.FriendCode} - {player.GetHashPuid()}");
diff --git a/src/Modules/AntiCheat/BetterAntiCheat.cs b/src/Modules/AntiCheat/BetterAntiCheat.cs
index 141f14b..006ee68 100644
--- a/src/Modules/AntiCheat/BetterAntiCheat.cs
+++ b/src/Modules/AntiCheat/BetterAntiCheat.cs
@@ -18,12 +18,15 @@ namespace BetterAmongUs.Modules.AntiCheat;
internal static class BetterAntiCheat
{
///
- /// Gets whether anti-cheat is enabled for the current player.
+ /// Gets whether anti-cheat is enabled.
///
internal static bool IsEnabled
{
get
{
+ if (GameState.IsModdedProtocol)
+ return false;
+
if (PlayerControl.LocalPlayer == null)
return false;
diff --git a/src/Modules/GameState.cs b/src/Modules/GameState.cs
index c6aebf2..a967441 100644
--- a/src/Modules/GameState.cs
+++ b/src/Modules/GameState.cs
@@ -246,7 +246,7 @@ internal static class GameState
{
get
{
- if (!IsVanillaServer)
+ if (IsFreePlay || IsLocalGame)
{
return false;
}
@@ -261,7 +261,7 @@ internal static class GameState
return false;
}
- if (PlayerControl.LocalPlayer.Data.AmOwner)
+ if (PlayerControl.LocalPlayer.Data.OwnerId == -2)
{
return true;
}
diff --git a/src/Network/RPC.cs b/src/Network/RPC.cs
index 737c359..7031652 100644
--- a/src/Network/RPC.cs
+++ b/src/Network/RPC.cs
@@ -1,6 +1,5 @@
using BetterAmongUs.Enums;
using BetterAmongUs.Helpers;
-using BetterAmongUs.Modules;
using BetterAmongUs.Mono.Extended;
using Hazel;
@@ -105,22 +104,6 @@ internal static class RPC
break;
}
}
- else if (!Enum.IsDefined(typeof(CustomRPC), (int)unchecked(callId)))
- {
- try
- {
- if (!GameState.IsHost)
- {
- if (player.IsHost())
- {
- var Icon = Translator.GetString("BAUMark");
- var BAU = $"{Icon}{Translator.GetString("BAU")}{Icon}";
- Utils.DisconnectSelf(string.Format(Translator.GetString("ModdedLobbyMsg"), BAU));
- }
- }
- }
- catch { }
- }
}
///
diff --git a/src/Patches/Gameplay/Player/PlayerControlPatch.cs b/src/Patches/Gameplay/Player/PlayerControlPatch.cs
index 2e61045..9152dde 100644
--- a/src/Patches/Gameplay/Player/PlayerControlPatch.cs
+++ b/src/Patches/Gameplay/Player/PlayerControlPatch.cs
@@ -2,6 +2,7 @@
using BepInEx.Unity.IL2CPP.Utils.Collections;
using BetterAmongUs.Data.Config;
using BetterAmongUs.Helpers;
+using BetterAmongUs.Managers;
using BetterAmongUs.Modules;
using BetterAmongUs.Modules.OptionItems;
using BetterAmongUs.Modules.Support;
@@ -27,24 +28,29 @@ internal static class PlayerControlPatch
OptionPlayerItem.UpdateAllValues();
// Append favorite color setting to player initialization coroutine
- __result = Effects.Sequence(__result, CoSetFavoriteColor(__instance).WrapToIl2Cpp());
+ __result = Effects.Sequence(__result, CoStartPostfix(__instance).WrapToIl2Cpp());
}
- private static IEnumerator CoSetFavoriteColor(PlayerControl player)
+ private static IEnumerator CoStartPostfix(PlayerControl player)
{
- if (BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_FavoriteColor))
- yield break;
-
- if (!GameState.IsLobby)
- yield break;
-
- // Apply player's favorite color setting if they own this character
- if (player.AmOwner)
+ if (GameState.IsLobby)
{
- if (BAUConfigs.FavoriteColor.Value >= 0 && player.cosmetics.ColorId != (byte)BAUConfigs.FavoriteColor.Value)
+ if (player.AmOwner)
{
- // Send command to server to change color
- player.CmdCheckColor((byte)BAUConfigs.FavoriteColor.Value);
+ // Apply player's favorite color setting if they own this character
+ if (!BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_FavoriteColor))
+ {
+ if (BAUConfigs.FavoriteColor.Value >= 0 && player.cosmetics.ColorId != (byte)BAUConfigs.FavoriteColor.Value)
+ {
+ // Send command to server to change color
+ player.CmdCheckColor((byte)BAUConfigs.FavoriteColor.Value);
+ }
+ }
+
+ if (GameState.IsModdedProtocol)
+ {
+ BetterNotificationManager.Notify(Translator.GetString("AntiCheat.DisabledModdedProtocol"), 6f, true);
+ }
}
}
diff --git a/src/Resources/Lang/en_US.json b/src/Resources/Lang/en_US.json
index c3dde26..53ab4f0 100644
--- a/src/Resources/Lang/en_US.json
+++ b/src/Resources/Lang/en_US.json
@@ -112,6 +112,7 @@
"AntiCheat.Ban": "Banned",
"AntiCheat.Kick": "Kicked",
"AntiCheat.PlayerDetected": "Player",
+ "AntiCheat.DisabledModdedProtocol": "Anti-Cheat has been temporarily disabled on modded protocol!",
"AntiCheat.UnauthorizedAction": "Has been detected doing an unauthorized action",
"AntiCheat.ByAntiCheat": "{0} by Anti-Cheat",
"AntiCheat.KickMessage": "{0}! Reason: {1}",