public DefaultShardManagerBuilder setShards(final int minShardId, final int maxShardId)
    {
        Checks.notNegative(minShardId, "minShardId");
        Checks.check(maxShardId < this.shardsTotal, "maxShardId must be lower than shardsTotal");
        Checks.check(minShardId <= maxShardId, "minShardId must be lower than or equal to maxShardId");

        List<Integer> shards = new ArrayList<>(maxShardId - minShardId + 1);
        for (int i = minShardId; i <= maxShardId; i++)
            shards.add(i);

        this.shards = shards;

        return this;
    }
public DefaultShardManagerBuilder setShards ( final int minShardId , final int maxShardId ) { Checks . notNegative ( minShardId , "minShardId" ) ; Checks . check ( maxShardId < this . shardsTotal , "maxShardId must be lower than shardsTotal" ) ; Checks . check ( minShardId <= maxShardId , "minShardId must be lower than or equal to maxShardId" ) ; List < Integer > shards = new ArrayList < > ( maxShardId - minShardId + 1 ) ; for ( int i = minShardId ; i <= maxShardId ; i ++ ) shards . add ( i ) ; this . shards = shards ; return this ; }
Sets the range of shards the {@link DefaultShardManager DefaultShardManager} should contain.
This is useful if you want to split your shards between multiple JVMs or servers.

<p><b>This does not have any effect if the total shard count is set to {@code -1} (get recommended shards from discord).</b>

@param  minShardId
The lowest shard id the DefaultShardManager should contain

@param  maxShardId
The highest shard id the DefaultShardManager should contain

@throws IllegalArgumentException
If either minShardId is negative, maxShardId is lower than shardsTotal or
minShardId is lower than or equal to maxShardId

@return The DefaultShardManagerBuilder instance. Useful for chaining.