Class JDA.ShardInfo

java.lang.Object
net.dv8tion.jda.api.JDA.ShardInfo
Enclosing interface:
JDA

public static class JDA.ShardInfo extends Object
Represents the information used to create this shard.
  • Field Details

    • SINGLE

      public static final JDA.ShardInfo SINGLE
      Default sharding config with one shard
  • Constructor Details

    • ShardInfo

      public ShardInfo(int shardId, int shardTotal)
  • Method Details

    • getShardId

      public int getShardId()
      Represents the id of the shard of the current instance.
      This value will be between 0 and (getShardTotal() - 1).
      Returns:
      The id of the currently logged in shard.
    • getShardTotal

      public int getShardTotal()
      The total amount of shards based on the value provided during JDA instance creation using JDABuilder.useSharding(int, int).
      This does not query Discord to determine the total number of shards.
      This does not represent the amount of logged in shards.
      It strictly represents the integer value provided to discord representing the total amount of shards that the developer indicated that it was going to use when initially starting JDA.
      Returns:
      The total of shards based on the total provided by the developer during JDA initialization.
    • getShardString

      public String getShardString()
      Provides a shortcut method for easily printing shard info.
      Format: "[# / #]"
      Where the first # is shardId and the second # is shardTotal.
      Returns:
      A String representing the information used to build this shard.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object