Class JDA.ShardInfo

  • Enclosing interface:
    JDA

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

      Fields 
      Modifier and Type Field Description
      static JDA.ShardInfo SINGLE
      Default sharding config with one shard
    • Constructor Summary

      Constructors 
      Constructor Description
      ShardInfo​(int shardId, int shardTotal)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int getShardId()
      Represents the id of the shard of the current instance.
      java.lang.String getShardString()
      Provides a shortcut method for easily printing shard info.
      int getShardTotal()
      The total amount of shards based on the value provided during JDA instance creation using JDABuilder.useSharding(int, int).
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • SINGLE

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

      • ShardInfo

        public ShardInfo​(int shardId,
                         int shardTotal)
    • Method Detail

      • 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 java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object