Use better code
This commit is contained in:
parent
608e7a99bc
commit
75c8a8ced4
32 changed files with 77 additions and 105 deletions
|
|
@ -33,9 +33,9 @@ namespace TShockAPI.Handlers.NetModules
|
|||
{
|
||||
INetModuleHandler handler;
|
||||
|
||||
if (NetModulesToHandlersMap.ContainsKey(args.ModuleType))
|
||||
if (NetModulesToHandlersMap.TryGetValue(args.ModuleType, out Type type))
|
||||
{
|
||||
handler = (INetModuleHandler)Activator.CreateInstance(NetModulesToHandlersMap[args.ModuleType]);
|
||||
handler = (INetModuleHandler)Activator.CreateInstance(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue