Java Code Examples for net.dv8tion.jda.api.JDA#Status

The following examples show how to use net.dv8tion.jda.api.JDA#Status . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PresenceImpl.java    From JDA with Apache License 2.0 5 votes vote down vote up
protected void update(DataObject data)
{
    JDA.Status status = api.getStatus();
    if (status == JDA.Status.RECONNECT_QUEUED || status == JDA.Status.SHUTDOWN || status == JDA.Status.SHUTTING_DOWN)
        return;
    api.getClient().send(DataObject.empty()
        .put("d", data)
        .put("op", WebSocketCode.PRESENCE).toString());
}
 
Example 2
Source File: StatusChangeEvent.java    From JDA with Apache License 2.0 4 votes vote down vote up
public StatusChangeEvent(@Nonnull JDA api, @Nonnull JDA.Status newStatus, @Nonnull JDA.Status oldStatus)
{
    super(api);
    this.newStatus = newStatus;
    this.oldStatus = oldStatus;
}
 
Example 3
Source File: StatusChangeEvent.java    From JDA with Apache License 2.0 4 votes vote down vote up
/**
 * The status that we changed to
 *
 * @return The new status
 */
@Nonnull
public JDA.Status getNewStatus()
{
    return newStatus;
}
 
Example 4
Source File: StatusChangeEvent.java    From JDA with Apache License 2.0 4 votes vote down vote up
/**
 * The previous status
 *
 * @return The previous status
 */
@Nonnull
public JDA.Status getOldStatus()
{
    return oldStatus;
}
 
Example 5
Source File: StatusChangeEvent.java    From JDA with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public JDA.Status getOldValue()
{
    return oldStatus;
}
 
Example 6
Source File: StatusChangeEvent.java    From JDA with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public JDA.Status getNewValue()
{
    return newStatus;
}
 
Example 7
Source File: ShardManager.java    From JDA with Apache License 2.0 3 votes vote down vote up
/**
 * This returns the {@link net.dv8tion.jda.api.JDA.Status JDA.Status} of the shard which has the same id as the one provided.
 * <br>If there is no shard with an id that matches the provided one, then this returns {@code null}.
 *
 * @param  shardId
 *         The id of the shard.
 *
 * @return The {@link net.dv8tion.jda.api.JDA.Status JDA.Status} of the shard with the given shardId or
 *         {@code null} if no shard has the given id
 */
@Nullable
default JDA.Status getStatus(final int shardId)
{
    final JDA jda = this.getShardCache().getElementById(shardId);
    return jda == null ? null : jda.getStatus();
}