Sanity check debugging

Verbose value setting and debug print outs
This commit is contained in:
Kaleb Schmenk
2025-04-07 17:01:57 -04:00
parent a5a5809a34
commit 65101d7490

View File

@@ -72,32 +72,20 @@ public class AutoRTD(IRTDRewarder rewarder, IAutoRTDLocale locale,
public void Command_AutoRTD(CCSPlayerController? executor, CommandInfo info) {
if (executor == null) return;
rtdLocale.DebugPrintMessage($"You are bypassing permission checks. Do NOT let this go into release. Remove the commented lines.").ToChat(executor);
// if (RTDCommand.CV_RTD_ENABLED.Value == -1) {
// rtdLocale.RollingDisabled().ToChat(executor);
// return;
// }
rtdLocale.DebugPrintMessage($"You are bypassing permission checks. Do NOT let this go into release. Remove the commented lines.").ToChat(executor);
// if (!AdminManager.PlayerHasPermissions(executor, CV_AUTORTD_FLAG.Value)) {
// generic.NoPermissionMessage(CV_AUTORTD_FLAG.Value).ToChat(executor);
// return;
// }
if (cookie == null) {
//locale.TogglingNotEnabled.ToChat(executor);
rtdLocale.DebugPrintMessage($"Cookie was null. Trying to get again...").ToChat(executor);
// try again to get cookie
Task.Run(async () => {
if (API.Actain != null)
cookie = await API.Actain.getCookieService()
.RegClientCookie("jb_rtd_auto");
});
if (cookie == null) {
rtdLocale.DebugPrintMessage($"Failed again to get cookie.").ToChat(executor);
}
locale.TogglingNotEnabled.ToChat(executor);
rtdLocale.DebugPrintMessage($"Cookie was null. Early returning.").ToChat(executor);
return;
}
@@ -105,18 +93,22 @@ public class AutoRTD(IRTDRewarder rewarder, IAutoRTDLocale locale,
Task.Run(async () => {
var value = await cookie.Get(steam);
// Debugging value return from cookie.Get
//var enable = value is not (null or "Y");
bool enable;
if (value != null) {
rtdLocale.DebugPrintMessage($"Value was: {value}!").ToChat(executor);
if (value != "Y") {
rtdLocale.DebugPrintMessage($"Value was not Y").ToChat(executor);
enable = true;
} else {
rtdLocale.DebugPrintMessage($"Value was Y").ToChat(executor);
enable = false;
}
} else {
rtdLocale.DebugPrintMessage($"Value was: null!").ToChat(executor);
rtdLocale.DebugPrintMessage($"Value was null").ToChat(executor);
enable = false;
}
var enable = value is not (null or "Y");
// Debugging enable value
rtdLocale.DebugPrintMessage($"Enable was: {enable}!").ToChat(executor);
await cookie.Set(steam, enable ? "Y" : "N");
await Server.NextFrameAsync(() => {
if (!executor.IsValid) return;