Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. static Dictionary<string, MethodInfo> CommandList = new Dictionary<string, MethodInfo>();
  2.  
  3.     static CommandManager()
  4.     {
  5.         CommandList = Assembly.GetExecutingAssembly().GetTypes()
  6.                       .SelectMany(t => t.GetMethods())
  7.                       .Where(m => m.GetCustomAttributes(typeof(ChatCommandAttribute), false).Length > 0)
  8.                       .ToDictionary(m => m.Name.ToLower(), m => m);
  9.     }
  10.  
  11. [AttributeUsage(AttributeTargets.Method)]
  12. public class ChatCommandAttribute : Attribute
  13. {
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement