File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/main/java/me/creepermaxcz/mcbots Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -459,14 +459,33 @@ else if (commandName.equalsIgnoreCase("list") || commandName.equalsIgnoreCase("l
459459
460460 else if (commandName .equalsIgnoreCase ("leave" ) || commandName .equalsIgnoreCase ("exit" ))
461461 {
462+ int limit = -1 ;
463+ if (split .length >= 2 ) {
464+ try {
465+ limit = Integer .parseInt (split [1 ]);
466+ } catch (NumberFormatException e ) {
467+ limit = 0 ;
468+ Log .warn ("Invalid limit." );
469+ }
470+ }
471+
472+ int i = 0 ;
462473 if (!controlledBots .isEmpty ()) {
463474 Log .info ("Disconnecting controlled bots." );
464475 for (Bot bot : controlledBots ) {
476+ if (i ++ == limit ) {
477+ break ;
478+ }
479+
465480 bot .disconnect ();
466481 }
467482 } else {
468483 Log .info ("Disconnecting all bots." );
469484 for (Bot bot : bots ) {
485+ if (i ++ == limit ) {
486+ break ;
487+ }
488+
470489 bot .disconnect ();
471490 }
472491 }
You can’t perform that action at this time.
0 commit comments