|
@@ -172,11 +172,14 @@ public abstract class CommandParser implements Serializable {
|
172
|
172
|
builder.append(arg);
|
173
|
173
|
}
|
174
|
174
|
|
175
|
|
- history.add(new PreviousCommand(builder.toString()));
|
176
|
|
-
|
177
|
|
- while (history.size() >
|
178
|
|
- IdentityManager.getGlobalConfig().getOptionInt("general", "commandhistory", 10)) {
|
179
|
|
- history.remove(0);
|
|
175
|
+ synchronized(history) {
|
|
176
|
+ history.add(new PreviousCommand(builder.toString()));
|
|
177
|
+
|
|
178
|
+ int historysize = IdentityManager.getGlobalConfig().getOptionInt("general",
|
|
179
|
+ "commandhistory", 10);
|
|
180
|
+ while (history.size() > historysize) {
|
|
181
|
+ history.remove(0);
|
|
182
|
+ }
|
180
|
183
|
}
|
181
|
184
|
}
|
182
|
185
|
|
|
@@ -189,10 +192,12 @@ public abstract class CommandParser implements Serializable {
|
189
|
192
|
*/
|
190
|
193
|
public long getCommandTime(final String command) {
|
191
|
194
|
long res = 0;
|
192
|
|
-
|
193
|
|
- for (PreviousCommand pc : history) {
|
194
|
|
- if (pc.getLine().matches("(?i)" + command)) {
|
195
|
|
- res = Math.max(res, pc.getTime());
|
|
195
|
+
|
|
196
|
+ synchronized(history) {
|
|
197
|
+ for (PreviousCommand pc : history) {
|
|
198
|
+ if (pc.getLine().matches("(?i)" + command)) {
|
|
199
|
+ res = Math.max(res, pc.getTime());
|
|
200
|
+ }
|
196
|
201
|
}
|
197
|
202
|
}
|
198
|
203
|
|