Skip to content

Commit 3c065b7

Browse files
Update some outdated and no longer accurate javadoc (discord-jda#1038)
* Mention exception for removeReaction * Update description and since tag on setSpeakingDelay * Change annotation on JDABuilder#setStatus
1 parent 8e9f7c3 commit 3c065b7

35 files changed

+158
-100
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2015-2019 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
/**
17+
* Annotations used for documentation.
18+
*/
19+
package net.dv8tion.jda.annotations;

src/main/java/net/dv8tion/jda/api/EmbedBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ public MessageEmbed build()
120120
throw new IllegalStateException(String.format("Description is longer than %d! Please limit your input!", MessageEmbed.TEXT_MAX_LENGTH));
121121
if (length() > MessageEmbed.EMBED_MAX_LENGTH_BOT)
122122
throw new IllegalStateException("Cannot build an embed with more than " + MessageEmbed.EMBED_MAX_LENGTH_BOT + " characters!");
123-
final String descrip = this.description.length() < 1 ? null : this.description.toString();
123+
final String description = this.description.length() < 1 ? null : this.description.toString();
124124

125-
return EntityBuilder.createMessageEmbed(url, title, descrip, EmbedType.RICH, timestamp,
125+
return EntityBuilder.createMessageEmbed(url, title, description, EmbedType.RICH, timestamp,
126126
color, thumbnail, null, author, null, footer, image, new LinkedList<>(fields));
127127
}
128128

src/main/java/net/dv8tion/jda/api/JDABuilder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ public JDABuilder setActivity(@Nullable Activity activity)
665665
* @see net.dv8tion.jda.api.managers.Presence#setStatus(OnlineStatus) Presence.setStatus(OnlineStatus)
666666
*/
667667
@Nonnull
668-
public JDABuilder setStatus(@Nullable OnlineStatus status)
668+
@SuppressWarnings("ConstantConditions") // we have to enforce the nonnull at runtime
669+
public JDABuilder setStatus(@Nonnull OnlineStatus status)
669670
{
670671
if (status == null || status == OnlineStatus.UNKNOWN)
671672
throw new IllegalArgumentException("OnlineStatus cannot be null or unknown!");

src/main/java/net/dv8tion/jda/api/audio/SpeakingMode.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static EnumSet<SpeakingMode> getModes(int mask)
6969
}
7070

7171
/**
72-
* Converts the given speaking modes into raw its bitmast.
72+
* Converts the given speaking modes into raw its bitmask.
7373
* This is only useful for sending speaking updates.
7474
*
7575
* @param modes
@@ -88,7 +88,7 @@ public static int getRaw(@Nullable SpeakingMode... modes)
8888
}
8989

9090
/**
91-
* Converts the given speaking modes into raw its bitmast.
91+
* Converts the given speaking modes into raw its bitmask.
9292
* This is only useful for sending speaking updates.
9393
*
9494
* @param modes

src/main/java/net/dv8tion/jda/api/audio/factory/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
/**
1818
* Audio send factories that can be implemented to generate
1919
* custom audio send packages to be provided to Discord.
20-
* <br>A default factory is provided.
20+
* <br>A default factory is provided by {@link net.dv8tion.jda.api.audio.factory.DefaultSendFactory DefaultSendFactory}.
2121
*/
2222
package net.dv8tion.jda.api.audio.factory;

src/main/java/net/dv8tion/jda/api/audio/package-info.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616

1717
/**
1818
* The audio API for Discord.
19-
* This is only available if not specifically disabled through the {@link net.dv8tion.jda.api.JDABuilder JDABuilder}.
2019
*
21-
* <p>We encode/decode opus audio packages that can be used in an {@link net.dv8tion.jda.internal.audio.AudioConnection AudioConnection}.
20+
* <p>We encode/decode opus audio packages that can be used in an audio connection.
2221
* To interact with the connection an {@link net.dv8tion.jda.api.audio.AudioSendHandler AudioSendHandler}
2322
* or an {@link net.dv8tion.jda.api.audio.AudioReceiveHandler AudioReceiveHandler} have to be specified the audio manager.
2423
*/

src/main/java/net/dv8tion/jda/api/entities/Activity.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public interface Activity
101101
static Activity playing(@Nonnull String name)
102102
{
103103
Checks.notBlank(name, "Name");
104-
return EntityBuilder.createAcitvity(name, null, ActivityType.DEFAULT);
104+
return EntityBuilder.createActivity(name, null, ActivityType.DEFAULT);
105105
}
106106

107107
/**
@@ -130,7 +130,7 @@ static Activity streaming(@Nonnull String name, @Nullable String url)
130130
type = ActivityType.STREAMING;
131131
else
132132
type = ActivityType.DEFAULT;
133-
return EntityBuilder.createAcitvity(name, url, type);
133+
return EntityBuilder.createActivity(name, url, type);
134134
}
135135

136136
/**
@@ -149,7 +149,7 @@ static Activity streaming(@Nonnull String name, @Nullable String url)
149149
static Activity listening(@Nonnull String name)
150150
{
151151
Checks.notBlank(name, "Name");
152-
return EntityBuilder.createAcitvity(name, null, ActivityType.LISTENING);
152+
return EntityBuilder.createActivity(name, null, ActivityType.LISTENING);
153153
}
154154

155155
/**
@@ -171,7 +171,7 @@ static Activity listening(@Nonnull String name)
171171
static Activity watching(@Nonnull String name)
172172
{
173173
Checks.notBlank(name, "Name");
174-
return EntityBuilder.createAcitvity(name, null, ActivityType.WATCHING);
174+
return EntityBuilder.createActivity(name, null, ActivityType.WATCHING);
175175
}
176176

177177
/**

src/main/java/net/dv8tion/jda/api/entities/ClientType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public String getKey()
5858
* @param key
5959
* The api key to check
6060
*
61-
* @return THe resolved ClientType or {@link #UNKNOWN}
61+
* @return The resolved ClientType or {@link #UNKNOWN}
6262
*/
6363
@Nonnull
6464
public static ClientType fromKey(@Nonnull String key)

src/main/java/net/dv8tion/jda/api/entities/Emote.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ default boolean hasRoles()
113113

114114
/**
115115
* Whether this emote is managed. A managed Emote is controlled by Discord, not the Guild administrator, typical
116-
* via a service like BBTV in conjunction with Twitch.
116+
* via a service like BTTV in conjunction with Twitch.
117117
* <br><a href="https://discordapp.com/developers/docs/resources/emoji#emoji-object" target="_blank">Learn More</a>
118118
*
119119
* @return True, if this emote is managed

src/main/java/net/dv8tion/jda/api/entities/Guild.java

-2
Original file line numberDiff line numberDiff line change
@@ -2828,8 +2828,6 @@ default AuditableRestAction<Void> unban(@Nonnull User user)
28282828
* <br>None of the provided roles may be the <u>Public Role</u> of the current Guild.
28292829
* <br>If a role is both in {@code rolesToAdd} and {@code rolesToRemove} it will be removed.
28302830
*
2831-
* <p>None of the provided collections may be null
2832-
*
28332831
* <h1>Warning</h1>
28342832
* <b>This may <u>not</u> be used together with any other role add/remove/modify methods for the same Member
28352833
* within one event listener cycle! The changes made by this require cache updates which are triggered by

src/main/java/net/dv8tion/jda/api/entities/Message.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ default boolean isFromGuild()
863863
* @throws java.lang.IllegalStateException
864864
* <ul>
865865
* <li>If the message attempting to be edited was not created by the currently logged in account</li>
866-
* <li>If the message contains a MessageEmebd that is not
866+
* <li>If the message contains a MessageEmbed that is not
867867
* {@link net.dv8tion.jda.api.entities.MessageEmbed#isSendable(net.dv8tion.jda.api.AccountType) sendable}</li>
868868
* </ul>
869869
*

src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ public RestAction<List<Message>> retrievePast(int amount)
182182
return new RestActionImpl<>(jda, route, (response, request) ->
183183
{
184184
EntityBuilder builder = jda.getEntityBuilder();
185-
LinkedList<Message> msgs = new LinkedList<>();
185+
LinkedList<Message> messages = new LinkedList<>();
186186
DataArray historyJson = response.getArray();
187187

188188
for (int i = 0; i < historyJson.length(); i++)
189-
msgs.add(builder.createMessage(historyJson.getObject(i)));
189+
messages.add(builder.createMessage(historyJson.getObject(i)));
190190

191-
msgs.forEach(msg -> history.put(msg.getIdLong(), msg));
192-
return msgs;
191+
messages.forEach(msg -> history.put(msg.getIdLong(), msg));
192+
return messages;
193193
});
194194
}
195195

@@ -251,19 +251,19 @@ public RestAction<List<Message>> retrieveFuture(int amount)
251251
return new RestActionImpl<>(jda, route, (response, request) ->
252252
{
253253
EntityBuilder builder = jda.getEntityBuilder();
254-
LinkedList<Message> msgs = new LinkedList<>();
254+
LinkedList<Message> messages = new LinkedList<>();
255255
DataArray historyJson = response.getArray();
256256

257257
for (int i = 0; i < historyJson.length(); i++)
258-
msgs.add(builder.createMessage(historyJson.getObject(i)));
258+
messages.add(builder.createMessage(historyJson.getObject(i)));
259259

260-
for (Iterator<Message> it = msgs.descendingIterator(); it.hasNext();)
260+
for (Iterator<Message> it = messages.descendingIterator(); it.hasNext();)
261261
{
262262
Message m = it.next();
263263
history.put(0, m.getIdLong(), m);
264264
}
265265

266-
return msgs;
266+
return messages;
267267
});
268268
}
269269

src/main/java/net/dv8tion/jda/api/entities/MessageReaction.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,22 @@ public RestAction<Void> removeReaction()
312312
* @throws java.lang.IllegalArgumentException
313313
* If the provided {@code user} is null.
314314
* @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
315-
* if the provided User is not us and we do not have permission to
315+
* If the provided User is not us and we do not have permission to
316316
* {@link net.dv8tion.jda.api.Permission#MESSAGE_MANAGE manage messages}
317317
* in the channel this reaction was used in
318+
* @throws net.dv8tion.jda.api.exceptions.PermissionException
319+
* If the message is from another user in a {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}
318320
*
319-
* @return {@link net.dv8tion.jda.api.requests.RestAction RestAction} - Type: Void
321+
* @return {@link net.dv8tion.jda.api.requests.RestAction RestAction}
320322
* Nothing is returned on success
321323
*/
322324
@Nonnull
323325
@CheckReturnValue
324326
public RestAction<Void> removeReaction(@Nonnull User user)
325327
{
326328
Checks.notNull(user, "User");
327-
if (!user.equals(getJDA().getSelfUser()))
329+
boolean self = user.equals(getJDA().getSelfUser());
330+
if (!self)
328331
{
329332
if (channel.getType() == ChannelType.TEXT)
330333
{
@@ -341,11 +344,8 @@ public RestAction<Void> removeReaction(@Nonnull User user)
341344
String code = emote.isEmote()
342345
? emote.getName() + ":" + emote.getId()
343346
: EncodingUtil.encodeUTF8(emote.getName());
344-
Route.CompiledRoute route;
345-
if (user.equals(getJDA().getSelfUser()))
346-
route = Route.Messages.REMOVE_REACTION.compile(channel.getId(), getMessageId(), code, "@me");
347-
else
348-
route = Route.Messages.REMOVE_REACTION.compile(channel.getId(), getMessageId(), code, user.getId());
347+
String target = self ? "@me" : user.getId();
348+
Route.CompiledRoute route = Route.Messages.REMOVE_REACTION.compile(channel.getId(), getMessageId(), code, target);
349349
return new RestActionImpl<>(getJDA(), route);
350350
}
351351

src/main/java/net/dv8tion/jda/api/entities/TextChannel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public interface TextChannel extends GuildChannel, MessageChannel, IMentionable
112112
* <br>The webhook could not be created due to a permission discrepancy</li>
113113
*
114114
* <li>{@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS}
115-
* <br>The {@link net.dv8tion.jda.api.Permission.VIEW_CHANNEL VIEW_CHANNEL} permission was removed</li>
115+
* <br>The {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL VIEW_CHANNEL} permission was removed</li>
116116
* </ul>
117117
*
118118
* @param name

src/main/java/net/dv8tion/jda/api/events/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* the end-user about the connection state of the current JDA instance.
2020
*
2121
* <p>This package contains all implementations of {@link net.dv8tion.jda.api.events.Event Event}.
22-
* <br>These are specific depending on the event that has been received by the {@link net.dv8tion.jda.internal.requests.WebSocketClient WebSocketClient}
22+
* <br>These are specific depending on the event that has been received by the gateway connection.
2323
*
2424
* <p>All events are forwarded by an {@link net.dv8tion.jda.api.hooks.IEventManager IEventManager} implementation.
2525
* <br>Some events are specific for JDA internal events such as the {@link net.dv8tion.jda.api.events.ReadyEvent ReadyEvent}

src/main/java/net/dv8tion/jda/api/hooks/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
* <p>The {@link net.dv8tion.jda.api.hooks.AnnotatedEventManager AnnotatedEventManager}
2929
* can forward events directly to methods that have the {@link net.dv8tion.jda.api.hooks.SubscribeEvent SubscribeEvent} annotation.
3030
*
31-
* <p><b>Note: All of the standard EventManager implementations are synchronized</b>
31+
* <p><b>Note: All of the standard EventManager implementations are single-threaded</b>
3232
*/
3333
package net.dv8tion.jda.api.hooks;

src/main/java/net/dv8tion/jda/api/managers/AudioManager.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ default void setSpeakingMode(@Nonnull SpeakingMode... mode)
149149
* <br>This can be useful for send systems that buffer a certain interval of audio frames that will be sent.
150150
* By default the delay is 200 milliseconds which is also the minimum delay.
151151
*
152-
* <p>If the delay is less than 200 milliseconds it will reset it the minimum delay. The provided delay
152+
* <p>If the delay is less than 200 milliseconds it will use the minimum delay. The provided delay
153153
* will be aligned to the audio frame length of 20 milliseconds by means of integer division. This means
154154
* it will be rounded down to the next biggest multiple of 20.
155155
*
@@ -158,6 +158,8 @@ default void setSpeakingMode(@Nonnull SpeakingMode... mode)
158158
*
159159
* @param millis
160160
* The delay that should be used, in milliseconds
161+
*
162+
* @since 4.0.0
161163
*/
162164
void setSpeakingDelay(int millis);
163165

src/main/java/net/dv8tion/jda/api/managers/package-info.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
* with either an update task or atomic setters. This also includes classes which allow to
2020
* operate on entities like the moderation of a {@link net.dv8tion.jda.api.entities.Guild Guild}.
2121
*
22-
* <p>Manager types allow to directly modify one or more values
22+
* <p>Manager types allow to directly modify one or more values.
2323
*
24-
* <p>All managers require a RestAction execution.
24+
* <p>Almost all managers require a RestAction execution.
2525
*/
2626
package net.dv8tion.jda.api.managers;

src/main/java/net/dv8tion/jda/api/package-info.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@
1515
*/
1616

1717
/**
18-
* The api JDA features that are both available for
19-
* BOT and CLIENT applications.
18+
* The API features of JDA.
2019
*
2120
* <p>This package contains information about the JDA version used by this library.
2221
* See {@link net.dv8tion.jda.api.JDAInfo JDAInfo}!
2322
*
24-
* <p>It includes enums that can be found at various locations throughout {@link net.dv8tion.jda} not only the api package!
25-
*
2623
* <p>To build a JDA instance you
2724
* would use the {@link net.dv8tion.jda.api.JDABuilder JDABuilder} with a specified {@link net.dv8tion.jda.api.AccountType AccountType}
2825
* to differ between a bot and a client account. Client accounts are commonly referenced as User accounts due to them being used by

src/main/java/net/dv8tion/jda/api/requests/package-info.java

+2-16
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,13 @@
1515
*/
1616

1717
/**
18-
* Discord API connection internals.
19-
* Includes REST and WebSocket connections
18+
* Discord API communication features.
2019
*
21-
* <p><u><b>REST API</b></u>
22-
* <br>The {@link net.dv8tion.jda.internal.requests.Requester Requester}
23-
* is used to create HTTPs requests with the Discord API through {@link net.dv8tion.jda.internal.requests.Route Routes}.
24-
* <br>This automatically handles rate limitations (429) that restrict our request rates. For that it uses an implementation
25-
* of {@link net.dv8tion.jda.internal.requests.RateLimiter RateLimiter} specific for a certain {@link net.dv8tion.jda.api.AccountType AccountType}.
26-
* <br>{@link net.dv8tion.jda.api.requests.restaction Learn More}
27-
*
28-
* <p>The {@link net.dv8tion.jda.api.requests.RestAction RestAction} can be found throughout JDA and allows
20+
* <p>The {@link net.dv8tion.jda.api.requests.RestAction RestAction} interface can be found throughout JDA and allows
2921
* to specify how the Requester should deal with rate limits.
3022
* It has extensions with additional functionalities in {@link net.dv8tion.jda.api.requests.restaction}.
3123
*
3224
* <p>In the case of a failed Request the RestAction will be provided with an {@link net.dv8tion.jda.api.exceptions.ErrorResponseException ErrorResponseException}
3325
* which contains a {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponse} representing the failure cause!
34-
*
35-
* <p><u><b>WebSocket API</b></u>
36-
* <br>The {@link net.dv8tion.jda.internal.requests.WebSocketClient WebSocketClient} is used to
37-
* handle the {@link net.dv8tion.jda.api.events.Event Event} flow and connection to the Discord gateway.
38-
* <br>It can send {@link net.dv8tion.jda.api.managers.Presence Presence} updates that will determine how
39-
* the Discord Client will display the currently connected account (Online Status / Activity)
4026
*/
4127
package net.dv8tion.jda.api.requests;

src/main/java/net/dv8tion/jda/api/requests/restaction/order/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* <li>{@link net.dv8tion.jda.api.requests.restaction.order.RoleOrderAction Roles}</li>
2525
* </ul>
2626
*
27-
* <p>Abstract base implementation can be found at {@link net.dv8tion.jda.api.requests.restaction.order.OrderAction OrderAction}
27+
* <p>The abstract base can be found at {@link net.dv8tion.jda.api.requests.restaction.order.OrderAction OrderAction}.
2828
*
2929
* @since 3.0
3030
*/

src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/package-info.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
/**
1818
* Extensions of {@link net.dv8tion.jda.api.requests.RestAction RestAction} that allow
19-
* to access paginated discord endpoints like {@link net.dv8tion.jda.internal.requests.Route.Messages#GET_REACTION_USERS Route.Messages.GET_REACTION_USERS}
19+
* to access paginated discord endpoints like the message history of a {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}.
2020
* <br>The {@link net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction PaginationAction} is designed to work
2121
* as an {@link java.lang.Iterable Iterable} of the specified endpoint. Each implementation specifies the endpoints it will
22-
* use in the class-level javadoc
22+
* use in the class-level javadoc.
2323
*
2424
* @since 3.1
2525
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2015-2019 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
/**
17+
* Implementations for {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} which enable
18+
* auto-sharding.
19+
*/
20+
package net.dv8tion.jda.api.sharding;

src/main/java/net/dv8tion/jda/api/utils/WidgetUtil.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private Widget(long guildId)
309309
* Constructs an available Widget
310310
*
311311
* @param json
312-
* The {@link org.json.JSONObject JSONObject} to construct the Widget from
312+
* The {@link net.dv8tion.jda.api.utils.data.DataObject DataObject} to construct the Widget from
313313
*/
314314
private Widget(@Nonnull DataObject json)
315315
{
@@ -563,7 +563,7 @@ private Member(@Nonnull DataObject json, @Nonnull Widget widget)
563563
this.avatar = json.getString("avatar", null);
564564
this.nickname = json.getString("nick", null);
565565
this.status = OnlineStatus.fromKey(json.getString("status"));
566-
this.game = json.isNull("game") ? null : EntityBuilder.createAcitvity(json.getObject("game"));
566+
this.game = json.isNull("game") ? null : EntityBuilder.createActivity(json.getObject("game"));
567567
}
568568

569569
private void setVoiceState(VoiceState voiceState)

0 commit comments

Comments
 (0)