Incorrect method used and further specification
This commit is contained in:
parent
24abacdb8d
commit
14138d1c4c
1 changed files with 2 additions and 1 deletions
|
@ -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<PacketIdAttribute>(), 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)!;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue