Skip to content

Commit 3b5687d

Browse files
Merge pull request discord-jda#620 from DV8FromTheWorld/release/3.5.1
Release 3.5.1
2 parents caaec21 + bae81e4 commit 3b5687d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1046
-865
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ gradlew binary
55

66
*.java text eol=crlf
77
*.gradle text eol=crlf
8+
*.bat text eol=crlf
89

910
* text=auto

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ plugins {
2828
id 'com.github.johnrengelman.shadow' version '2.0.1'
2929
}
3030

31-
def versionObj = new Version(major: 3, minor: 5, revision: 0)
31+
def versionObj = new Version(major: 3, minor: 5, revision: 1)
3232

3333
group = "net.dv8tion"
3434
archivesBaseName = "JDA"
+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
distributionBase=GRADLE_USER_HOME
2-
distributionPath=wrapper/dists
3-
zipStoreBase=GRADLE_USER_HOME
4-
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip
1+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStorePath=wrapper/dists
5+
zipStoreBase=GRADLE_USER_HOME

gradlew.bat

+84-84
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
@if "%DEBUG%" == "" @echo off
2-
@rem ##########################################################################
3-
@rem
4-
@rem Gradle startup script for Windows
5-
@rem
6-
@rem ##########################################################################
7-
8-
@rem Set local scope for the variables with windows NT shell
9-
if "%OS%"=="Windows_NT" setlocal
10-
11-
set DIRNAME=%~dp0
12-
if "%DIRNAME%" == "" set DIRNAME=.
13-
set APP_BASE_NAME=%~n0
14-
set APP_HOME=%DIRNAME%
15-
16-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
18-
19-
@rem Find java.exe
20-
if defined JAVA_HOME goto findJavaFromJavaHome
21-
22-
set JAVA_EXE=java.exe
23-
%JAVA_EXE% -version >NUL 2>&1
24-
if "%ERRORLEVEL%" == "0" goto init
25-
26-
echo.
27-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28-
echo.
29-
echo Please set the JAVA_HOME variable in your environment to match the
30-
echo location of your Java installation.
31-
32-
goto fail
33-
34-
:findJavaFromJavaHome
35-
set JAVA_HOME=%JAVA_HOME:"=%
36-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37-
38-
if exist "%JAVA_EXE%" goto init
39-
40-
echo.
41-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42-
echo.
43-
echo Please set the JAVA_HOME variable in your environment to match the
44-
echo location of your Java installation.
45-
46-
goto fail
47-
48-
:init
49-
@rem Get command-line arguments, handling Windows variants
50-
51-
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
53-
:win9xME_args
54-
@rem Slurp the command line arguments.
55-
set CMD_LINE_ARGS=
56-
set _SKIP=2
57-
58-
:win9xME_args_slurp
59-
if "x%~1" == "x" goto execute
60-
61-
set CMD_LINE_ARGS=%*
62-
63-
:execute
64-
@rem Setup the command line
65-
66-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67-
68-
@rem Execute Gradle
69-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70-
71-
:end
72-
@rem End local scope for the variables with windows NT shell
73-
if "%ERRORLEVEL%"=="0" goto mainEnd
74-
75-
:fail
76-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77-
rem the _cmd.exe /c_ return code!
78-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79-
exit /b 1
80-
81-
:mainEnd
82-
if "%OS%"=="Windows_NT" endlocal
83-
84-
:omega
1+
@if "%DEBUG%" == "" @echo off
2+
@rem ##########################################################################
3+
@rem
4+
@rem Gradle startup script for Windows
5+
@rem
6+
@rem ##########################################################################
7+
8+
@rem Set local scope for the variables with windows NT shell
9+
if "%OS%"=="Windows_NT" setlocal
10+
11+
set DIRNAME=%~dp0
12+
if "%DIRNAME%" == "" set DIRNAME=.
13+
set APP_BASE_NAME=%~n0
14+
set APP_HOME=%DIRNAME%
15+
16+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17+
set DEFAULT_JVM_OPTS=
18+
19+
@rem Find java.exe
20+
if defined JAVA_HOME goto findJavaFromJavaHome
21+
22+
set JAVA_EXE=java.exe
23+
%JAVA_EXE% -version >NUL 2>&1
24+
if "%ERRORLEVEL%" == "0" goto init
25+
26+
echo.
27+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28+
echo.
29+
echo Please set the JAVA_HOME variable in your environment to match the
30+
echo location of your Java installation.
31+
32+
goto fail
33+
34+
:findJavaFromJavaHome
35+
set JAVA_HOME=%JAVA_HOME:"=%
36+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37+
38+
if exist "%JAVA_EXE%" goto init
39+
40+
echo.
41+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42+
echo.
43+
echo Please set the JAVA_HOME variable in your environment to match the
44+
echo location of your Java installation.
45+
46+
goto fail
47+
48+
:init
49+
@rem Get command-line arguments, handling Windows variants
50+
51+
if not "%OS%" == "Windows_NT" goto win9xME_args
52+
53+
:win9xME_args
54+
@rem Slurp the command line arguments.
55+
set CMD_LINE_ARGS=
56+
set _SKIP=2
57+
58+
:win9xME_args_slurp
59+
if "x%~1" == "x" goto execute
60+
61+
set CMD_LINE_ARGS=%*
62+
63+
:execute
64+
@rem Setup the command line
65+
66+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67+
68+
@rem Execute Gradle
69+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70+
71+
:end
72+
@rem End local scope for the variables with windows NT shell
73+
if "%ERRORLEVEL%"=="0" goto mainEnd
74+
75+
:fail
76+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77+
rem the _cmd.exe /c_ return code!
78+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79+
exit /b 1
80+
81+
:mainEnd
82+
if "%OS%"=="Windows_NT" endlocal
83+
84+
:omega

src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManager.java

+6-62
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
import net.dv8tion.jda.core.AccountType;
2323
import net.dv8tion.jda.core.JDA;
2424
import net.dv8tion.jda.core.OnlineStatus;
25-
import net.dv8tion.jda.core.ShardedRateLimiter;
2625
import net.dv8tion.jda.core.audio.factory.IAudioSendFactory;
2726
import net.dv8tion.jda.core.entities.Game;
2827
import net.dv8tion.jda.core.entities.impl.JDAImpl;
2928
import net.dv8tion.jda.core.hooks.IEventManager;
3029
import net.dv8tion.jda.core.managers.impl.PresenceImpl;
31-
import net.dv8tion.jda.core.requests.SessionReconnectQueue;
32-
import net.dv8tion.jda.core.requests.WebSocketClient;
33-
import net.dv8tion.jda.core.utils.*;
30+
import net.dv8tion.jda.core.utils.Checks;
31+
import net.dv8tion.jda.core.utils.JDALogger;
32+
import net.dv8tion.jda.core.utils.SessionController;
33+
import net.dv8tion.jda.core.utils.SessionControllerAdapter;
3434
import net.dv8tion.jda.core.utils.tuple.Pair;
3535
import okhttp3.OkHttpClient;
3636
import org.slf4j.Logger;
@@ -39,7 +39,6 @@
3939
import java.util.*;
4040
import java.util.concurrent.*;
4141
import java.util.concurrent.atomic.AtomicBoolean;
42-
import java.util.function.Consumer;
4342
import java.util.function.IntFunction;
4443

4544
/**
@@ -229,8 +228,6 @@ public class DefaultShardManager implements ShardManager
229228
* The {@link com.neovisionaries.ws.client.WebSocketFactory WebSocketFactory}
230229
* @param threadFactory
231230
* The {@link java.util.concurrent.ThreadFactory ThreadFactory}
232-
* @param shardedRateLimiter
233-
* The {@link net.dv8tion.jda.core.ShardedRateLimiter ShardedRateLimiter}
234231
* @param maxReconnectDelay
235232
* The max reconnect delay
236233
* @param corePoolSize
@@ -260,7 +257,7 @@ protected DefaultShardManager(final int shardsTotal, final Collection<Integer> s
260257
final String token, final IEventManager eventManager, final IAudioSendFactory audioSendFactory,
261258
final IntFunction<Game> gameProvider, final IntFunction<OnlineStatus> statusProvider,
262259
final OkHttpClient.Builder httpClientBuilder, final WebSocketFactory wsFactory,
263-
final ThreadFactory threadFactory, final ShardedRateLimiter shardedRateLimiter,
260+
final ThreadFactory threadFactory,
264261
final int maxReconnectDelay, final int corePoolSize, final boolean enableVoice,
265262
final boolean enableShutdownHook, final boolean enableBulkDeleteSplitting,
266263
final boolean autoReconnect, final IntFunction<Boolean> idleProvider,
@@ -277,10 +274,7 @@ protected DefaultShardManager(final int shardsTotal, final Collection<Integer> s
277274
this.httpClientBuilder = httpClientBuilder == null ? new OkHttpClient.Builder() : httpClientBuilder;
278275
this.wsFactory = wsFactory == null ? new WebSocketFactory() : wsFactory;
279276
this.executor = createExecutor(threadFactory);
280-
if (shardedRateLimiter != null && controller == null)
281-
this.controller = new ProvidingSessionController(null, shardedRateLimiter);
282-
else
283-
this.controller = controller == null ? new SessionControllerAdapter() : controller;
277+
this.controller = controller == null ? new SessionControllerAdapter() : controller;
284278
this.maxReconnectDelay = maxReconnectDelay;
285279
this.corePoolSize = corePoolSize;
286280
this.enableVoice = enableVoice;
@@ -653,54 +647,4 @@ protected ScheduledExecutorService createExecutor(ThreadFactory threadFactory)
653647

654648
return Executors.newSingleThreadScheduledExecutor(factory);
655649
}
656-
657-
/**
658-
* This method creates the internal {@link net.dv8tion.jda.core.requests.SessionReconnectQueue SessionReconnectQueue}.
659-
* It is intended as a hook for custom implementations to create their own queue.
660-
*
661-
* <p><b>NOTE: The default implementation will add reconnects to the same queue as connects so they don't interfere with each other
662-
* (they share the same rate limit). If you override this you need to take care of it yourself.</b>
663-
*
664-
* @return A new ScheduledExecutorService
665-
*
666-
* @deprecated
667-
* Use {@link net.dv8tion.jda.core.utils.SessionController SessionController} directly instead
668-
*/
669-
@Deprecated
670-
protected SessionReconnectQueue createReconnectQueue()
671-
{
672-
return new ForwardingSessionReconnectQueue(
673-
jda -> queue.add(jda.getShardInfo().getShardId()),
674-
jda -> queue.remove(jda.getShardInfo().getShardId()));
675-
}
676-
677-
@Deprecated
678-
public class ForwardingSessionReconnectQueue extends SessionReconnectQueue
679-
{
680-
private final Consumer<JDA> appender;
681-
private final Consumer<JDA> remover;
682-
683-
public ForwardingSessionReconnectQueue(Consumer<JDA> appender, Consumer<JDA> remover)
684-
{
685-
super(null);
686-
687-
this.appender = appender == null ? jda -> {} : appender;
688-
this.remover = remover == null ? jda -> {} : remover;
689-
}
690-
691-
@Override
692-
public void appendSession(final WebSocketClient client)
693-
{
694-
this.appender.accept(client.getJDA());
695-
}
696-
697-
@Override
698-
public void removeSession(final WebSocketClient client)
699-
{
700-
this.remover.accept(client.getJDA());
701-
}
702-
703-
@Override
704-
protected void runWorker() { /* just to overwrite */ }
705-
}
706650
}

src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java

+1-31
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import com.neovisionaries.ws.client.WebSocketFactory;
1919
import net.dv8tion.jda.core.OnlineStatus;
20-
import net.dv8tion.jda.core.ShardedRateLimiter;
2120
import net.dv8tion.jda.core.audio.factory.IAudioSendFactory;
2221
import net.dv8tion.jda.core.entities.Game;
2322
import net.dv8tion.jda.core.hooks.IEventManager;
@@ -65,7 +64,6 @@ public class DefaultShardManagerBuilder
6564
protected IntFunction<OnlineStatus> statusProvider = null;
6665
protected Collection<Integer> shards = null;
6766
protected IEventManager eventManager = null;
68-
protected ShardedRateLimiter shardedRateLimiter = null;
6967
protected OkHttpClient.Builder httpClientBuilder = null;
7068
protected WebSocketFactory wsFactory = null;
7169
protected IAudioSendFactory audioSendFactory = null;
@@ -84,8 +82,6 @@ public DefaultShardManagerBuilder() {}
8482
* for the resulting ShardManager instance. This can be used to sync behaviour and state between shards
8583
* of a bot and should be one and the same instance on all builders for the shards.
8684
*
87-
* <p><b>Setting this disables the {@link #setShardedRateLimiter(ShardedRateLimiter)} settings.</b>
88-
*
8985
* @param controller
9086
* The {@link net.dv8tion.jda.core.utils.SessionController SessionController} to use
9187
*
@@ -546,32 +542,6 @@ public DefaultShardManagerBuilder setRequestTimeoutRetry(boolean retryOnTimeout)
546542
return this;
547543
}
548544

549-
/**
550-
* Sets the {@link net.dv8tion.jda.core.ShardedRateLimiter ShardedRateLimiter} that will be used to keep
551-
* track of rate limits across sessions.
552-
* <br>When one shard hits the global rate limit all others will be informed by this value wrapper.
553-
*
554-
* <p>It is recommended to use the same ShardedRateLimiter for all shards and not one each. This is
555-
* similar to {@link net.dv8tion.jda.core.requests.SessionReconnectQueue SessionReconnectQueue}!
556-
*
557-
* <p>When you construct multiple ShardManagers manage your shards it is recommended to use the same ShardedRateLimiter on
558-
* all of them. But it is to be <u>avoided</u> to use the same ShardedRateLimiter for different accounts/tokens!
559-
*
560-
* <p><b>If none is provided the ShardManager will use fall back to JDA's default implementation!</b>
561-
*
562-
* @param shardedRateLimiter
563-
* ShardedRateLimiter used to keep track of cross-session rate limits
564-
*
565-
* @return The {@link net.dv8tion.jda.bot.sharding.DefaultShardManagerBuilder DefaultShardManagerBuilder} instance. Useful for chaining.
566-
*/
567-
@Deprecated
568-
public DefaultShardManagerBuilder setShardedRateLimiter(ShardedRateLimiter shardedRateLimiter)
569-
{
570-
Checks.notNull(shardedRateLimiter, "shardedRateLimiter");
571-
this.shardedRateLimiter = shardedRateLimiter;
572-
return this;
573-
}
574-
575545
/**
576546
* Sets the list of shards the {@link DefaultShardManager DefaultShardManager} should contain.
577547
*
@@ -763,7 +733,7 @@ public ShardManager build() throws LoginException, IllegalArgumentException
763733
this.shardsTotal, this.shards, this.sessionController,
764734
this.listeners, this.token, this.eventManager,
765735
this.audioSendFactory, this.gameProvider, this.statusProvider,
766-
this.httpClientBuilder, this.wsFactory, this.threadFactory, this.shardedRateLimiter,
736+
this.httpClientBuilder, this.wsFactory, this.threadFactory,
767737
this.maxReconnectDelay, this.corePoolSize, this.enableVoice, this.enableShutdownHook, this.enableBulkDeleteSplitting,
768738
this.autoReconnect, this.idleProvider, this.retryOnTimeout, this.useShutdownNow, this.enableContext, this.contextProvider);
769739

src/main/java/net/dv8tion/jda/client/managers/EmoteManager.java

-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ public AuditableRestAction<Void> setName(String name)
119119
* <br>If these are empty the Emote will be available to everyone otherwise only available to the specified roles.
120120
*
121121
* <p>An emote's restriction roles <b>must not</b> contain {@code null}!
122-
* <br>Passing the roles field will be ignored unless the application is whitelisted as an emoji provider.
123-
* For more information and to request whitelisting please contact {@code [email protected]}
124122
*
125123
* @param roles
126124
* The new not-null set of {@link net.dv8tion.jda.core.entities.Role Roles} for the selected {@link net.dv8tion.jda.core.entities.Emote Emote}

src/main/java/net/dv8tion/jda/client/managers/EmoteManagerUpdatable.java

-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ public EmoteField<String> getNameField()
138138
* An {@link net.dv8tion.jda.client.managers.fields.EmoteField EmoteField}
139139
* for the restriction roles of the selected {@link net.dv8tion.jda.core.entities.Emote Emote}.
140140
* <br>If the roles are empty this Emote will be available to everyone.
141-
* <br>Passing the roles field will be ignored unless the application is whitelisted as an emoji provider.
142-
* For more information and to request whitelisting please contact {@code [email protected]}
143141
*
144142
* <p>To set the value use {@link net.dv8tion.jda.core.managers.fields.Field#setValue(Object) setValue(Collection)}
145143
* on the returned {@link net.dv8tion.jda.client.managers.fields.EmoteField EmoteField} instance.

0 commit comments

Comments
 (0)