From 14138d1c4ccfbd1555c91f3a0986cde64e290e88 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Thu, 29 Dec 2022 12:10:57 +0100 Subject: [PATCH] Incorrect method used and further specification --- Server.Packets/PacketForwardingService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Server.Packets/PacketForwardingService.cs b/Server.Packets/PacketForwardingService.cs index 794af3e..8f08b79 100644 --- a/Server.Packets/PacketForwardingService.cs +++ b/Server.Packets/PacketForwardingService.cs @@ -17,7 +17,8 @@ public class PacketForwardingService // Get all types that implement IPacket and have a PacketIdAttribute _packets = assembly.GetTypes() .Select(x => (attr: x.GetCustomAttribute(), ctor: x.GetConstructor(Type.EmptyTypes))) - .Where(x => x.attr != null && x.ctor != null && x.GetType().IsAssignableFrom(typeof(IPacket))) + .Where(x => x.attr != null && x.ctor != null && x.GetType().IsAssignableTo(typeof(IPacket)) && + x.GetType().IsClass) .ToImmutableDictionary(x => x.attr!.PacketId, x => x.ctor)!; }