mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
skip abstract types correctly
This commit is contained in:
9 files changed
+10
-16
No files matched your search
@@ -17,12 +17,7 @@ public static class GameOverManager
|
||||
|
||||
internal static bool RegisterGameOver(Type type, in MiraPluginManager.RegistrationContext _)
|
||||
{
|
||||
if (!typeof(CustomGameOver).IsAssignableFrom(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type.IsAbstract)
|
||||
if (type.IsAbstract || !typeof(CustomGameOver).IsAssignableFrom(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public static class CustomGameModeManager
|
||||
|
||||
internal static bool RegisterGameMode(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!typeof(AbstractGameMode).IsAssignableFrom(type))
|
||||
if (type.IsAbstract || !typeof(AbstractGameMode).IsAssignableFrom(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ public class ModdedEnumOptionAttribute(string? title, Type enumType, string idPr
|
||||
/// <inheritdoc />
|
||||
public override void SetValue(object value)
|
||||
{
|
||||
var opt = HolderOption as ModdedEnumOption;
|
||||
opt?.SetValue((int)value);
|
||||
(HolderOption as ModdedEnumOption)?.SetValue((int)value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -73,7 +73,7 @@ public static class ModdedOptionsManager
|
||||
|
||||
internal static bool RegisterGroup(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!type.IsAssignableTo(typeof(AbstractOptionGroup)))
|
||||
if (type.IsAbstract || !type.IsAssignableTo(typeof(AbstractOptionGroup)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public static class CustomButtonManager
|
||||
|
||||
internal static bool RegisterButton(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!type.IsAssignableTo(typeof(CustomActionButton)) || Activator.CreateInstance(type) is not CustomActionButton button)
|
||||
if (type.IsAbstract || !type.IsAssignableTo(typeof(CustomActionButton)) || Activator.CreateInstance(type) is not CustomActionButton button)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public static class LocalSettingsManager
|
||||
|
||||
internal static bool RegisterLocalTabs(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!type.IsAssignableTo(typeof(LocalSettingsTab)))
|
||||
if (type.IsAbstract || !type.IsAssignableTo(typeof(LocalSettingsTab)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public static class MeetingButtonManager
|
||||
|
||||
internal static bool RegisterTargetedMeetingButton(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!typeof(TargetedMeetingButton).IsAssignableFrom(type))
|
||||
if (type.IsAbstract || !typeof(TargetedMeetingButton).IsAssignableFrom(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public static class MeetingButtonManager
|
||||
|
||||
internal static bool RegisterMeetingButton(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!typeof(MeetingActionButton).IsAssignableFrom(type))
|
||||
if (type.IsAbstract || !typeof(MeetingActionButton).IsAssignableFrom(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public static class ModifierManager
|
||||
|
||||
internal static bool RegisterModifier(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!typeof(BaseModifier).IsAssignableFrom(type))
|
||||
if (type.IsAbstract || !typeof(BaseModifier).IsAssignableFrom(type))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public static class CustomRoleManager
|
||||
|
||||
internal static bool RegisterRole(Type type, in MiraPluginManager.RegistrationContext context)
|
||||
{
|
||||
if (!(typeof(RoleBehaviour).IsAssignableFrom(type) && typeof(ICustomRole).IsAssignableFrom(type)))
|
||||
if (type.IsAbstract || !(typeof(RoleBehaviour).IsAssignableFrom(type) && typeof(ICustomRole).IsAssignableFrom(type)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user