From a8a584b61bf466bd01f8c654515733d66cd77a53 Mon Sep 17 00:00:00 2001
From: XtraCube <72575280+XtraCube@users.noreply.github.com>
Date: Sun, 18 May 2025 09:09:14 -0400
Subject: [PATCH] Fix bug with CustomRoleSingleton.cs
---
MiraAPI/Roles/CustomRoleSingleton.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/MiraAPI/Roles/CustomRoleSingleton.cs b/MiraAPI/Roles/CustomRoleSingleton.cs
index 808202c..90867af 100644
--- a/MiraAPI/Roles/CustomRoleSingleton.cs
+++ b/MiraAPI/Roles/CustomRoleSingleton.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
namespace MiraAPI.Roles;
@@ -8,12 +9,11 @@ namespace MiraAPI.Roles;
/// The role you are trying to access.
public static class CustomRoleSingleton where T : ICustomRole
{
- private static ICustomRole? _instance;
+ private static T? _instance;
///
/// Gets the instance of the role.
///
-#pragma warning disable CA1000
- public static ICustomRole Instance => _instance ??= CustomRoleManager.CustomRoles.Values.OfType().Single();
-#pragma warning restore CA1000
+ [SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "This is a utility class to get the instance of a custom role.")]
+ public static T Instance => _instance ??= CustomRoleManager.CustomRoles.Values.OfType().Single();
}