|
@@ -170,19 +170,45 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
|
170
|
170
|
arg = Integer.MAX_VALUE;
|
171
|
171
|
}
|
172
|
172
|
doConfigStatsTop(origin, isSilent, arg);
|
173
|
|
- } else {
|
|
173
|
+ } else if (args[1].matches("^[0-9]+$")) {
|
174
|
174
|
try {
|
175
|
175
|
arg = Integer.parseInt(args[1]);
|
176
|
176
|
} catch (NumberFormatException e) {
|
177
|
177
|
arg = -1;
|
178
|
178
|
}
|
179
|
179
|
doConfigStatsCutOff(origin, isSilent, arg);
|
|
180
|
+ } else {
|
|
181
|
+ doConfigStatsOption(origin, isSilent, args[1]);
|
180
|
182
|
}
|
181
|
183
|
} else {
|
182
|
184
|
doConfigStatsCutOff(origin, isSilent, arg);
|
183
|
185
|
}
|
184
|
186
|
}
|
185
|
187
|
|
|
188
|
+ /**
|
|
189
|
+ * Shows stats related to the config system, showing any options matching
|
|
190
|
+ * the regex
|
|
191
|
+ *
|
|
192
|
+ * @param origin The window this command was executed in
|
|
193
|
+ * @param isSilent Whether this command has been silenced or not
|
|
194
|
+ * @param regex Regex to match options against
|
|
195
|
+ */
|
|
196
|
+ private void doConfigStatsOption(final InputWindow origin,
|
|
197
|
+ final boolean isSilent, final String regex) {
|
|
198
|
+ final SortedSet<Entry<String, Integer>> sortedStats = getSortedStats();
|
|
199
|
+ boolean found = false;
|
|
200
|
+ for (Map.Entry<String, Integer> entry : sortedStats) {
|
|
201
|
+ if (entry.getKey().matches(regex)) {
|
|
202
|
+ sendLine(origin, isSilent, FORMAT_OUTPUT, entry.getKey() + " - " +
|
|
203
|
+ entry.getValue());
|
|
204
|
+ found = true;
|
|
205
|
+ }
|
|
206
|
+ }
|
|
207
|
+ if (!found) {
|
|
208
|
+ sendLine(origin, isSilent, FORMAT_ERROR, "Unable to locate option.");
|
|
209
|
+ }
|
|
210
|
+ }
|
|
211
|
+
|
186
|
212
|
/**
|
187
|
213
|
* Shows stats related to the config system, listing the top X number of
|
188
|
214
|
* options.
|