diff --git a/src/main/java/net/dv8tion/jda/api/JDA.java b/src/main/java/net/dv8tion/jda/api/JDA.java index e5fb70beee..c4feeb5ba0 100644 --- a/src/main/java/net/dv8tion/jda/api/JDA.java +++ b/src/main/java/net/dv8tion/jda/api/JDA.java @@ -1026,6 +1026,8 @@ default User getUserById(long id) * *
This will only check cached users! * + *
To check users without discriminators, use {@code username#0000} instead.
+ *
* @param tag
* The Discord Tag in the format {@code Username#Discriminator}
*
@@ -1035,7 +1037,6 @@ default User getUserById(long id)
* @return The {@link net.dv8tion.jda.api.entities.User} for the discord tag or null if no user has the provided tag
*/
@Nullable
- @Incubating
default User getUserByTag(@Nonnull String tag)
{
Checks.notNull(tag, "Tag");
@@ -1069,16 +1070,13 @@ default User getUserByTag(@Nonnull String tag)
* @return The {@link net.dv8tion.jda.api.entities.User} for the discord tag or null if no user has the provided tag
*/
@Nullable
- @Incubating
- default User getUserByTag(@Nonnull String username, @Nonnull String discriminator)
+ default User getUserByTag(@Nonnull String username, @Nullable String discriminator)
{
- Checks.notNull(username, "Username");
- Checks.notNull(discriminator, "Discriminator");
- Checks.check(discriminator.length() == 4 && Helpers.isNumeric(discriminator), "Invalid format for discriminator!");
- int codePointLength = Helpers.codePointLength(username);
- Checks.check(codePointLength >= 2 && codePointLength <= 32, "Username must be between 2 and 32 codepoints in length!");
+ Checks.inRange(username, 2, 32, "Username");
+ Checks.check(discriminator == null || discriminator.length() == 4 && Helpers.isNumeric(discriminator), "Invalid format for discriminator! Provided: %s", discriminator);
+ String actualDiscriminator = discriminator == null ? "0000" : discriminator;
return getUserCache().applyStream(stream ->
- stream.filter(it -> it.getDiscriminator().equals(discriminator))
+ stream.filter(it -> it.getDiscriminator().equals(actualDiscriminator))
.filter(it -> it.getName().equals(username))
.findFirst()
.orElse(null)
diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java
index 170ee79607..deceb43870 100644
--- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java
+++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java
@@ -16,8 +16,6 @@
package net.dv8tion.jda.api;
import com.neovisionaries.ws.client.WebSocketFactory;
-import net.dv8tion.jda.annotations.ForRemoval;
-import net.dv8tion.jda.annotations.ReplaceWith;
import net.dv8tion.jda.api.audio.factory.IAudioSendFactory;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.events.Event;
@@ -547,32 +545,6 @@ public JDABuilder setEventPassthrough(boolean enable)
return setFlag(ConfigFlag.EVENT_PASSTHROUGH, enable);
}
- /**
- * Whether the rate-limit should be relative to the current time plus latency.
- *
By default we use the {@code X-RateLimit-Reset-After} header to determine when
- * a rate-limit is no longer imminent. This has the disadvantage that it might wait longer than needed due
- * to the latency which is ignored by the reset-after relative delay.
- *
- *
When disabled, we will use the {@code X-RateLimit-Reset} absolute timestamp instead which accounts for - * latency but requires a properly NTP synchronized clock to be present. - * If your system does have this feature you might gain a little quicker rate-limit handling than the default allows. - * - *
Default: true
- *
- * @param enable
- * True, if the relative {@code X-RateLimit-Reset-After} header should be used.
- *
- * @return The JDABuilder instance. Useful for chaining.
- */
- @Nonnull
- @Deprecated
- @ForRemoval(deadline = "5.1.0")
- @ReplaceWith("setRestConfig(new RestConfig().setRelativeRateLimit(enable))")
- public JDABuilder setRelativeRateLimit(boolean enable)
- {
- return setFlag(ConfigFlag.USE_RELATIVE_RATELIMIT, enable);
- }
-
/**
* Custom {@link RestConfig} to use for this JDA instance.
*
This can be used to customize how rate-limits are handled and configure a custom http proxy.
@@ -903,67 +875,7 @@ public JDABuilder setWebsocketFactory(@Nullable WebSocketFactory factory)
* the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
* and should be handled carefully. Only change this pool if you know what you're doing.
*
This automatically disables the automatic shutdown of the rate-limit pool, you can enable
- * it using {@link #setRateLimitPool(ScheduledExecutorService, boolean) setRateLimitPool(executor, true)}
- *
- *
This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions. - * Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)} - * and similar methods. - * - *
Default: {@link ScheduledThreadPoolExecutor} with 5 threads. - * - * @param pool - * The thread-pool to use for rate-limit handling - * - * @return The JDABuilder instance. Useful for chaining. - * - * @deprecated This pool is now split into two pools. - * You should use {@link #setRateLimitScheduler(ScheduledExecutorService)} and {@link #setRateLimitElastic(ExecutorService)} instead. - */ - @Nonnull - @Deprecated - @ReplaceWith("setRateLimitScheduler(pool)") - public JDABuilder setRateLimitPool(@Nullable ScheduledExecutorService pool) - { - return setRateLimitPool(pool, pool == null); - } - - /** - * Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in - * the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution - * and should be handled carefully. Only change this pool if you know what you're doing. - * - *
This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions. - * Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)} - * and similar methods. - * - *
Default: {@link ScheduledThreadPoolExecutor} with 5 threads.
- *
- * @param pool
- * The thread-pool to use for rate-limit handling
- * @param automaticShutdown
- * Whether {@link JDA#shutdown()} should shutdown this pool
- *
- * @return The JDABuilder instance. Useful for chaining.
- *
- * @deprecated This pool is now split into two pools.
- * You should use {@link #setRateLimitScheduler(ScheduledExecutorService, boolean)} and {@link #setRateLimitElastic(ExecutorService, boolean)} instead.
- */
- @Nonnull
- @Deprecated
- @ReplaceWith("setRateLimitScheduler(pool, automaticShutdown)")
- public JDABuilder setRateLimitPool(@Nullable ScheduledExecutorService pool, boolean automaticShutdown)
- {
- this.rateLimitScheduler = pool;
- this.shutdownRateLimitScheduler = automaticShutdown;
- return this;
- }
-
- /**
- * Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in
- * the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
- * and should be handled carefully. Only change this pool if you know what you're doing.
- *
This automatically disables the automatic shutdown of the rate-limit pool, you can enable
- * it using {@link #setRateLimitPool(ScheduledExecutorService, boolean) setRateLimitPool(executor, true)}
+ * it using {@link #setRateLimitScheduler(ScheduledExecutorService, boolean) setRateLimitScheduler(executor, true)}
*
*
This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions. * Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)} diff --git a/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionListener.java b/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionListener.java index 2c67861570..e76fa4bdff 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionListener.java +++ b/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionListener.java @@ -16,8 +16,6 @@ package net.dv8tion.jda.api.audio.hooks; -import net.dv8tion.jda.annotations.ForRemoval; -import net.dv8tion.jda.annotations.ReplaceWith; import net.dv8tion.jda.api.audio.SpeakingMode; import net.dv8tion.jda.api.entities.User; import net.dv8tion.jda.api.entities.UserSnowflake; @@ -38,7 +36,7 @@ public interface ConnectionListener * @param ping * The time, in milliseconds, for round-trip packet travel to discord. */ - void onPing(long ping); + default void onPing(long ping) {} /** * Called when the status of the audio channel changes. Used to track the connection state of the audio connection @@ -47,110 +45,7 @@ public interface ConnectionListener * @param status * The new {@link net.dv8tion.jda.api.audio.hooks.ConnectionStatus ConnectionStatus} of the audio connection. */ - void onStatusChange(@Nonnull ConnectionStatus status); - - /** - * This method is an easy way to detect if a user is talking. Discord sends us an event when a user starts or stops - * talking and it is parallel to the audio socket, so this event could come milliseconds before or after audio begins - * or stops. This method is brilliant for clients wanting to display that a user is currently talking. - *
- * Unlike the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleCombinedAudio(net.dv8tion.jda.api.audio.CombinedAudio)
- * AudioReceiveHandler.handleCombinedAudio(CombinedAudio)} and
- * {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} methods which are
- * fired extremely often, this method is fired as a flag for the beginning and ending of audio transmission, and as such
- * is only fired when that changes. So while the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} method is fired every time JDA receives audio data from Discord,
- * this is only fired when that stream starts and when it stops.
- *
- * Unlike the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleCombinedAudio(net.dv8tion.jda.api.audio.CombinedAudio)
- * AudioReceiveHandler.handleCombinedAudio(CombinedAudio)} and
- * {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} methods which are
- * fired extremely often, this method is fired as a flag for the beginning and ending of audio transmission, and as such
- * is only fired when that changes. So while the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} method is fired every time JDA receives audio data from Discord,
- * this is only fired when that stream starts and when it stops.
- *
- * Unlike the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleCombinedAudio(net.dv8tion.jda.api.audio.CombinedAudio)
- * AudioReceiveHandler.handleCombinedAudio(CombinedAudio)} and
- * {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} methods which are
- * fired extremely often, this method is fired as a flag for the beginning and ending of audio transmission, and as such
- * is only fired when that changes. So while the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} method is fired every time JDA receives audio data from Discord,
- * this is only fired when that stream starts and when it stops.
- * Possible Keys Possible Keys Expected type: Integer
- *
- * @deprecated Use {@link #CHANNEL_SLOWMODE} instead
- */
- @Deprecated
- @ForRemoval
- @DeprecatedSince("5.0.0")
- @ReplaceWith("CHANNEL_SLOWMODE")
- THREAD_SLOWMODE("rate_limit_per_user"),
-
/**
* Change of the {@link ThreadChannel#getAutoArchiveDuration() ThreadChannel.getAutoArchiveDuration()} value.
*
diff --git a/src/main/java/net/dv8tion/jda/api/entities/Guild.java b/src/main/java/net/dv8tion/jda/api/entities/Guild.java
index 2e553787ee..1181bc037f 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java
@@ -1214,14 +1214,8 @@ default Member getMemberById(long userId)
* @return The {@link net.dv8tion.jda.api.entities.Member} for the discord tag or null if no member has the provided tag
*
* @see net.dv8tion.jda.api.JDA#getUserByTag(String)
- *
- * @deprecated This will become obsolete in the future.
- * Discriminators are being phased out and replaced by globally unique usernames.
- * For more information, see New Usernames & Display Names.
*/
@Nullable
- @Deprecated
- @ForRemoval
default Member getMemberByTag(@Nonnull String tag)
{
User user = getJDA().getUserByTag(tag);
@@ -1254,14 +1248,8 @@ default Member getMemberByTag(@Nonnull String tag)
* @return The {@link net.dv8tion.jda.api.entities.Member} for the discord tag or null if no member has the provided tag
*
* @see #getMemberByTag(String)
- *
- * @deprecated This will become obsolete in the future.
- * Discriminators are being phased out and replaced by globally unique usernames.
- * For more information, see New Usernames & Display Names.
*/
@Nullable
- @Deprecated
- @ForRemoval
default Member getMemberByTag(@Nonnull String username, @Nonnull String discriminator)
{
User user = getJDA().getUserByTag(username, discriminator);
diff --git a/src/main/java/net/dv8tion/jda/api/entities/Member.java b/src/main/java/net/dv8tion/jda/api/entities/Member.java
index 3411c2d32c..4106f616a2 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/Member.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/Member.java
@@ -16,10 +16,7 @@
package net.dv8tion.jda.api.entities;
-import net.dv8tion.jda.annotations.DeprecatedSince;
-import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.annotations.Incubating;
-import net.dv8tion.jda.annotations.ReplaceWith;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.Permission;
@@ -553,50 +550,6 @@ default AuditableRestAction Note: {@link net.dv8tion.jda.api.entities.Guild#getMembers()} will still contain the {@link net.dv8tion.jda.api.entities.Member Member}
- * until Discord sends the {@link net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent GuildMemberRemoveEvent}.
- *
- * Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by
- * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following:
- * Example Example Example Example Example For most users, no discriminator is used and this will be {@code "0000"} instead.
+ * The primary use-case for discriminators is bot and guest accounts, to prevent name squatting.
*
- * @deprecated This will become obsolete in the future.
- * Discriminators are being phased out and replaced by globally unique usernames.
- * For more information, see New Usernames & Display Names.
+ * @return Never-null String containing the {@link net.dv8tion.jda.api.entities.User User} discriminator.
*/
@Nonnull
- @Deprecated
- @ForRemoval
String getDiscriminator();
/**
@@ -257,16 +252,11 @@ default ImageProxy getEffectiveAvatar()
* The "tag" for this user
* This is the equivalent of calling {@link java.lang.String#format(String, Object...) String.format}("%#s", user)
*
- * @return Never-null String containing the tag for this user, for example DV8FromTheWorld#6297
+ * Users without a discriminator use {@code #0000} instead.
*
- * @deprecated This will become obsolete in the future.
- * Discriminators are being phased out and replaced by globally unique usernames.
- * For more information, see New Usernames & Display Names.
+ * @return Never-null String containing the tag for this user, for example DV8FromTheWorld#6297
*/
@Nonnull
- @Deprecated
- @ForRemoval
- @ReplaceWith("getName()")
String getAsTag();
/**
diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateDiscriminatorEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateDiscriminatorEvent.java
index cc35f771f7..a2fbd410ef 100644
--- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateDiscriminatorEvent.java
+++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateDiscriminatorEvent.java
@@ -16,7 +16,6 @@
package net.dv8tion.jda.api.events.self;
-import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.api.JDA;
import javax.annotation.Nonnull;
@@ -27,13 +26,7 @@
* Can be used to retrieve the old discriminator.
*
* Identifier: {@code discriminator}
- *
- * @deprecated This will become obsolete in the future.
- * Discriminators are being phased out and replaced by globally unique usernames.
- * For more information, see New Usernames & Display Names.
*/
-@Deprecated
-@ForRemoval
public class SelfUpdateDiscriminatorEvent extends GenericSelfUpdateEvent If the delay is less than 200 milliseconds it will use the minimum delay. The provided delay
- * will be aligned to the audio frame length of 20 milliseconds by means of integer division. This means
- * it will be rounded down to the next biggest multiple of 20.
- *
- * Note that this delay is not reliable and operates entirely based on the send system polling times
- * which can cause it to be released earlier or later than the provided delay specifies.
- *
- * @param millis
- * The delay that should be used, in milliseconds
- *
- * @since 4.0.0
- */
- @Deprecated
- @ForRemoval
- void setSpeakingDelay(int millis);
-
/**
* Gets the {@link net.dv8tion.jda.api.JDA JDA} instance that this AudioManager is a part of.
*
diff --git a/src/main/java/net/dv8tion/jda/api/managers/StageInstanceManager.java b/src/main/java/net/dv8tion/jda/api/managers/StageInstanceManager.java
index 55056df2f7..630265a5dc 100644
--- a/src/main/java/net/dv8tion/jda/api/managers/StageInstanceManager.java
+++ b/src/main/java/net/dv8tion/jda/api/managers/StageInstanceManager.java
@@ -16,6 +16,7 @@
package net.dv8tion.jda.api.managers;
+import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.api.entities.StageInstance;
import javax.annotation.CheckReturnValue;
@@ -116,13 +117,15 @@ public interface StageInstanceManager extends Manager This will also update user information such as name/avatar.
*/
GUILD_MEMBERS(1),
- /**
- * Ban events.
- */
- @Deprecated
- @ForRemoval
- @DeprecatedSince("5.0.0-beta.4")
- @ReplaceWith("GUILD_MODERATION")
- GUILD_BANS(2),
/**
* Moderation events, such as ban/unban/audit-log.
*/
diff --git a/src/main/java/net/dv8tion/jda/api/requests/RestRateLimiter.java b/src/main/java/net/dv8tion/jda/api/requests/RestRateLimiter.java
index c87d710a0b..29e423a837 100644
--- a/src/main/java/net/dv8tion/jda/api/requests/RestRateLimiter.java
+++ b/src/main/java/net/dv8tion/jda/api/requests/RestRateLimiter.java
@@ -16,7 +16,6 @@
package net.dv8tion.jda.api.requests;
-import net.dv8tion.jda.annotations.ReplaceWith;
import net.dv8tion.jda.api.JDA;
import okhttp3.Response;
import org.jetbrains.annotations.Blocking;
@@ -268,19 +267,6 @@ public RateLimitConfig(@Nonnull ScheduledExecutorService scheduler, @Nonnull Exe
this.isRelative = isRelative;
}
- /**
- * The {@link ScheduledExecutorService} used to schedule rate-limit tasks.
- *
- * @return The {@link ScheduledExecutorService}
- */
- @Nonnull
- @Deprecated
- @ReplaceWith("getScheduler() or getElastic()")
- public ScheduledExecutorService getPool()
- {
- return scheduler;
- }
-
/**
* The {@link ScheduledExecutorService} used to schedule rate-limit tasks.
*
diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/StageInstanceAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/StageInstanceAction.java
index 1d19a5c039..f19ea5cff6 100644
--- a/src/main/java/net/dv8tion/jda/api/requests/restaction/StageInstanceAction.java
+++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/StageInstanceAction.java
@@ -16,6 +16,7 @@
package net.dv8tion.jda.api.requests.restaction;
+import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.api.entities.StageInstance;
import net.dv8tion.jda.api.requests.RestAction;
@@ -68,13 +69,15 @@ public interface StageInstanceAction extends RestAction When disabled, we will use the {@code X-RateLimit-Reset} absolute timestamp instead which accounts for
- * latency but requires a properly NTP synchronized clock to be present.
- * If your system does have this feature you might gain a little quicker rate-limit handling than the default allows.
- *
- * Default: true
- *
- * @param enable
- * True, if the relative {@code X-RateLimit-Reset-After} header should be used.
- *
- * @return The DefaultShardManagerBuilder instance. Useful for chaining.
- *
- * @since 4.1.0
- */
- @Nonnull
- @Deprecated
- @ForRemoval(deadline = "5.1.0")
- @ReplaceWith("setRestConfig(new RestConfig().setRelativeRateLimit(enable))")
- public DefaultShardManagerBuilder setRelativeRateLimit(boolean enable)
- {
- return setFlag(ConfigFlag.USE_RELATIVE_RATELIMIT, enable);
- }
-
/**
* Custom {@link RestConfig} to use.
* This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions.
- * Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)}
- * and similar methods.
- *
- * Default: Shared {@link ScheduledThreadPoolExecutor} with ({@code 2 * }{@link #setShardsTotal(int) shard_total}) threads.
- *
- * @param pool
- * The thread-pool to use for rate-limit handling
- *
- * @return The DefaultShardManagerBuilder instance. Useful for chaining.
- *
- * @deprecated This pool is now split into two pools.
- * You should use {@link #setRateLimitScheduler(ScheduledExecutorService)} and {@link #setRateLimitElastic(ExecutorService)} instead.
- */
- @Nonnull
- @Deprecated
- @ReplaceWith("setRateLimitScheduler(pool) or setRateLimitElastic(pool)")
- public DefaultShardManagerBuilder setRateLimitPool(@Nullable ScheduledExecutorService pool)
- {
- return setRateLimitPool(pool, pool == null);
- }
-
- /**
- * Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in
- * the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
- * and should be handled carefully. Only change this pool if you know what you're doing.
- * This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions.
- * Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)}
- * and similar methods.
- *
- * Default: Shared {@link ScheduledThreadPoolExecutor} with ({@code 2 * }{@link #setShardsTotal(int) shard_total}) threads.
- *
- * @param pool
- * The thread-pool to use for rate-limit handling
- * @param automaticShutdown
- * Whether {@link net.dv8tion.jda.api.JDA#shutdown()} should automatically shutdown this pool
- *
- * @return The DefaultShardManagerBuilder instance. Useful for chaining.
- *
- * @deprecated This pool is now split into two pools.
- * You should use {@link #setRateLimitScheduler(ScheduledExecutorService, boolean)} and {@link #setRateLimitElastic(ExecutorService, boolean)} instead.
- */
- @Nonnull
- @Deprecated
- @ReplaceWith("setRateLimitScheduler(pool, automaticShutdown) or setRateLimitElastic(pool, automaticShutdown)")
- public DefaultShardManagerBuilder setRateLimitPool(@Nullable ScheduledExecutorService pool, boolean automaticShutdown)
- {
- return setRateLimitPoolProvider(pool == null ? null : new ThreadPoolProviderImpl<>(pool, automaticShutdown));
- }
-
- /**
- * Sets the {@link ScheduledExecutorService ScheduledExecutorService} provider that should be used in
- * the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
- * and should be handled carefully. Only change this pool if you know what you're doing.
- *
- * This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions.
- * Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)}
- * and similar methods.
- *
- * Default: Shared {@link ScheduledThreadPoolExecutor} with ({@code 2 * }{@link #setShardsTotal(int) shard_total}) threads.
- *
- * @param provider
- * The thread-pool provider to use for rate-limit handling
- *
- * @return The DefaultShardManagerBuilder instance. Useful for chaining.
- *
- * @deprecated This pool is now split into two pools.
- * You should use {@link #setRateLimitPoolProvider(ThreadPoolProvider)} and {@link #setRateLimitElasticProvider(ThreadPoolProvider)} instead.
- */
- @Nonnull
- @Deprecated
- @ReplaceWith("setRateLimitSchedulerProvider(provider) or setRateLimitElasticProvider(provider)")
- public DefaultShardManagerBuilder setRateLimitPoolProvider(@Nullable ThreadPoolProvider extends ScheduledExecutorService> provider)
- {
- this.rateLimitSchedulerProvider = provider;
- return this;
- }
-
- /**
- * Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in
- * the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
- * and should be handled carefully. Only change this pool if you know what you're doing.
- * This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions.
* Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)}
@@ -1430,7 +1312,7 @@ public DefaultShardManagerBuilder setRateLimitScheduler(@Nullable ScheduledExecu
* Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in
* the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
* and should be handled carefully. Only change this pool if you know what you're doing.
- * This is used mostly by the Rate-Limiter to handle backoff delays by using scheduled executions.
* Besides that it is also used by planned execution for {@link net.dv8tion.jda.api.requests.RestAction#queueAfter(long, TimeUnit)}
diff --git a/src/main/java/net/dv8tion/jda/api/utils/SessionController.java b/src/main/java/net/dv8tion/jda/api/utils/SessionController.java
index 864925ac8b..d4b9d5e1f5 100644
--- a/src/main/java/net/dv8tion/jda/api/utils/SessionController.java
+++ b/src/main/java/net/dv8tion/jda/api/utils/SessionController.java
@@ -16,8 +16,6 @@
package net.dv8tion.jda.api.utils;
-import net.dv8tion.jda.annotations.ForRemoval;
-import net.dv8tion.jda.annotations.ReplaceWith;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.requests.RestRateLimiter;
@@ -37,8 +35,7 @@
*
* Global REST Ratelimit
* Gateway Provider
*
If the user speaks for 3 minutes straight without ever stopping, then this would fire 2 times, once at the beginning
- * and once after 3 minutes when they stop talking even though the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} method was fired thousands of times over the course of the 3 minutes.
- *
- * @param user
- * Never-null {@link net.dv8tion.jda.api.entities.User User} who's talking status has changed.
- * @param speaking
- * If true, the user has begun transmitting audio.
- *
- * @deprecated This method no longer represents the actual speaking state of the user.
- * Discord does not send updates when a user starts and stops speaking anymore.
- * You can use {@link #onUserSpeakingModeUpdate(UserSnowflake, EnumSet)} to see when a user changes their speaking mode,
- * or use an {@link net.dv8tion.jda.api.audio.AudioReceiveHandler AudioReceiveHandler} to check when a user is speaking.
- */
- @Deprecated
- @ForRemoval
- @ReplaceWith("onUserSpeakingModeUpdate(User, EnumSet
If the user speaks for 3 minutes straight without ever stopping, then this would fire 2 times, once at the beginning
- * and once after 3 minutes when they stop talking even though the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} method was fired thousands of times over the course of the 3 minutes.
- *
- * @param user
- * Never-null {@link net.dv8tion.jda.api.entities.User User} who's talking status has changed.
- * @param modes
- * EnumSet, containing the active speaking modes.
- * Empty if the user has stopped transmitting audio.
- *
- * @see java.util.EnumSet EnumSet
- * @see net.dv8tion.jda.api.audio.SpeakingMode SpeakingMode
- *
- * @deprecated This method no longer represents the actual speaking state of the user.
- * Discord does not send updates when a user starts and stops speaking anymore.
- * You can use {@link #onUserSpeakingModeUpdate(UserSnowflake, EnumSet)} to see when a user changes their speaking mode,
- * or use an {@link net.dv8tion.jda.api.audio.AudioReceiveHandler AudioReceiveHandler} to check when a user is speaking.
- */
- @Deprecated
- @ForRemoval
- @ReplaceWith("onUserSpeakingModeUpdate(User, EnumSet
If the user speaks for 3 minutes straight without ever stopping, then this would fire 2 times, once at the beginning
- * and once after 3 minutes when they stop talking even though the {@link net.dv8tion.jda.api.audio.AudioReceiveHandler#handleUserAudio(net.dv8tion.jda.api.audio.UserAudio)
- * AudioReceiveHandler.handleUserAudio(UserAudio)} method was fired thousands of times over the course of the 3 minutes.
- *
- * @param user
- * Never-null {@link net.dv8tion.jda.api.entities.User User} who's talking status has changed.
- * @param speaking
- * If true, the user has begun transmitting audio.
- * @param soundshare
- * If true, the user is using soundshare
- *
- * @deprecated This method no longer represents the actual speaking state of the user.
- * Discord does not send updates when a user starts and stops speaking anymore.
- * You can use {@link #onUserSpeakingModeUpdate(UserSnowflake, EnumSet)} to see when a user changes their speaking mode,
- * or use an {@link net.dv8tion.jda.api.audio.AudioReceiveHandler AudioReceiveHandler} to check when a user is speaking.
- */
- @Deprecated
- @ForRemoval
- @ReplaceWith("onUserSpeakingModeUpdate(User, EnumSet
*
*
*
*
*
* @return AccountManager for chaining convenience
- *
- * @deprecated Bot usernames are set through the application name now.
*/
@Nonnull
@CheckReturnValue
- @Deprecated
- @ForRemoval
AccountManager setName(@Nonnull String name);
/**
diff --git a/src/main/java/net/dv8tion/jda/api/managers/AudioManager.java b/src/main/java/net/dv8tion/jda/api/managers/AudioManager.java
index 8ed6c63235..6016db1889 100644
--- a/src/main/java/net/dv8tion/jda/api/managers/AudioManager.java
+++ b/src/main/java/net/dv8tion/jda/api/managers/AudioManager.java
@@ -16,7 +16,6 @@
package net.dv8tion.jda.api.managers;
-import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.annotations.Incubating;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.audio.AudioReceiveHandler;
@@ -142,27 +141,6 @@ default void setSpeakingMode(@Nonnull SpeakingMode... mode)
@Incubating
EnumSet
- *
- *
- * @param reason
- * The reason for this action or {@code null} if there is no specified reason
- *
- * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
- * If the logged in account does not have the {@link Permission#KICK_MEMBERS} permission.
- * @throws net.dv8tion.jda.api.exceptions.HierarchyException
- * If the logged in account cannot kick the other member due to permission hierarchy position.
- *
The target Member cannot be kicked due to a permission discrepancy
The specified Member was removed from the Guild before finishing the task
See {@link Member#canInteract(Member)}
- * @throws java.lang.IllegalArgumentException
- * If the provided reason is longer than 512 characters
- *
- * @return {@link net.dv8tion.jda.api.requests.restaction.AuditableRestAction AuditableRestAction}
- * Kicks the provided Member from the current Guild
- *
- * @deprecated
- * Use {@link #kick()} and {@link AuditableRestAction#reason(String)} instead
- */
- @Nonnull
- @CheckReturnValue
- @Deprecated
- @ForRemoval
- @ReplaceWith("kick().reason(reason)")
- @DeprecatedSince("5.0.0")
- default AuditableRestAction
While a Member is in time out, all permissions except {@link Permission#VIEW_CHANNEL VIEW_CHANNEL} and
diff --git a/src/main/java/net/dv8tion/jda/api/entities/Message.java b/src/main/java/net/dv8tion/jda/api/entities/Message.java
index f6251c52f9..9273cf69fd 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/Message.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java
@@ -15,8 +15,6 @@
*/
package net.dv8tion.jda.api.entities;
-import net.dv8tion.jda.annotations.ForRemoval;
-import net.dv8tion.jda.annotations.ReplaceWith;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.channel.Channel;
@@ -36,7 +34,6 @@
import net.dv8tion.jda.api.entities.sticker.Sticker;
import net.dv8tion.jda.api.entities.sticker.StickerItem;
import net.dv8tion.jda.api.entities.sticker.StickerSnowflake;
-import net.dv8tion.jda.api.exceptions.HttpException;
import net.dv8tion.jda.api.exceptions.InsufficientPermissionException;
import net.dv8tion.jda.api.exceptions.MissingAccessException;
import net.dv8tion.jda.api.interactions.InteractionType;
@@ -44,7 +41,6 @@
import net.dv8tion.jda.api.interactions.components.LayoutComponent;
import net.dv8tion.jda.api.interactions.components.buttons.Button;
import net.dv8tion.jda.api.requests.RestAction;
-import net.dv8tion.jda.api.requests.RestConfig;
import net.dv8tion.jda.api.requests.restaction.AuditableRestAction;
import net.dv8tion.jda.api.requests.restaction.MessageCreateAction;
import net.dv8tion.jda.api.requests.restaction.MessageEditAction;
@@ -61,23 +57,19 @@
import net.dv8tion.jda.api.utils.messages.MessageRequest;
import net.dv8tion.jda.internal.JDAImpl;
import net.dv8tion.jda.internal.entities.ReceivedMessage;
-import net.dv8tion.jda.internal.requests.FunctionalCallback;
import net.dv8tion.jda.internal.requests.restaction.pagination.PollVotersPaginationActionImpl;
import net.dv8tion.jda.internal.utils.Checks;
import net.dv8tion.jda.internal.utils.Helpers;
-import net.dv8tion.jda.internal.utils.IOUtil;
import okhttp3.MultipartBody;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
import org.jetbrains.annotations.Unmodifiable;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import java.io.*;
+import java.io.File;
+import java.io.InputStream;
import java.time.OffsetDateTime;
import java.util.*;
-import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -153,16 +145,6 @@ public interface Message extends ISnowflake, Formattable
*/
int MAX_FILE_SIZE = 25 << 20;
- /**
- * The maximum sendable file size for nitro (50 MiB)
- *
- * @see MessageRequest#setFiles(Collection)
- *
- * @deprecated Self-bots are not supported anymore and the value is outdated.
- */
- @Deprecated
- int MAX_FILE_SIZE_NITRO = 50 << 20;
-
/**
* The maximum amount of files sendable within a single message ({@value})
*
@@ -2660,263 +2642,6 @@ public String getDescription()
return description;
}
- /**
- * Enqueues a request to retrieve the contents of this Attachment.
- *
The receiver is expected to close the retrieved {@link java.io.InputStream}.
- *
- *
- * {@code
- * public void printContents(Message.Attachment attachment)
- * {
- * attachment.retrieveInputStream().thenAccept(in -> {
- * StringBuilder builder = new StringBuilder();
- * byte[] buf = byte[1024];
- * int count = 0;
- * while ((count = in.read(buf)) > 0)
- * {
- * builder.append(new String(buf, 0, count));
- * }
- * in.close();
- * System.out.println(builder);
- * }).exceptionally(t -> { // handle failure
- * t.printStackTrace();
- * return null;
- * });
- * }
- * }
- *
- * @return {@link java.util.concurrent.CompletableFuture} - Type: {@link java.io.InputStream}
- *
- * @deprecated Replaced by {@link #getProxy}, see {@link AttachmentProxy#download()}
- */
- @Nonnull
- @Deprecated
- @ForRemoval
- @ReplaceWith("getProxy().download()")
- public CompletableFuture
This will download the file using the {@link net.dv8tion.jda.api.JDA#getCallbackPool() callback pool}.
- * Alternatively you can use {@link #retrieveInputStream()} and use a continuation with a different executor.
- *
- *
- * {@code
- * public void saveLocally(Message.Attachment attachment)
- * {
- * attachment.downloadToFile()
- * .thenAccept(file -> System.out.println("Saved attachment to " + file.getName()))
- * .exceptionally(t ->
- * { // handle failure
- * t.printStackTrace();
- * return null;
- * });
- * }
- * }
- *
- * @return {@link java.util.concurrent.CompletableFuture} - Type: {@link java.io.File}
- *
- * @deprecated Replaced by {@link #getProxy}, see {@link AttachmentProxy#downloadToFile(File)}
- */
- @Nonnull
- @Deprecated
- @ForRemoval
- @ReplaceWith("getProxy().downloadToFile()")
- public CompletableFuture
This will download the file using the {@link net.dv8tion.jda.api.JDA#getCallbackPool() callback pool}.
- * Alternatively you can use {@link #retrieveInputStream()} and use a continuation with a different executor.
- *
- *
- * {@code
- * public void saveLocally(Message.Attachment attachment)
- * {
- * attachment.downloadToFile("/tmp/" + attachment.getFileName())
- * .thenAccept(file -> System.out.println("Saved attachment to " + file.getName()))
- * .exceptionally(t ->
- * { // handle failure
- * t.printStackTrace();
- * return null;
- * });
- * }
- * }
- *
- * @param path
- * The path to save the file to
- *
- * @throws java.lang.IllegalArgumentException
- * If the provided path is null
- *
- * @return {@link java.util.concurrent.CompletableFuture} - Type: {@link java.io.File}
- *
- * @deprecated Replaced by {@link #getProxy}, see {@link AttachmentProxy#downloadToFile(File)}
- */
- @Nonnull
- @Deprecated
- @ForRemoval
- @ReplaceWith("getProxy().downloadToFile(new File(String))")
- public CompletableFuture
This will download the file using the {@link net.dv8tion.jda.api.JDA#getCallbackPool() callback pool}.
- * Alternatively you can use {@link #retrieveInputStream()} and use a continuation with a different executor.
- *
- *
- * {@code
- * public void saveLocally(Message.Attachment attachment)
- * {
- * attachment.downloadToFile(new File("/tmp/" + attachment.getFileName()))
- * .thenAccept(file -> System.out.println("Saved attachment to " + file.getName()))
- * .exceptionally(t ->
- * { // handle failure
- * t.printStackTrace();
- * return null;
- * });
- * }
- * }
- *
- * @param file
- * The file to write to
- *
- * @throws java.lang.IllegalArgumentException
- * If the provided file is null or cannot be written to
- *
- * @return {@link java.util.concurrent.CompletableFuture} - Type: {@link java.io.File}
- *
- * @deprecated Replaced by {@link #getProxy}, see {@link AttachmentProxy#downloadToFile(File)}
- */
- @SuppressWarnings("ResultOfMethodCallIgnored")
- @Nonnull
- @ForRemoval
- @ReplaceWith("getProxy().downloadToFile(File)")
- public CompletableFuture
Useful with {@link net.dv8tion.jda.api.managers.AccountManager#setAvatar(Icon)}.
- *
This will download the file using the {@link net.dv8tion.jda.api.JDA#getCallbackPool() callback pool}.
- * Alternatively you can use {@link #retrieveInputStream()} and use a continuation with a different executor.
- *
- *
- * {@code
- * public void changeAvatar(Message.Attachment attachment)
- * {
- * attachment.retrieveAsIcon().thenCompose(icon -> {
- * SelfUser self = attachment.getJDA().getSelfUser();
- * AccountManager manager = self.getManager();
- * return manager.setAvatar(icon).submit();
- * }).exceptionally(t -> {
- * t.printStackTrace();
- * return null;
- * });
- * }
- * }
- *
- * @throws java.lang.IllegalStateException
- * If this is not an image ({@link #isImage()})
- *
- * @return {@link java.util.concurrent.CompletableFuture} - Type: {@link net.dv8tion.jda.api.entities.Icon}
- *
- * @deprecated Replaced by {@link #getProxy}, see {@link AttachmentProxy#downloadAsIcon()}
- */
- @Nonnull
- @ReplaceWith("getProxy().downloadAsIcon()")
- public CompletableFuture
Example: if {@code getSize()} returns 1024, then the attachment is 1024 bytes, or 1KiB, in size.
diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java b/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java
index b5b2efb4c4..03a17404a7 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java
@@ -15,7 +15,6 @@
*/
package net.dv8tion.jda.api.entities;
-import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.utils.AttachmentProxy;
import net.dv8tion.jda.api.utils.FileProxy;
@@ -103,20 +102,6 @@ public class MessageEmbed implements SerializableData
*/
public static final int EMBED_MAX_LENGTH_BOT = 6000;
- /**
- * The maximum amount of total visible characters an embed can have
- *
- * @see net.dv8tion.jda.api.EmbedBuilder#setDescription(CharSequence)
- * @see net.dv8tion.jda.api.EmbedBuilder#setTitle(String)
- * @see net.dv8tion.jda.api.EmbedBuilder#setFooter(String, String)
- * @see net.dv8tion.jda.api.EmbedBuilder#addField(String, String, boolean)
- *
- * @deprecated This will be removed in the future.
- */
- @Deprecated
- @ForRemoval
- public static final int EMBED_MAX_LENGTH_CLIENT = 2000;
-
/**
* The maximum amount of total embed fields the embed can hold
*
diff --git a/src/main/java/net/dv8tion/jda/api/entities/StageInstance.java b/src/main/java/net/dv8tion/jda/api/entities/StageInstance.java
index 7257153a32..3aeb5ef624 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/StageInstance.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/StageInstance.java
@@ -16,8 +16,6 @@
package net.dv8tion.jda.api.entities;
-import net.dv8tion.jda.annotations.DeprecatedSince;
-import net.dv8tion.jda.annotations.ForRemoval;
import net.dv8tion.jda.api.entities.channel.concrete.StageChannel;
import net.dv8tion.jda.api.managers.StageInstanceManager;
import net.dv8tion.jda.api.requests.RestAction;
@@ -155,15 +153,6 @@ enum PrivacyLevel
{
/** Placeholder for future privacy levels, indicates that this version of JDA does not support this privacy level yet */
UNKNOWN(-1),
- /**
- * This stage instance can be accessed by lurkers, meaning users that are not active members of the guild
- *
- * @deprecated Public stage instances are no longer supported by discord
- */
- @Deprecated
- @ForRemoval
- @DeprecatedSince("5.0.0")
- PUBLIC(1),
/** This stage instance can only be accessed by guild members */
GUILD_ONLY(2);
diff --git a/src/main/java/net/dv8tion/jda/api/entities/User.java b/src/main/java/net/dv8tion/jda/api/entities/User.java
index d272213eeb..45dbbf874d 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/User.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/User.java
@@ -16,8 +16,6 @@
package net.dv8tion.jda.api.entities;
-import net.dv8tion.jda.annotations.ForRemoval;
-import net.dv8tion.jda.annotations.ReplaceWith;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel;
import net.dv8tion.jda.api.requests.restaction.CacheRestAction;
@@ -164,18 +162,15 @@ default String getEffectiveName()
}
/**
- *
The discriminator of the {@link net.dv8tion.jda.api.entities.User User}. Used to differentiate between users with the same usernames.
+ * The discriminator of the {@link net.dv8tion.jda.api.entities.User User}. Used to differentiate between users with the same usernames.
*
This only contains the 4 digits after the username and the #.
*
- * @return Never-null String containing the {@link net.dv8tion.jda.api.entities.User User} discriminator.
+ *
- *
- *
- * @return The same builder instance for chaining
- *
- * @see ActionRow#isModalCompatible()
- */
- @Nonnull
- @ForRemoval
- @Deprecated
- @ReplaceWith("addComponents(actionRows)")
- public Builder addActionRows(@Nonnull ActionRow... actionRows)
- {
- return addComponents(actionRows);
- }
-
- /**
- * Adds ActionRows to this modal
- *
- * @param actionRows
- * ActionRows to add to the modal, up to 5
- *
- * @throws IllegalArgumentException
- *
- *
- *
- * @return The same builder instance for chaining
- *
- * @see ActionRow#isModalCompatible()
- */
- @Nonnull
- @ForRemoval
- @Deprecated
- @ReplaceWith("addComponents(actionRows)")
- public Builder addActionRows(@Nonnull Collection extends ActionRow> actionRows)
- {
- return addComponents(actionRows);
- }
-
/**
* Adds {@link LayoutComponent LayoutComponents} to this modal
*
@@ -372,24 +299,6 @@ public Builder addActionRow(@Nonnull ItemComponent... components)
return addComponents(ActionRow.of(components));
}
- /**
- * Returns an immutable list of all ActionRow components
- *
- * @return An immutable list of all ActionRow components
- */
- @Nonnull
- @ForRemoval
- @Deprecated
- @ReplaceWith("getComponents()")
- @Unmodifiable
- public List
This can be useful for send systems that buffer a certain interval of audio frames that will be sent.
- * By default the delay is 200 milliseconds which is also the minimum delay.
- *
- *
By default we use the {@code X-RateLimit-Rest-After} header to determine when
- * a rate-limit is no longer imminent. This has the disadvantage that it might wait longer than needed due
- * to the latency which is ignored by the reset-after relative delay.
- *
- *
This can be used to customize how rate-limits are handled and configure a custom http proxy.
@@ -1317,97 +1287,9 @@ public DefaultShardManagerBuilder setHttpClient(@Nullable OkHttpClient client)
* Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in
* the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
* and should be handled carefully. Only change this pool if you know what you're doing.
- *
This will override the rate-limit pool provider set from {@link #setRateLimitPoolProvider(ThreadPoolProvider)}.
- *
This automatically disables the automatic shutdown of the rate-limit pool, you can enable
- * it using {@link #setRateLimitPool(ScheduledExecutorService, boolean) setRateLimiPool(executor, true)}
- *
- *
This will override the rate-limit pool provider set from {@link #setRateLimitPoolProvider(ThreadPoolProvider)}.
- *
- *
This will override the rate-limit pool provider set from {@link #setRateLimitPoolProvider(ThreadPoolProvider)}.
+ *
This will override the rate-limit pool provider set from {@link #setRateLimitSchedulerProvider(ThreadPoolProvider)}.
*
This automatically disables the automatic shutdown of the rate-limit pool, you can enable
- * it using {@link #setRateLimitPool(ScheduledExecutorService, boolean) setRateLimiPool(executor, true)}
+ * it using {@link #setRateLimitScheduler(ScheduledExecutorService, boolean) setRateLimiPool(executor, true)}
*
*
This will override the rate-limit pool provider set from {@link #setRateLimitPoolProvider(ThreadPoolProvider)}.
+ *
This will override the rate-limit pool provider set from {@link #setRateLimitSchedulerProvider(ThreadPoolProvider)}.
*
*
The global REST ratelimit is not bound to a single session and should be
- * handled on all JDA instances. This controller will receive updates of this ratelimit through {@link #setGlobalRatelimit(long)}
- * and should report the last ratelimit information it received through {@link #getGlobalRatelimit()}.
+ * handled on all JDA instances. This controller will manage the global ratelimit using {@link #getRateLimitHandle}.
*
*
This provider can be used to change the gateway retrieval (using cache, http, or static) and
@@ -125,34 +122,6 @@ default void setConcurrency(int level) {}
*/
void removeSession(@Nonnull SessionConnectNode node);
- /**
- * Provides the cross-session global REST ratelimit it received through {@link #setGlobalRatelimit(long)}.
- *
- * @return The current global REST ratelimit or -1 if unset
- *
- * @deprecated Use {@link #getRateLimitHandle()} instead
- */
- @Deprecated
- @ForRemoval(deadline = "5.0.0")
- @ReplaceWith("getRateLimitHandle().getClassic()")
- default long getGlobalRatelimit()
- {
- return -1;
- }
-
- /**
- * Called by the RateLimiter if the global rest ratelimit has changed.
- *
- * @param ratelimit
- * The new global ratelimit
- *
- * @deprecated Use {@link #getRateLimitHandle()} instead
- */
- @Deprecated
- @ForRemoval(deadline = "5.0.0")
- @ReplaceWith("getRateLimitHandle().getClassic()")
- default void setGlobalRatelimit(long ratelimit) {}
-
/**
* The store for global rate-limits of all types.
*
This can be used to share the global rate-limit information between shards on the same IP.
@@ -162,7 +131,7 @@ default void setGlobalRatelimit(long ratelimit) {}
@Nonnull
default RestRateLimiter.GlobalRateLimit getRateLimitHandle()
{
- return new GlobalRateLimitAdapter(this);
+ return RestRateLimiter.GlobalRateLimit.create();
}
/**
@@ -302,68 +271,4 @@ interface SessionConnectNode
*/
void run(boolean isLast) throws InterruptedException;
}
-
- /**
- * Wrapper for {@link #getGlobalRatelimit()} and {@link #setGlobalRatelimit(long)}.
- */
- @Deprecated
- @ForRemoval(deadline = "5.0.0")
- @ReplaceWith("getRateLimitHandle()")
- @SuppressWarnings("DeprecatedIsStillUsed")
- class GlobalRateLimitAdapter implements RestRateLimiter.GlobalRateLimit
- {
- private final SessionController controller;
-
- public GlobalRateLimitAdapter(@Nonnull SessionController controller)
- {
- SessionControllerAdapter.log.warn("Using outdated implementation of global rate-limit handling. It is recommended to use GlobalRateLimit interface instead!");
- this.controller = controller;
- }
-
- /**
- * Forwarding to {@link SessionController#getGlobalRatelimit()}
- *
- * @return The current global ratelimit
- */
- @Override
- public long getClassic()
- {
- return controller.getGlobalRatelimit();
- }
-
- /**
- * Forwarding to {@link SessionController#setGlobalRatelimit(long)}
- *
- * @param ratelimit
- * The new global ratelimit
- */
- @Override
- public void setClassic(long ratelimit)
- {
- controller.setGlobalRatelimit(ratelimit);
- }
-
- /**
- * Forwarding to {@link SessionController#getGlobalRatelimit()}
- *
- * @return The current global ratelimit
- */
- @Override
- public long getCloudflare()
- {
- return getClassic();
- }
-
- /**
- * Forwarding to {@link SessionController#setGlobalRatelimit(long)}
- *
- * @param timestamp
- * The new global ratelimit
- */
- @Override
- public void setCloudflare(long timestamp)
- {
- setClassic(timestamp);
- }
- }
}
diff --git a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java
index 8365f80a1c..888f257668 100644
--- a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java
+++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java
@@ -511,8 +511,6 @@ private void handleEvent(DataObject contentAll)
}
else
{
- //noinspection deprecation
- listener.onUserSpeaking(user, speaking);
listener.onUserSpeakingModeUpdate((UserSnowflake) user, speaking);
}
diff --git a/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java
index eba01e89a0..783885a82b 100644
--- a/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java
+++ b/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java
@@ -75,7 +75,7 @@ public String getGlobalName()
@Override
public String getDiscriminator()
{
- return Helpers.format("%04d", discriminator);
+ return discriminator == 0 ? "0000" : Helpers.format("%04d", discriminator);
}
@Nullable
diff --git a/src/main/java/net/dv8tion/jda/internal/handle/UserUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/UserUpdateHandler.java
index abd50ea67d..06b09f782f 100644
--- a/src/main/java/net/dv8tion/jda/internal/handle/UserUpdateHandler.java
+++ b/src/main/java/net/dv8tion/jda/internal/handle/UserUpdateHandler.java
@@ -36,6 +36,7 @@ protected Long handleInternally(DataObject content)
SelfUserImpl self = (SelfUserImpl) getJDA().getSelfUser();
String name = content.getString("username");
+ String discriminator = content.getString("discriminator");
String globalName = content.getString("global_name", null);
String avatarId = content.getString("avatar", null);
Boolean verified = content.hasKey("verified") ? content.getBoolean("verified") : null;
@@ -51,6 +52,16 @@ protected Long handleInternally(DataObject content)
oldName));
}
+ if (!Objects.equals(discriminator, self.getDiscriminator()))
+ {
+ String oldDiscriminator = self.getDiscriminator();
+ self.setDiscriminator(Short.parseShort(discriminator));
+ getJDA().handleEvent(
+ new SelfUpdateDiscriminatorEvent(
+ getJDA(), responseNumber,
+ oldDiscriminator));
+ }
+
if (!Objects.equals(globalName, self.getGlobalName()))
{
String oldGlobalName = self.getGlobalName();
diff --git a/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java
index 4da6e543d6..2a90ec00be 100644
--- a/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java
+++ b/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java
@@ -90,7 +90,6 @@ public AccountManagerImpl reset()
@Nonnull
@Override
- @Deprecated
@CheckReturnValue
public AccountManagerImpl setName(@Nonnull String name)
{
@@ -128,10 +127,6 @@ protected RequestBody finalizeData()
{
DataObject body = DataObject.empty();
- //Required fields. Populate with current values..
- body.put("username", getSelfUser().getName());
- body.put("avatar", getSelfUser().getAvatarId());
-
if (shouldUpdate(NAME))
body.put("username", name);
if (shouldUpdate(AVATAR))
@@ -146,8 +141,6 @@ protected RequestBody finalizeData()
@Override
protected void handleSuccess(Response response, Request