public static CommandManager GetInstance(MinecraftHandler mc) { // DoubleLock if (instance == null) { lock (m_lock) { if (instance == null) { instance = new CommandManager(mc); } } } return instance; }
public static string GetMatchedCommand(CommandManager helper, String guess) { int matches = 0; KeyValuePair<String, Command> firstMatch = new KeyValuePair<string, Command>(); foreach (KeyValuePair<String, Command> kvp in helper.Items) { if (kvp.Key.ToLower() == guess.ToLower()) { return kvp.Key; } if (kvp.Key.ToLower().Contains(guess.ToLower())) { if (matches == 0) { firstMatch = kvp; } matches++; } } if (matches == 1) return firstMatch.Key; else return ""; }