From bdcece17c86328dab16546d78627f8c73a2493f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 29 Jun 2020 18:59:53 +0200 Subject: [PATCH 001/121] Correctly set concurrency in SessionControllerAdapter --- .../net/dv8tion/jda/api/utils/SessionControllerAdapter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java b/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java index 56e8578431..469cbf9c21 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java @@ -104,8 +104,9 @@ public void handleResponse(Response response, Request request) String url = object.getString("url"); int shards = object.getInt("shards"); + int concurrency = object.getObject("session_start_limit").getInt("max_concurrency", 1); - request.onSuccess(new ShardedGateway(url, shards)); + request.onSuccess(new ShardedGateway(url, shards, concurrency)); } else if (response.code == 401) { From f10e257cc7db72725507f875fcee120f5671ded5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 30 Jun 2020 18:52:10 +0200 Subject: [PATCH 002/121] Deprecate MessageBuilder#sendTo (#1321) --- src/main/java/net/dv8tion/jda/api/MessageBuilder.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java index b590aab0d7..c33baea3b5 100644 --- a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java @@ -27,7 +27,6 @@ import net.dv8tion.jda.internal.utils.Checks; import net.dv8tion.jda.internal.utils.Helpers; -import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.*; @@ -1119,9 +1118,14 @@ public int lastIndexOf(@Nonnull CharSequence target, int fromIndex, int endIndex * If this is a PrivateChannel and both users (sender and receiver) are bots * * @return {@link MessageAction MessageAction} + * + * @deprecated Use {@link MessageChannel#sendMessage(Message) channel.sendMessage(builder.build())} instead */ @Nonnull - @CheckReturnValue + @Deprecated + @ForRemoval + @DeprecatedSince("4.2.1") + @ReplaceWith("channel.sendMessage(builder.build())") public MessageAction sendTo(@Nonnull MessageChannel channel) { Checks.notNull(channel, "Target Channel"); From 607c267ca91e5fd73e24de2ed0b891728e251fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 1 Jul 2020 08:25:26 +0200 Subject: [PATCH 003/121] Remove RejectedExecutionException in gateway after shutting down We can simply check the status when catching the exception. If the status indicates shutdown we log on debug instead of error. --- .../jda/internal/requests/WebSocketSendingThread.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java index 1cf818ea77..29cbcac42e 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java @@ -17,6 +17,7 @@ package net.dv8tion.jda.internal.requests; import gnu.trove.map.TLongObjectMap; +import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.GuildVoiceState; import net.dv8tion.jda.api.managers.AudioManager; @@ -170,7 +171,10 @@ else if (!attemptedToSend) } catch (RejectedExecutionException ex) { - LOG.error("Was unable to schedule next packet due to rejected execution by threadpool", ex); + if (api.getStatus() == JDA.Status.SHUTTING_DOWN || api.getStatus() == JDA.Status.SHUTDOWN) + LOG.debug("Rejected task after shutdown", ex); + else + LOG.error("Was unable to schedule next packet due to rejected execution by threadpool", ex); } } From 9e8408894409bb723d8a0c4adf53f82e753eabfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 2 Jul 2020 14:46:56 +0200 Subject: [PATCH 004/121] Add ETF support (#1309) --- .../net/dv8tion/jda/api/GatewayEncoding.java | 37 +++ .../java/net/dv8tion/jda/api/JDABuilder.java | 22 +- .../jda/api/sharding/DefaultShardManager.java | 2 +- .../sharding/DefaultShardManagerBuilder.java | 23 +- .../dv8tion/jda/api/utils/data/DataArray.java | 67 +++- .../jda/api/utils/data/DataObject.java | 55 +++- .../jda/api/utils/data/etf/ExTermDecoder.java | 285 ++++++++++++++++++ .../jda/api/utils/data/etf/ExTermEncoder.java | 219 ++++++++++++++ .../jda/api/utils/data/etf/ExTermTag.java | 55 ++++ .../jda/api/utils/data/etf/package-info.java | 22 ++ .../net/dv8tion/jda/internal/JDAImpl.java | 11 +- .../handle/MessageBulkDeleteHandler.java | 16 +- .../jda/internal/managers/PresenceImpl.java | 2 +- .../internal/requests/WebSocketClient.java | 57 ++-- .../requests/WebSocketSendingThread.java | 9 +- .../config/sharding/ShardingMetaConfig.java | 13 +- 16 files changed, 835 insertions(+), 60 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/api/GatewayEncoding.java create mode 100644 src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java create mode 100644 src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java create mode 100644 src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java create mode 100644 src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java diff --git a/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java b/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java new file mode 100644 index 0000000000..86b30120f1 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api; + +/** + * Encoding mode used by the gateway for incoming and outgoing payloads. + */ +public enum GatewayEncoding +{ + /** + * Standard JSON format. This format uses a human-readable string encoding. + * + * @see JSON Specification + */ + JSON, + /** + * Erlang External Term Format (binary). This is an optimized format which encodes all payloads + * in a binary stream. + * + * @see Erlang -- External Term Format + */ + ETF +} diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index 72963ef2fc..a908b179b8 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -91,6 +91,7 @@ public class JDABuilder protected EnumSet flags = ConfigFlag.getDefault(); protected ChunkingFilter chunkingFilter = ChunkingFilter.ALL; protected MemberCachePolicy memberCachePolicy = MemberCachePolicy.ALL; + protected GatewayEncoding encoding = GatewayEncoding.JSON; /** * Creates a completely empty JDABuilder. @@ -530,6 +531,25 @@ private JDABuilder setDisabledCache(EnumSet flags) return this; } + /** + * Choose which {@link GatewayEncoding} JDA should use. + * + * @param encoding + * The {@link GatewayEncoding} (default: JSON) + * + * @throws IllegalArgumentException + * If null is provided + * + * @return The JDABuilder instance. Useful for chaining. + */ + @Nonnull + public JDABuilder setGatewayEncoding(@Nonnull GatewayEncoding encoding) + { + Checks.notNull(encoding, "GatewayEncoding"); + this.encoding = encoding; + return this; + } + /** * Whether JDA should fire {@link net.dv8tion.jda.api.events.RawGatewayEvent} for every discord event. *
Default: {@code false} @@ -1846,7 +1866,7 @@ public JDA build() throws LoginException .setCacheActivity(activity) .setCacheIdle(idle) .setCacheStatus(status); - jda.login(shardInfo, compression, true, intents); + jda.login(shardInfo, compression, true, intents, encoding); return jda; } diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java index 28533f415d..2f94416b6e 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java @@ -592,7 +592,7 @@ protected JDAImpl buildInstance(final int shardId) throws LoginException, Interr jda.setSelfUser(selfUser); jda.setStatus(JDA.Status.INITIALIZED); //This is already set by JDA internally, but this is to make sure the listeners catch it. - final int shardTotal = jda.login(this.gatewayURL, shardInfo, this.metaConfig.getCompression(), false, shardingConfig.getIntents()); + final int shardTotal = jda.login(this.gatewayURL, shardInfo, this.metaConfig.getCompression(), false, shardingConfig.getIntents(), this.metaConfig.getEncoding()); if (getShardsTotal() == -1) shardingConfig.setShardsTotal(shardTotal); diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index 9b81f78a85..08374adc18 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -18,6 +18,7 @@ import com.neovisionaries.ws.client.WebSocketFactory; import net.dv8tion.jda.annotations.DeprecatedSince; import net.dv8tion.jda.annotations.ReplaceWith; +import net.dv8tion.jda.api.GatewayEncoding; import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.audio.factory.IAudioSendFactory; @@ -68,6 +69,7 @@ public class DefaultShardManagerBuilder protected EnumSet flags = ConfigFlag.getDefault(); protected EnumSet shardingFlags = ShardingConfigFlag.getDefault(); protected Compression compression = Compression.ZLIB; + protected GatewayEncoding encoding = GatewayEncoding.JSON; protected int shardsTotal = -1; protected int maxReconnectDelay = 900; protected int largeThreshold = 250; @@ -506,6 +508,25 @@ private DefaultShardManagerBuilder setDisabledCache(EnumSet flags) return this; } + /** + * Choose which {@link GatewayEncoding} JDA should use. + * + * @param encoding + * The {@link GatewayEncoding} (default: JSON) + * + * @throws IllegalArgumentException + * If null is provided + * + * @return The DefaultShardManagerBuilder instance. Useful for chaining. + */ + @Nonnull + public DefaultShardManagerBuilder setGatewayEncoding(@Nonnull GatewayEncoding encoding) + { + Checks.notNull(encoding, "GatewayEncoding"); + this.encoding = encoding; + return this; + } + /** * Whether JDA should fire {@link net.dv8tion.jda.api.events.RawGatewayEvent} for every discord event. *
Default: {@code false} @@ -2200,7 +2221,7 @@ public ShardManager build() throws LoginException, IllegalArgumentException presenceConfig.setIdleProvider(idleProvider); final ThreadingProviderConfig threadingConfig = new ThreadingProviderConfig(rateLimitPoolProvider, gatewayPoolProvider, callbackPoolProvider, eventPoolProvider, threadFactory); final ShardingSessionConfig sessionConfig = new ShardingSessionConfig(sessionController, voiceDispatchInterceptor, httpClient, httpClientBuilder, wsFactory, audioSendFactory, flags, shardingFlags, maxReconnectDelay, largeThreshold); - final ShardingMetaConfig metaConfig = new ShardingMetaConfig(maxBufferSize, contextProvider, cacheFlags, flags, compression); + final ShardingMetaConfig metaConfig = new ShardingMetaConfig(maxBufferSize, contextProvider, cacheFlags, flags, compression, encoding); final DefaultShardManager manager = new DefaultShardManager(this.token, this.shards, shardingConfig, eventConfig, presenceConfig, threadingConfig, sessionConfig, metaConfig, chunkingFilter); manager.login(); diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java b/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java index b898f54648..746053e845 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java @@ -21,20 +21,23 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.type.CollectionType; import net.dv8tion.jda.api.exceptions.ParsingException; +import net.dv8tion.jda.api.utils.data.etf.ExTermDecoder; +import net.dv8tion.jda.api.utils.data.etf.ExTermEncoder; +import net.dv8tion.jda.internal.utils.Checks; import org.jetbrains.annotations.Contract; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.UncheckedIOException; +import java.io.*; +import java.nio.ByteBuffer; import java.util.*; +import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.UnaryOperator; +import java.util.stream.IntStream; +import java.util.stream.Stream; /** * Represents a list of values used in communication with the Discord API. @@ -168,6 +171,36 @@ public static DataArray fromJson(@Nonnull Reader json) } } + /** + * Parses using {@link ExTermDecoder}. + * The provided data must start with the correct version header (131). + * + * @param data + * The data to decode + * + * @throws IllegalArgumentException + * If the provided data is null + * @throws net.dv8tion.jda.api.exceptions.ParsingException + * If the provided ETF payload is incorrectly formatted or an I/O error occurred + * + * @return A DataArray instance for the provided payload + */ + @Nonnull + public static DataArray fromETF(@Nonnull byte[] data) + { + Checks.notNull(data, "Data"); + try + { + List list = ExTermDecoder.unpackList(ByteBuffer.wrap(data)); + return new DataArray(list); + } + catch (Exception ex) + { + log.error("Failed to parse ETF data {}", Arrays.toString(data), ex); + throw new ParsingException(ex); + } + } + /** * Whether the value at the specified index is null. * @@ -605,10 +638,11 @@ public DataArray remove(@Nullable Object value) } /** - * Serialize this object as JSON. + * Serializes this object as JSON. * - * @return a byte array containing the JSON representation of this object. + * @return byte array containing the JSON representation of this object */ + @Nonnull public byte[] toJson() { try @@ -623,6 +657,18 @@ public byte[] toJson() } } + /** + * Serializes this object as ETF LIST term. + * + * @return byte array containing the encoded ETF term + */ + @Nonnull + public byte[] toETF() + { + ByteBuffer buffer = ExTermEncoder.pack(data); + return Arrays.copyOfRange(buffer.array(), buffer.arrayOffset(), buffer.arrayOffset() + buffer.limit()); + } + @Override public String toString() { @@ -682,4 +728,11 @@ public Iterator iterator() { return data.iterator(); } + + @Nonnull + public Stream stream(BiFunction mapper) + { + return IntStream.range(0, length()) + .mapToObj(index -> mapper.apply(this, index)); + } } diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java b/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java index 0bcb665524..8de504ee7c 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java @@ -21,17 +21,17 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.type.MapType; import net.dv8tion.jda.api.exceptions.ParsingException; +import net.dv8tion.jda.api.utils.data.etf.ExTermDecoder; +import net.dv8tion.jda.api.utils.data.etf.ExTermEncoder; +import net.dv8tion.jda.internal.utils.Checks; import org.jetbrains.annotations.Contract; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.UncheckedIOException; +import java.io.*; +import java.nio.ByteBuffer; import java.util.*; import java.util.function.Function; import java.util.function.UnaryOperator; @@ -181,6 +181,36 @@ public static DataObject fromJson(@Nonnull Reader stream) } } + /** + * Parses using {@link ExTermDecoder}. + * The provided data must start with the correct version header (131). + * + * @param data + * The data to decode + * + * @throws IllegalArgumentException + * If the provided data is null + * @throws net.dv8tion.jda.api.exceptions.ParsingException + * If the provided ETF payload is incorrectly formatted or an I/O error occurred + * + * @return A DataObject instance for the provided payload + */ + @Nonnull + public static DataObject fromETF(@Nonnull byte[] data) + { + Checks.notNull(data, "Data"); + try + { + Map map = ExTermDecoder.unpackMap(ByteBuffer.wrap(data)); + return new DataObject(map); + } + catch (Exception ex) + { + log.error("Failed to parse ETF data {}", Arrays.toString(data), ex); + throw new ParsingException(ex); + } + } + /** * Whether the specified key is present. * @@ -650,8 +680,9 @@ public Set keys() /** * Serialize this object as JSON. * - * @return a byte array containing the JSON representation of this object. + * @return byte array containing the JSON representation of this object */ + @Nonnull public byte[] toJson() { try @@ -666,6 +697,18 @@ public byte[] toJson() } } + /** + * Serializes this object as ETF MAP term. + * + * @return byte array containing the encoded ETF term + */ + @Nonnull + public byte[] toETF() + { + ByteBuffer buffer = ExTermEncoder.pack(data); + return Arrays.copyOfRange(buffer.array(), buffer.arrayOffset(), buffer.arrayOffset() + buffer.limit()); + } + @Override public String toString() { diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java new file mode 100644 index 0000000000..72afa851f0 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java @@ -0,0 +1,285 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.utils.data.etf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.zip.InflaterOutputStream; + +import static net.dv8tion.jda.api.utils.data.etf.ExTermTag.*; + +/** + * Decodes an ETF encoded payload to a java object representation. + * + * @see #unpack(ByteBuffer) + * @see #unpackMap(ByteBuffer) + * @see #unpackList(ByteBuffer) + */ +public class ExTermDecoder +{ + /** + * Unpacks the provided term into a java object. + * + *

The mapping is as follows:

+ *
    + *
  • {@code Small Int | Int -> Integer}
  • + *
  • {@code Small BigInt -> Long}
  • + *
  • {@code Float | New Float -> Double}
  • + *
  • {@code Small Atom | Atom -> Boolean | null | String}
  • + *
  • {@code Binary | String -> String}
  • + *
  • {@code List | NIL -> List}
  • + *
  • {@code Map -> Map}
  • + *
+ * + * @param buffer + * The {@link ByteBuffer} containing the encoded term + * + * @throws IllegalArgumentException + * If the buffer does not start with the version byte {@code 131} or contains an unsupported tag + * + * @return The java object + */ + public static Object unpack(ByteBuffer buffer) + { + if (buffer.get() != -125) + throw new IllegalArgumentException("Failed header check"); + + return unpack0(buffer); + } + + /** + * Unpacks the provided term into a java {@link Map}. + * + *

The mapping is as follows:

+ *
    + *
  • {@code Small Int | Int -> Integer}
  • + *
  • {@code Small BigInt -> Long}
  • + *
  • {@code Float | New Float -> Double}
  • + *
  • {@code Small Atom | Atom -> Boolean | null | String}
  • + *
  • {@code Binary | String -> String}
  • + *
  • {@code List | NIL -> List}
  • + *
  • {@code Map -> Map}
  • + *
+ * + * @param buffer + * The {@link ByteBuffer} containing the encoded term + * + * @throws IllegalArgumentException + * If the buffer does not start with a Map term, does not have the right version byte, or the format includes an unsupported tag + * + * @return The parsed {@link Map} instance + */ + @SuppressWarnings("unchecked") + public static Map unpackMap(ByteBuffer buffer) + { + byte tag = buffer.get(1); + if (tag != MAP) + throw new IllegalArgumentException("Cannot unpack map from tag " + tag); + return (Map) unpack(buffer); + } + + /** + * Unpacks the provided term into a java {@link List}. + * + *

The mapping is as follows:

+ *
    + *
  • {@code Small Int | Int -> Integer}
  • + *
  • {@code Small BigInt -> Long}
  • + *
  • {@code Float | New Float -> Double}
  • + *
  • {@code Small Atom | Atom -> Boolean | null | String}
  • + *
  • {@code Binary | String -> String}
  • + *
  • {@code List | NIL -> List}
  • + *
  • {@code Map -> Map}
  • + *
+ * + * @param buffer + * The {@link ByteBuffer} containing the encoded term + * + * @throws IllegalArgumentException + * If the buffer does not start with a List or NIL term, does not have the right version byte, or the format includes an unsupported tag + * + * @return The parsed {@link List} instance + */ + @SuppressWarnings("unchecked") + public static List unpackList(ByteBuffer buffer) + { + byte tag = buffer.get(1); + if (tag != LIST) + throw new IllegalArgumentException("Cannot unpack list from tag " + tag); + + return (List) unpack(buffer); + } + + private static Object unpack0(ByteBuffer buffer) + { + int tag = buffer.get(); + switch (tag) { + case COMPRESSED: return unpackCompressed(buffer); + case SMALL_INT: return unpackSmallInt(buffer); + case SMALL_BIGINT: return unpackSmallBigint(buffer); + case INT: return unpackInt(buffer); + + case FLOAT: return unpackOldFloat(buffer); + case NEW_FLOAT: return unpackFloat(buffer); + + case SMALL_ATOM_UTF8: return unpackSmallAtom(buffer, StandardCharsets.UTF_8); + case SMALL_ATOM: return unpackSmallAtom(buffer, StandardCharsets.ISO_8859_1); + case ATOM_UTF8: return unpackAtom(buffer, StandardCharsets.UTF_8); + case ATOM: return unpackAtom(buffer, StandardCharsets.ISO_8859_1); + + case MAP: return unpackMap0(buffer); + case LIST: return unpackList0(buffer); + case NIL: return Collections.emptyList(); + + case STRING: return unpackString(buffer); + case BINARY: return unpackBinary(buffer); + default: + throw new IllegalArgumentException("Unknown tag " + tag); + } + } + + private static Object unpackCompressed(ByteBuffer buffer) + { + int size = buffer.getInt(); + ByteArrayOutputStream decompressed = new ByteArrayOutputStream(size); + try (InflaterOutputStream inflater = new InflaterOutputStream(decompressed)) + { + inflater.write(buffer.array(), buffer.position(), buffer.remaining()); + } + catch (IOException e) + { + throw new UncheckedIOException(e); + } + + buffer = ByteBuffer.wrap(decompressed.toByteArray()); + return unpack0(buffer); + } + + private static double unpackOldFloat(ByteBuffer buffer) + { + String bytes = getString(buffer, StandardCharsets.ISO_8859_1, 31); + return Double.parseDouble(bytes); + } + + private static double unpackFloat(ByteBuffer buffer) + { + return buffer.getDouble(); + } + + private static long unpackSmallBigint(ByteBuffer buffer) + { + int arity = Byte.toUnsignedInt(buffer.get()); + int sign = Byte.toUnsignedInt(buffer.get()); + long sum = 0; + long offset = 0; + while (arity-- > 0) + { + sum += Byte.toUnsignedLong(buffer.get()) << offset; + offset += 8; + } + + return sign == 0 ? sum : -sum; + } + + private static int unpackSmallInt(ByteBuffer buffer) + { + return Byte.toUnsignedInt(buffer.get()); + } + + private static int unpackInt(ByteBuffer buffer) + { + return buffer.getInt(); + } + + private static List unpackString(ByteBuffer buffer) + { + int length = Short.toUnsignedInt(buffer.getShort()); + List bytes = new ArrayList<>(length); + while (length-- > 0) + bytes.add(buffer.get()); + return bytes; + } + + private static String unpackBinary(ByteBuffer buffer) + { + int length = buffer.getInt(); + return getString(buffer, StandardCharsets.UTF_8, length); + } + + private static Object unpackSmallAtom(ByteBuffer buffer, Charset charset) + { + int length = Byte.toUnsignedInt(buffer.get()); + return unpackAtom(buffer, charset, length); + } + + private static Object unpackAtom(ByteBuffer buffer, Charset charset) + { + int length = Short.toUnsignedInt(buffer.getShort()); + return unpackAtom(buffer, charset, length); + } + + private static Object unpackAtom(ByteBuffer buffer, Charset charset, int length) + { + String value = getString(buffer, StandardCharsets.ISO_8859_1, length); + switch (value) + { + case "true": return true; + case "false": return false; + case "nil": return null; + default: return value; + } + } + + private static String getString(ByteBuffer buffer, Charset encoding, int length) + { + byte[] array = new byte[length]; + buffer.get(array); + return new String(array, StandardCharsets.UTF_8); + } + + private static List unpackList0(ByteBuffer buffer) + { + int length = buffer.getInt(); + List list = new ArrayList<>(length); + while (length-- > 0) + { + list.add(unpack0(buffer)); + } + Object tail = unpack0(buffer); + if (tail != Collections.emptyList()) + throw new IllegalArgumentException("Unexpected tail " + tail); + return list; + } + + private static Map unpackMap0(ByteBuffer buffer) + { + Map map = new HashMap<>(); + int arity = buffer.getInt(); + while (arity-- > 0) + { + String key = (String) unpack0(buffer); + Object value = unpack0(buffer); + map.put(key, value); + } + return map; + } +} diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java new file mode 100644 index 0000000000..6058a303a8 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java @@ -0,0 +1,219 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.utils.data.etf; + +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.Map; + +import static net.dv8tion.jda.api.utils.data.etf.ExTermTag.*; + +/** + * Encodes an object into a binary ETF representation. + * + * @see #pack(Object) + */ +public class ExTermEncoder +{ + /** + * Encodes the provided object into an ETF buffer. + * + *

The mapping is as follows:

+ *
    + *
  • {@code String -> Binary}
  • + *
  • {@code Map -> Map}
  • + *
  • {@code Collection -> List | NIL}
  • + *
  • {@code Byte -> Small Int}
  • + *
  • {@code Integer, Short -> Int | Small Int}
  • + *
  • {@code Long -> Small BigInt | Int | Small Int}
  • + *
  • {@code Float, Double -> New Float}
  • + *
  • {@code Boolean -> Atom(Boolean)}
  • + *
  • {@code null -> Atom("nil")}
  • + *
+ * + * @param data + * The object to encode + * + * @throws UnsupportedOperationException + * If there is no type mapping for the provided object + * + * @return {@link ByteBuffer} with the encoded ETF term + */ + public static ByteBuffer pack(Object data) + { + ByteBuffer buffer = ByteBuffer.allocate(1024); + buffer.put((byte) 131); + + ByteBuffer packed = pack(buffer, data); + // This cast prevents issues with backwards compatibility in the ABI (java 11 made breaking changes) + ((Buffer) packed).flip(); + return packed; + } + + @SuppressWarnings("unchecked") + private static ByteBuffer pack(ByteBuffer buffer, Object value) + { + if (value instanceof String) + return packBinary(buffer, (String) value); + if (value instanceof Map) + return packMap(buffer, (Map) value); + if (value instanceof Collection) + return packList(buffer, (Collection) value); + if (value instanceof Byte) + return packSmallInt(buffer, (byte) value); + if (value instanceof Integer || value instanceof Short) + return packInt(buffer, (int) value); + if (value instanceof Long) + return packLong(buffer, (long) value); + if (value instanceof Float || value instanceof Double) + return packFloat(buffer, (double) value); + if (value instanceof Boolean) + return packAtom(buffer, String.valueOf(value)); + if (value == null) + return packAtom(buffer, "nil"); + + throw new UnsupportedOperationException("Cannot pack value of type " + value.getClass().getName()); + } + + private static ByteBuffer realloc(ByteBuffer buffer, int length) + { + if (buffer.remaining() >= length) + return buffer; + + ByteBuffer allocated = ByteBuffer.allocate((buffer.position() + length) << 1); + // This cast prevents issues with backwards compatibility in the ABI (java 11 made breaking changes) + ((Buffer) buffer).flip(); + allocated.put(buffer); + return allocated; + } + + private static ByteBuffer packMap(ByteBuffer buffer, Map data) + { + buffer = realloc(buffer, data.size() + 5); + buffer.put(MAP); + buffer.putInt(data.size()); + + for (Map.Entry entry : data.entrySet()) + { + buffer = packBinary(buffer, entry.getKey()); + buffer = pack(buffer, entry.getValue()); + } + + return buffer; + } + + private static ByteBuffer packList(ByteBuffer buffer, Collection data) + { + if (data.isEmpty()) + { + // NIL is for empty lists + buffer = realloc(buffer, 1); + buffer.put(NIL); + return buffer; + } + + buffer = realloc(buffer, data.size() + 5); + buffer.put(LIST); + buffer.putInt(data.size()); + for (Object element : data) + buffer = pack(buffer, element); + buffer.put(NIL); + return buffer; + } + + private static ByteBuffer packBinary(ByteBuffer buffer, String value) + { + byte[] encoded = value.getBytes(StandardCharsets.UTF_8); + buffer = realloc(buffer, encoded.length + 5); + buffer.put(BINARY); + buffer.putInt(value.length()); + buffer.put(encoded); + return buffer; + } + + private static ByteBuffer packSmallInt(ByteBuffer buffer, byte value) + { + buffer = realloc(buffer, 2); + buffer.put(SMALL_INT); + buffer.put(value); + return buffer; + } + + private static ByteBuffer packInt(ByteBuffer buffer, int value) + { + if (countBytes(value) <= 1 && value >= 0) + return packSmallInt(buffer, (byte) value); + buffer = realloc(buffer, 5); + buffer.put(INT); + buffer.putInt(value); + return buffer; + } + + private static ByteBuffer packLong(ByteBuffer buffer, long value) + { + byte bytes = countBytes(value); + if (bytes <= 1) // Use optimized small int encoding + return packSmallInt(buffer, (byte) value); + if (bytes <= 4 && value >= 0) + { + // Use int to encode it + buffer = realloc(buffer, 5); + buffer.put(INT); + buffer.putInt((int) value); + return buffer; + } + + buffer = realloc(buffer, 3 + bytes); + buffer.put(SMALL_BIGINT); + buffer.put(bytes); + // We only use "unsigned" value so the sign is always positive + buffer.put((byte) 0); + while (value > 0) + { + buffer.put((byte) value); + value >>>= 8; + } + + return buffer; + } + + private static ByteBuffer packFloat(ByteBuffer buffer, double value) + { + buffer = realloc(buffer, 9); + buffer.put(NEW_FLOAT); + buffer.putDouble(value); + return buffer; + } + + private static ByteBuffer packAtom(ByteBuffer buffer, String value) + { + byte[] array = value.getBytes(StandardCharsets.ISO_8859_1); + buffer = realloc(buffer, array.length + 3); + buffer.put(ATOM); + buffer.putShort((short) array.length); + buffer.put(array); + return buffer; + } + + private static byte countBytes(long value) + { + int leadingZeros = Long.numberOfLeadingZeros(value); + return (byte) Math.ceil((64 - leadingZeros) / 8.); + } +} diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java new file mode 100644 index 0000000000..8bb9268522 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.utils.data.etf; + +/** + * Tags used for encoding and decoding for external terms. + *
This list in incomplete as not all tags are used by this library. + */ +public class ExTermTag +{ + // 8 IEEE float + public static final byte NEW_FLOAT = 70; + // 4 Uncompressed Size | N ZLIB Compressed Data + public static final byte COMPRESSED = 80; + // 1 byte unsigned int value + public static final byte SMALL_INT = 97; + // 4 byte signed int value + public static final byte INT = 98; + // 31 bytes string of float value sprintf("%.20e") + public static final byte FLOAT = 99; // deprecated + // 2 byte length | N bytes latin-1 string + public static final byte ATOM = 100; // deprecated + // 0 bytes empty list + public static final byte NIL = 106; + // 2 byte length | N bytes + public static final byte STRING = 107; + // 4 byte length | N tags | 1 byte NIL tag + public static final byte LIST = 108; + // 4 byte length | N bytes UTF-8 string + public static final byte BINARY = 109; + // 1 byte length | 1 byte sign | N bytes unsigned SE int + public static final byte SMALL_BIGINT = 110; + // 1 byte length | N bytes latin-1 string + public static final byte SMALL_ATOM = 115; // deprecated + // 4 byte length | N pairs of KEY,VALUE terms + public static final byte MAP = 116; + // 2 byte length | N bytes of UTF-8 string + public static final byte ATOM_UTF8 = 118; + // 1 byte length | N bytes of UTF-8 string + public static final byte SMALL_ATOM_UTF8 = 119; +} diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java new file mode 100644 index 0000000000..2bfd391839 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java @@ -0,0 +1,22 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Utility classes to decode and encode Erlang External Term Format (ETF) + * + * @see Erlang -- External Term Format + */ +package net.dv8tion.jda.api.utils.data.etf; diff --git a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java index 1c7711c29c..4dec48ce42 100644 --- a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java @@ -20,6 +20,7 @@ import gnu.trove.map.TLongObjectMap; import gnu.trove.set.TLongSet; import net.dv8tion.jda.api.AccountType; +import net.dv8tion.jda.api.GatewayEncoding; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.audio.factory.DefaultSendFactory; @@ -243,15 +244,15 @@ public VoiceDispatchInterceptor getVoiceInterceptor() public int login() throws LoginException { - return login(null, null, Compression.ZLIB, true, GatewayIntent.ALL_INTENTS); + return login(null, null, Compression.ZLIB, true, GatewayIntent.ALL_INTENTS, GatewayEncoding.JSON); } - public int login(ShardInfo shardInfo, Compression compression, boolean validateToken, int intents) throws LoginException + public int login(ShardInfo shardInfo, Compression compression, boolean validateToken, int intents, GatewayEncoding encoding) throws LoginException { - return login(null, shardInfo, compression, validateToken, intents); + return login(null, shardInfo, compression, validateToken, intents, encoding); } - public int login(String gatewayUrl, ShardInfo shardInfo, Compression compression, boolean validateToken, int intents) throws LoginException + public int login(String gatewayUrl, ShardInfo shardInfo, Compression compression, boolean validateToken, int intents, GatewayEncoding encoding) throws LoginException { this.shardInfo = shardInfo; threadConfig.init(this::getIdentifierString); @@ -285,7 +286,7 @@ public int login(String gatewayUrl, ShardInfo shardInfo, Compression compression LOG.info("Login Successful!"); } - client = new WebSocketClient(this, compression, intents); + client = new WebSocketClient(this, compression, intents, encoding); // remove our MDC metadata when we exit our code if (previousContext != null) previousContext.forEach(MDC::put); diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java index 69e9ea674e..c975c03544 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java @@ -18,10 +18,12 @@ import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.events.message.MessageBulkDeleteEvent; +import net.dv8tion.jda.api.utils.data.DataArray; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; -import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; public class MessageBulkDeleteHandler extends SocketHandler { @@ -64,16 +66,14 @@ protected Long handleInternally(DataObject content) } if (getJDA().getGuildSetupController().isLocked(channel.getGuild().getIdLong())) - { return channel.getGuild().getIdLong(); - } - LinkedList msgIds = new LinkedList<>(); - content.getArray("ids").forEach(id -> msgIds.add((String) id)); + DataArray array = content.getArray("ids"); + List messages = array.stream(DataArray::getString).collect(Collectors.toList()); getJDA().handleEvent( - new MessageBulkDeleteEvent( - getJDA(), responseNumber, - channel, msgIds)); + new MessageBulkDeleteEvent( + getJDA(), responseNumber, + channel, messages)); } return null; } diff --git a/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java index 0764e51de0..2ca0e164d9 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java @@ -207,7 +207,7 @@ protected void update(DataObject data) return; api.getClient().send(DataObject.empty() .put("d", data) - .put("op", WebSocketCode.PRESENCE).toString()); + .put("op", WebSocketCode.PRESENCE)); } } diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index 8b572a89ed..3c9268dd09 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -19,10 +19,7 @@ import com.neovisionaries.ws.client.*; import gnu.trove.iterator.TLongObjectIterator; import gnu.trove.map.TLongObjectMap; -import net.dv8tion.jda.api.AccountType; -import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.JDAInfo; -import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.*; import net.dv8tion.jda.api.audio.hooks.ConnectionListener; import net.dv8tion.jda.api.audio.hooks.ConnectionStatus; import net.dv8tion.jda.api.entities.Guild; @@ -86,6 +83,7 @@ public class WebSocketClient extends WebSocketAdapter implements WebSocketListen protected final Compression compression; protected final int gatewayIntents; protected final MemberChunkManager chunkManager; + protected final GatewayEncoding encoding; public WebSocket socket; protected String sessionId = null; @@ -106,7 +104,7 @@ public class WebSocketClient extends WebSocketAdapter implements WebSocketListen protected final TLongObjectMap queuedAudioConnections = MiscUtil.newLongMap(); protected final Queue chunkSyncQueue = new ConcurrentLinkedQueue<>(); - protected final Queue ratelimitQueue = new ConcurrentLinkedQueue<>(); + protected final Queue ratelimitQueue = new ConcurrentLinkedQueue<>(); protected volatile long ratelimitResetTime; protected final AtomicInteger messagesSent = new AtomicInteger(0); @@ -123,7 +121,7 @@ public class WebSocketClient extends WebSocketAdapter implements WebSocketListen protected volatile ConnectNode connectNode; - public WebSocketClient(JDAImpl api, Compression compression, int gatewayIntents) + public WebSocketClient(JDAImpl api, Compression compression, int gatewayIntents, GatewayEncoding encoding) { this.api = api; this.executor = api.getGatewayPool(); @@ -131,6 +129,7 @@ public WebSocketClient(JDAImpl api, Compression compression, int gatewayIntents) this.compression = compression; this.gatewayIntents = gatewayIntents; this.chunkManager = new MemberChunkManager(this); + this.encoding = encoding; this.shouldReconnect = api.isAutoReconnect(); this.connectNode = new StartingNode(); setupHandlers(); @@ -225,7 +224,7 @@ public void handle(List events) events.forEach(this::onDispatch); } - public void send(String message) + public void send(DataObject message) { locked("Interrupted while trying to add request to queue", () -> ratelimitQueue.add(message)); } @@ -241,7 +240,7 @@ public void sendChunkRequest(DataObject request) locked("Interrupted while trying to add chunk request", () -> chunkSyncQueue.add(request)); } - protected boolean send(String message, boolean skipQueue) + protected boolean send(DataObject message, boolean skipQueue) { if (!connected) return false; @@ -259,7 +258,10 @@ protected boolean send(String message, boolean skipQueue) if (this.messagesSent.get() <= 115 || (skipQueue && this.messagesSent.get() <= 119)) //technically we could go to 120, but we aren't going to chance it { LOG.trace("<- {}", message); - socket.sendText(message); + if (encoding == GatewayEncoding.ETF) + socket.sendBinary(message.toETF()); + else + socket.sendText(message.toString()); this.messagesSent.getAndIncrement(); return true; } @@ -337,7 +339,9 @@ protected synchronized void connect() throw new RejectedExecutionException("JDA is shutdown!"); initiating = true; - String url = api.getGatewayUrl() + "?encoding=json&v=" + JDAInfo.DISCORD_GATEWAY_VERSION; + String url = api.getGatewayUrl() + + "?encoding=" + encoding.name().toLowerCase() + + "&v=" + JDAInfo.DISCORD_GATEWAY_VERSION; if (compression != Compression.NONE) { url += "&compress=" + compression.getKey(); @@ -666,11 +670,11 @@ protected void setupKeepAlive(int timeout) protected void sendKeepAlive() { - String keepAlivePacket = + DataObject keepAlivePacket = DataObject.empty() .put("op", WebSocketCode.HEARTBEAT) .put("d", api.getResponseTotal() - ).toString(); + ); if (missedHeartbeats >= 2) { @@ -718,7 +722,7 @@ protected void sendIdentify() .add(shardInfo.getShardId()) .add(shardInfo.getShardTotal())); } - send(identify.toString(), true); + send(identify, true); handleIdentifyRateLimit = true; identifyTime = System.currentTimeMillis(); sentAuthInfo = true; @@ -734,7 +738,7 @@ protected void sendResume() .put("session_id", sessionId) .put("token", getToken()) .put("seq", api.getResponseTotal())); - send(resume.toString(), true); + send(resume, true); //sentAuthInfo = true; set on RESUMED response as this could fail api.setStatus(JDA.Status.AWAITING_LOGIN_CONFIRMATION); } @@ -982,26 +986,30 @@ public void onTextMessage(WebSocket websocket, byte[] data) @Override public void onBinaryMessage(WebSocket websocket, byte[] binary) throws DataFormatException { - DataObject json; + DataObject message; // Only acquire lock for decompression and unlock for event handling synchronized (readLock) { - json = handleBinary(binary); + message = handleBinary(binary); } - if (json != null) - handleEvent(json); + if (message != null) + handleEvent(message); } protected DataObject handleBinary(byte[] binary) throws DataFormatException { if (decompressor == null) + { + if (encoding == GatewayEncoding.ETF) + return DataObject.fromETF(binary); throw new IllegalStateException("Cannot decompress binary message due to unknown compression algorithm: " + compression); + } // Scoping allows us to print the json that possibly failed parsing - byte[] jsonData; + byte[] data; try { - jsonData = decompressor.decompress(binary); - if (jsonData == null) + data = decompressor.decompress(binary); + if (data == null) return null; } catch (DataFormatException e) @@ -1012,14 +1020,17 @@ protected DataObject handleBinary(byte[] binary) throws DataFormatException try { - return DataObject.fromJson(jsonData); + if (encoding == GatewayEncoding.ETF) + return DataObject.fromETF(data); + else + return DataObject.fromJson(data); } catch (ParsingException e) { String jsonString = "malformed"; try { - jsonString = new String(jsonData, StandardCharsets.UTF_8); + jsonString = new String(data, StandardCharsets.UTF_8); } catch (Exception ignored) {} // Print the string that could not be parsed and re-throw the exception diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java index 29cbcac42e..954d8b2952 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java @@ -43,7 +43,7 @@ class WebSocketSendingThread implements Runnable private final JDAImpl api; private final ReentrantLock queueLock; private final Queue chunkQueue; - private final Queue ratelimitQueue; + private final Queue ratelimitQueue; private final TLongObjectMap queuedAudioConnections; private final ScheduledExecutorService executor; private Future handle; @@ -185,7 +185,6 @@ private void handleChunkSync(DataObject chunkOrSyncRequest) DataObject.empty() .put("op", WebSocketCode.MEMBER_CHUNK_REQUEST) .put("d", chunkOrSyncRequest) - .toString() ); if (success) @@ -218,7 +217,7 @@ private void handleAudioRequest(ConnectionRequest audioRequest) packet = newVoiceOpen(audioManager, channelId, guild.getIdLong()); } LOG.debug("Sending voice request {}", packet); - if (send(packet.toString())) + if (send(packet)) { //If we didn't get RateLimited, Next request attempt will be 2 seconds from now // we remove it in VoiceStateUpdateHandler once we hear that it has updated our status @@ -234,7 +233,7 @@ private void handleAudioRequest(ConnectionRequest audioRequest) private void handleNormalRequest() { - String message = ratelimitQueue.peek(); + DataObject message = ratelimitQueue.peek(); if (message != null) { LOG.debug("Sending normal message {}", message); @@ -244,7 +243,7 @@ private void handleNormalRequest() } //returns true if send was successful - private boolean send(String request) + private boolean send(DataObject request) { needRateLimit = !client.send(request, false); attemptedToSend = true; diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java index 5d3b1a8c98..de944d44ba 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.internal.utils.config.sharding; +import net.dv8tion.jda.api.GatewayEncoding; import net.dv8tion.jda.api.utils.Compression; import net.dv8tion.jda.api.utils.cache.CacheFlag; import net.dv8tion.jda.internal.utils.config.MetaConfig; @@ -29,19 +30,22 @@ public class ShardingMetaConfig extends MetaConfig { - private static final ShardingMetaConfig defaultConfig = new ShardingMetaConfig(2048, null, null, ConfigFlag.getDefault(), Compression.ZLIB); + private static final ShardingMetaConfig defaultConfig = new ShardingMetaConfig(2048, null, null, ConfigFlag.getDefault(), Compression.ZLIB, GatewayEncoding.JSON); private final Compression compression; + private final GatewayEncoding encoding; private final IntFunction> contextProvider; public ShardingMetaConfig( int maxBufferSize, @Nullable IntFunction> contextProvider, - @Nullable EnumSet cacheFlags, EnumSet flags, Compression compression) + @Nullable EnumSet cacheFlags, EnumSet flags, + Compression compression, GatewayEncoding encoding) { super(maxBufferSize, null, cacheFlags, flags); this.compression = compression; this.contextProvider = contextProvider; + this.encoding = encoding; } @Nullable @@ -55,6 +59,11 @@ public Compression getCompression() return compression; } + public GatewayEncoding getEncoding() + { + return encoding; + } + @Nullable public IntFunction> getContextProvider() { From 2e020fbaf22cf44707baf1c875330cf28bd13af0 Mon Sep 17 00:00:00 2001 From: Artuto Date: Sun, 5 Jul 2020 08:56:07 -0500 Subject: [PATCH 005/121] Make GuildMessageReactionRemoveEmoteEvent extend GenericGuildMessageEvent (#1323) --- .../react/GuildMessageReactionRemoveEmoteEvent.java | 13 ++++--------- .../handle/MessageReactionClearEmoteHandler.java | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java index e06935b3bd..c47908b1ae 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java @@ -17,10 +17,9 @@ package net.dv8tion.jda.api.events.message.guild.react; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.MessageReaction; import net.dv8tion.jda.api.entities.TextChannel; -import net.dv8tion.jda.api.events.guild.GenericGuildEvent; +import net.dv8tion.jda.api.events.message.guild.GenericGuildMessageEvent; import javax.annotation.Nonnull; @@ -31,19 +30,15 @@ * * @since 4.2.0 */ -public class GuildMessageReactionRemoveEmoteEvent extends GenericGuildEvent +public class GuildMessageReactionRemoveEmoteEvent extends GenericGuildMessageEvent { - private final TextChannel channel; private final MessageReaction reaction; - private final long messageId; - public GuildMessageReactionRemoveEmoteEvent(@Nonnull JDA api, long responseNumber, @Nonnull Guild guild, @Nonnull TextChannel channel, @Nonnull MessageReaction reaction, long messageId) + public GuildMessageReactionRemoveEmoteEvent(@Nonnull JDA api, long responseNumber, @Nonnull TextChannel channel, @Nonnull MessageReaction reaction, long messageId) { - super(api, responseNumber, guild); + super(api, responseNumber, messageId, channel); - this.channel = channel; this.reaction = reaction; - this.messageId = messageId; } /** diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java index fe08cbe8dd..e80ef4f434 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java @@ -77,7 +77,7 @@ protected Long handleInternally(DataObject content) } MessageReaction reaction = new MessageReaction(channel, reactionEmote, messageId, false, 0); - getJDA().handleEvent(new GuildMessageReactionRemoveEmoteEvent(getJDA(), responseNumber, guild, channel, reaction, messageId)); + getJDA().handleEvent(new GuildMessageReactionRemoveEmoteEvent(getJDA(), responseNumber, channel, reaction, messageId)); getJDA().handleEvent(new MessageReactionRemoveEmoteEvent(getJDA(), responseNumber, messageId, channel, reaction)); return null; } From 8a4365c4ca05f72c63c638550c02380688f71055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 7 Jul 2020 14:04:06 +0200 Subject: [PATCH 006/121] Fix issues with duplicate overrides in ChannelAction --- .../requests/restaction/ChannelActionImpl.java | 10 +++++----- .../requests/restaction/PermOverrideData.java | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java index 33c1ba54b5..a448d59d84 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java @@ -16,6 +16,8 @@ package net.dv8tion.jda.internal.requests.restaction; +import gnu.trove.map.TLongObjectMap; +import gnu.trove.map.hash.TLongObjectHashMap; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.requests.Request; @@ -31,14 +33,12 @@ import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; import java.util.Collection; -import java.util.HashSet; -import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.function.BooleanSupplier; public class ChannelActionImpl extends AuditableRestActionImpl implements ChannelAction { - protected final Set overrides = new HashSet<>(); + protected final TLongObjectMap overrides = new TLongObjectHashMap<>(); protected final Guild guild; protected final ChannelType type; protected final Class clazz; @@ -191,7 +191,7 @@ private ChannelActionImpl addOverride(long targetId, int type, long allow, lo Checks.check(allow <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set"); Checks.check(deny <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set"); - overrides.add(new PermOverrideData(type, targetId, allow, deny)); + overrides.put(targetId, new PermOverrideData(type, targetId, allow, deny)); return this; } @@ -235,7 +235,7 @@ protected RequestBody finalizeData() DataObject object = DataObject.empty(); object.put("name", name); object.put("type", type.getId()); - object.put("permission_overwrites", DataArray.fromCollection(overrides)); + object.put("permission_overwrites", DataArray.fromCollection(overrides.valueCollection())); if (position != null) object.put("position", position); switch (type) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java index 9f4fb9e95e..19586f1634 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java @@ -66,4 +66,22 @@ public DataObject toData() o.put("deny", deny); return o; } + + @Override + public int hashCode() + { + return Long.hashCode(id); + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + if (!(obj instanceof PermOverrideData)) + return false; + + PermOverrideData other = (PermOverrideData) obj; + return other.id == this.id; + } } From 961e8b970dc7eb1f96680a209ae13aa9a1142d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 8 Jul 2020 20:21:41 +0200 Subject: [PATCH 007/121] Add check for voice connect permission (#1273) Introduced new MissingAccessException This exception extends InsufficientPermissionException --- .../net/dv8tion/jda/api/MessageBuilder.java | 5 ++- .../jda/api/entities/GuildChannel.java | 4 -- .../jda/api/entities/IPermissionHolder.java | 33 ++++++++++++++ .../jda/api/entities/MessageHistory.java | 11 ++++- .../InsufficientPermissionException.java | 6 +++ .../exceptions/MissingAccessException.java | 43 +++++++++++++++++++ .../entities/AbstractChannelImpl.java | 18 ++++++-- .../entities/PermissionOverrideImpl.java | 24 ++++++++--- .../internal/entities/ReceivedMessage.java | 3 ++ .../internal/entities/TextChannelImpl.java | 3 +- .../internal/managers/ChannelManagerImpl.java | 10 ++++- .../managers/PermOverrideManagerImpl.java | 11 ++++- .../internal/managers/WebhookManagerImpl.java | 10 ++++- .../restaction/MessageActionImpl.java | 11 +++-- .../PermissionOverrideActionImpl.java | 9 +++- .../MessagePaginationActionImpl.java | 11 ++--- .../jda/internal/utils/PermissionUtil.java | 23 +++------- 17 files changed, 182 insertions(+), 53 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java diff --git a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java index c33baea3b5..d6e6c53e92 100644 --- a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java @@ -20,6 +20,7 @@ import net.dv8tion.jda.annotations.ReplaceWith; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.restaction.MessageAction; import net.dv8tion.jda.internal.entities.DataMessage; import net.dv8tion.jda.internal.requests.Route; @@ -1134,8 +1135,8 @@ public MessageAction sendTo(@Nonnull MessageChannel channel) case TEXT: final TextChannel text = (TextChannel) channel; final Member self = text.getGuild().getSelfMember(); - if (!self.hasPermission(text, Permission.MESSAGE_READ)) - throw new InsufficientPermissionException(text, Permission.MESSAGE_READ); + if (!self.hasAccess(text)) + throw new MissingAccessException(text, Permission.VIEW_CHANNEL); if (!self.hasPermission(text, Permission.MESSAGE_WRITE)) throw new InsufficientPermissionException(text, Permission.MESSAGE_WRITE); break; diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java index 40760aa68d..6d2a189dd4 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java @@ -16,8 +16,6 @@ package net.dv8tion.jda.api.entities; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; import net.dv8tion.jda.api.managers.ChannelManager; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; @@ -368,8 +366,6 @@ default ChannelAction createCopy() @CheckReturnValue default PermissionOverrideAction upsertPermissionOverride(@Nonnull IPermissionHolder permissionHolder) { - if (!getGuild().getSelfMember().hasPermission(this, Permission.MANAGE_PERMISSIONS)) - throw new InsufficientPermissionException(this, Permission.MANAGE_PERMISSIONS); PermissionOverride override = getPermissionOverride(permissionHolder); if (override != null) return override.getManager(); diff --git a/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java b/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java index 56507dd0c7..c7838194a6 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java +++ b/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java @@ -17,6 +17,7 @@ package net.dv8tion.jda.api.entities; import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.internal.utils.Checks; import javax.annotation.Nonnull; import java.util.Collection; @@ -101,6 +102,9 @@ public interface IPermissionHolder extends ISnowflake * @param permissions * Permissions to check for. * + * @throws IllegalArgumentException + * If null is provided + * * @return True, if all of the specified Permissions are granted to this PermissionHolder. */ boolean hasPermission(@Nonnull Permission... permissions); @@ -112,6 +116,9 @@ public interface IPermissionHolder extends ISnowflake * @param permissions * Permissions to check for. * + * @throws IllegalArgumentException + * If null is provided + * * @return True, if all of the specified Permissions are granted to this PermissionHolder. * * @see java.util.EnumSet EnumSet @@ -126,6 +133,9 @@ public interface IPermissionHolder extends ISnowflake * @param permissions * Permissions to check for. * + * @throws IllegalArgumentException + * If null is provided + * * @return True, if all of the specified Permissions are granted to this PermissionHolder in the provided GuildChannel. * * @see java.util.EnumSet EnumSet @@ -141,7 +151,30 @@ public interface IPermissionHolder extends ISnowflake * @param permissions * Permissions to check for. * + * @throws IllegalArgumentException + * If null is provided + * * @return True, if all of the specified Permissions are granted to this PermissionHolder in the provided GuildChannel. */ boolean hasPermission(@Nonnull GuildChannel channel, @Nonnull Collection permissions); + + /** + * Checks whether or not this PermissionHolder has {@link Permission#VIEW_CHANNEL VIEW_CHANNEL} + * and {@link Permission#VOICE_CONNECT VOICE_CONNECT} permissions in the {@link GuildChannel}. + * + * @param channel + * The channel to check access for + * + * @throws IllegalArgumentException + * If null is provided + * + * @return True, if the PermissionHolder has access + */ + default boolean hasAccess(@Nonnull GuildChannel channel) + { + Checks.notNull(channel, "Channel"); + return channel.getType() == ChannelType.VOICE + ? hasPermission(channel, Permission.VOICE_CONNECT, Permission.VIEW_CHANNEL) + : hasPermission(channel, Permission.VIEW_CHANNEL); + } } diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java b/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java index 7d5004d452..fd6ea4f536 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.Request; import net.dv8tion.jda.api.requests.Response; import net.dv8tion.jda.api.requests.RestAction; @@ -70,7 +71,10 @@ public MessageHistory(@Nonnull MessageChannel channel) if (channel instanceof TextChannel) { TextChannel tc = (TextChannel) channel; - if (!tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_HISTORY)) + Member selfMember = tc.getGuild().getSelfMember(); + if (!selfMember.hasAccess(tc)) + throw new MissingAccessException(tc, Permission.VIEW_CHANNEL); + if (!selfMember.hasPermission(tc, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(tc, Permission.MESSAGE_HISTORY); } } @@ -510,7 +514,10 @@ private static void checkArguments(MessageChannel channel, String messageId) if (channel.getType() == ChannelType.TEXT) { TextChannel t = (TextChannel) channel; - if (!t.getGuild().getSelfMember().hasPermission(t, Permission.MESSAGE_HISTORY)) + Member selfMember = t.getGuild().getSelfMember(); + if (!selfMember.hasAccess(t)) + throw new MissingAccessException(t, Permission.VIEW_CHANNEL); + if (!selfMember.hasPermission(t, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(t, Permission.MESSAGE_HISTORY); } } diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java b/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java index c5d9f8c0db..86c0d1e377 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java @@ -26,6 +26,12 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +/** + * Indicates that the user is missing a {@link Permission} for some action. + * + * @see net.dv8tion.jda.api.entities.IPermissionHolder#hasPermission(Permission...) IPermissionHolder.hasPermission(Permission...) + * @see net.dv8tion.jda.api.entities.IPermissionHolder#hasPermission(GuildChannel, Permission...) IPermissionHolder.hasPermission(GuildChannel, Permission...) + */ public class InsufficientPermissionException extends PermissionException { private final long guildId; diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java b/src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java new file mode 100644 index 0000000000..ca897e027e --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.exceptions; + +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.GuildChannel; + +import javax.annotation.Nonnull; + +/** + * Indicates that the user is missing the {@link Permission#VIEW_CHANNEL VIEW_CHANNEL} + * or {@link Permission#VOICE_CONNECT VOICE_CONNECT} permission. + * + * @see net.dv8tion.jda.api.entities.IPermissionHolder#hasAccess(GuildChannel) + * + * @since 4.2.1 + */ +public class MissingAccessException extends InsufficientPermissionException +{ + public MissingAccessException(@Nonnull GuildChannel channel, @Nonnull Permission permission) + { + super(channel, permission); + } + + public MissingAccessException(@Nonnull GuildChannel channel, @Nonnull Permission permission, @Nonnull String reason) + { + super(channel, permission, reason); + } +} diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java index c3acfa904f..4e415ec716 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java @@ -21,6 +21,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.managers.ChannelManager; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; @@ -209,8 +210,7 @@ public PermissionOverrideAction putPermissionOverride(@Nonnull IPermissionHolder @Override public InviteAction createInvite() { - if (!this.getGuild().getSelfMember().hasPermission(this, Permission.CREATE_INSTANT_INVITE)) - throw new InsufficientPermissionException(this, Permission.CREATE_INSTANT_INVITE); + checkPermission(Permission.CREATE_INSTANT_INVITE); return new InviteActionImpl(this.getJDA(), this.getId()); } @@ -219,8 +219,7 @@ public InviteAction createInvite() @Override public RestAction> retrieveInvites() { - if (!this.getGuild().getSelfMember().hasPermission(this, Permission.MANAGE_CHANNEL)) - throw new InsufficientPermissionException(this, Permission.MANAGE_CHANNEL); + checkPermission(Permission.MANAGE_CHANNEL); final Route.CompiledRoute route = Route.Invites.GET_CHANNEL_INVITES.compile(getId()); @@ -285,9 +284,20 @@ public M setPosition(int rawPosition) return (M) this; } + protected void checkAccess() + { + Member selfMember = getGuild().getSelfMember(); + if (!selfMember.hasPermission(this, Permission.VIEW_CHANNEL)) + throw new MissingAccessException(this, Permission.VIEW_CHANNEL); + // Else we can only be missing VOICE_CONNECT! + if (!selfMember.hasAccess(this)) + throw new MissingAccessException(this, Permission.VOICE_CONNECT); + } + protected void checkPermission(Permission permission) {checkPermission(permission, null);} protected void checkPermission(Permission permission, String message) { + checkAccess(); if (!getGuild().getSelfMember().hasPermission(this, permission)) { if (message != null) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java index eff14d772b..efdffb42e1 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java @@ -20,6 +20,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction; import net.dv8tion.jda.api.utils.MiscUtil; @@ -151,8 +152,14 @@ public boolean isRoleOverride() @Override public PermissionOverrideAction getManager() { - if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) - throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS); + Member selfMember = getGuild().getSelfMember(); + GuildChannel channel = getChannel(); + if (!selfMember.hasPermission(channel, Permission.VIEW_CHANNEL)) + throw new MissingAccessException(channel, Permission.VIEW_CHANNEL); + if (!selfMember.hasAccess(channel)) + throw new MissingAccessException(channel, Permission.VOICE_CONNECT); + if (!selfMember.hasPermission(channel, Permission.MANAGE_PERMISSIONS)) + throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS); PermissionOverrideAction mng = manager; if (mng == null) { @@ -170,10 +177,17 @@ public PermissionOverrideAction getManager() @Override public AuditableRestAction delete() { - if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) - throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS); - Route.CompiledRoute route = Route.Channels.DELETE_PERM_OVERRIDE.compile(channel.getId(), getId()); + Member selfMember = getGuild().getSelfMember(); + GuildChannel channel = getChannel(); + if (!selfMember.hasPermission(Permission.VIEW_CHANNEL)) + throw new MissingAccessException(channel, Permission.VIEW_CHANNEL); + if (!selfMember.hasAccess(channel)) + throw new MissingAccessException(channel, Permission.VOICE_CONNECT); + if (!selfMember.hasPermission(channel, Permission.MANAGE_PERMISSIONS)) + throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS); + + Route.CompiledRoute route = Route.Channels.DELETE_PERM_OVERRIDE.compile(this.channel.getId(), getId()); return new AuditableRestActionImpl<>(getJDA(), route); } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java index d11759207f..8cca137267 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java @@ -22,6 +22,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.MessageAction; @@ -807,6 +808,8 @@ public AuditableRestAction delete() { if (isFromType(ChannelType.PRIVATE)) throw new IllegalStateException("Cannot delete another User's messages in a PrivateChannel."); + else if (!getGuild().getSelfMember().hasAccess(getTextChannel())) + throw new MissingAccessException(getTextChannel(), Permission.VIEW_CHANNEL); else if (!getGuild().getSelfMember() .hasPermission((TextChannel) getChannel(), Permission.MESSAGE_MANAGE)) throw new InsufficientPermissionException(getTextChannel(), Permission.MESSAGE_MANAGE); diff --git a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java index a254cce77f..d9abb9116b 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java @@ -148,8 +148,7 @@ public AuditableRestAction deleteWebhookById(@Nonnull String id) { Checks.isSnowflake(id, "Webhook ID"); - if (!getGuild().getSelfMember().hasPermission(this, Permission.MANAGE_WEBHOOKS)) - throw new InsufficientPermissionException(this, Permission.MANAGE_WEBHOOKS); + checkPermission(Permission.MANAGE_WEBHOOKS); Route.CompiledRoute route = Route.Webhooks.DELETE_WEBHOOK.compile(id); return new AuditableRestActionImpl<>(getJDA(), route); diff --git a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java index e921f30309..3c364756d9 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java @@ -23,6 +23,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.managers.ChannelManager; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.entities.AbstractChannelImpl; @@ -376,8 +377,13 @@ protected RequestBody finalizeData() protected boolean checkPermissions() { final Member selfMember = getGuild().getSelfMember(); - if (!selfMember.hasPermission(getChannel(), Permission.MANAGE_CHANNEL)) - throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_CHANNEL); + GuildChannel channel = getChannel(); + if (!selfMember.hasPermission(channel, Permission.VIEW_CHANNEL)) + throw new MissingAccessException(channel, Permission.VIEW_CHANNEL); + if (!selfMember.hasAccess(channel)) + throw new MissingAccessException(channel, Permission.VOICE_CONNECT); + if (!selfMember.hasPermission(channel, Permission.MANAGE_CHANNEL)) + throw new InsufficientPermissionException(channel, Permission.MANAGE_CHANNEL); return super.checkPermissions(); } diff --git a/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java index b22bfc208e..2096bde806 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java @@ -20,6 +20,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.managers.PermOverrideManager; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.requests.Route; @@ -189,8 +190,14 @@ protected RequestBody finalizeData() @Override protected boolean checkPermissions() { - if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) - throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS); + Member selfMember = getGuild().getSelfMember(); + GuildChannel channel = getChannel(); + if (!selfMember.hasPermission(channel, Permission.VIEW_CHANNEL)) + throw new MissingAccessException(channel, Permission.VIEW_CHANNEL); + if (!selfMember.hasAccess(channel)) + throw new MissingAccessException(channel, Permission.VOICE_CONNECT); + if (!selfMember.hasPermission(channel, Permission.MANAGE_PERMISSIONS)) + throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS); return super.checkPermissions(); } } diff --git a/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java index e333d915a9..fde4223946 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java @@ -18,9 +18,11 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.Icon; +import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.entities.Webhook; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.managers.WebhookManager; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.requests.Route; @@ -144,8 +146,12 @@ protected RequestBody finalizeData() @Override protected boolean checkPermissions() { - if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_WEBHOOKS)) - throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_WEBHOOKS); + Member selfMember = getGuild().getSelfMember(); + TextChannel channel = getChannel(); + if (!selfMember.hasAccess(channel)) + throw new MissingAccessException(channel, Permission.VIEW_CHANNEL); + if (!selfMember.hasPermission(channel, Permission.MANAGE_WEBHOOKS)) + throw new InsufficientPermissionException(channel, Permission.MANAGE_WEBHOOKS); return super.checkPermissions(); } } diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java index f4ca71896a..a0ac3df566 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java @@ -20,6 +20,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.Request; import net.dv8tion.jda.api.requests.Response; import net.dv8tion.jda.api.requests.restaction.MessageAction; @@ -529,11 +530,13 @@ protected void checkEdit() protected void checkPermission(Permission perm) { + if (!channel.getType().isGuild()) + return; + GuildChannel gc = (GuildChannel) channel; + if (!gc.getGuild().getSelfMember().hasAccess(gc)) + throw new MissingAccessException(gc, Permission.VIEW_CHANNEL); if (!hasPermission(perm)) - { - TextChannel channel = (TextChannel) this.channel; - throw new InsufficientPermissionException(channel, perm); - } + throw new InsufficientPermissionException(gc, perm); } protected boolean hasPermission(Permission perm) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java index 33ab6f8f32..8619141d06 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java @@ -20,6 +20,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.Request; import net.dv8tion.jda.api.requests.Response; import net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction; @@ -79,7 +80,13 @@ public PermissionOverrideActionImpl setOverride(boolean override) protected BooleanSupplier finalizeChecks() { return () -> { - if (!getGuild().getSelfMember().hasPermission(channel, Permission.MANAGE_PERMISSIONS)) + + Member selfMember = getGuild().getSelfMember(); + if (!selfMember.hasPermission(channel, Permission.VIEW_CHANNEL)) + throw new MissingAccessException(channel, Permission.VIEW_CHANNEL); + if (!selfMember.hasAccess(channel)) + throw new MissingAccessException(channel, Permission.VOICE_CONNECT); + if (!selfMember.hasPermission(channel, Permission.MANAGE_PERMISSIONS)) throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS); return true; }; diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java index a1f70fff63..66fe43df0a 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java @@ -17,11 +17,9 @@ package net.dv8tion.jda.internal.requests.restaction.pagination; import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.ChannelType; -import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageChannel; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.exceptions.ParsingException; import net.dv8tion.jda.api.requests.Request; import net.dv8tion.jda.api.requests.Response; @@ -47,7 +45,10 @@ public MessagePaginationActionImpl(MessageChannel channel) if (channel.getType() == ChannelType.TEXT) { TextChannel textChannel = (TextChannel) channel; - if (!textChannel.getGuild().getSelfMember().hasPermission(textChannel, Permission.MESSAGE_HISTORY)) + Member selfMember = textChannel.getGuild().getSelfMember(); + if (!selfMember.hasAccess(textChannel)) + throw new MissingAccessException(textChannel, Permission.VIEW_CHANNEL); + if (!selfMember.hasPermission(textChannel, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(textChannel, Permission.MESSAGE_HISTORY); } diff --git a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java index f09e703eb4..efebec8cae 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java @@ -360,26 +360,13 @@ public static long getEffectivePermission(GuildChannel channel, Member member) getExplicitOverrides(channel, member, allow, deny); permission = apply(permission, allow.get(), deny.get()); final long viewChannel = Permission.VIEW_CHANNEL.getRawValue(); + final long connectChannel = Permission.VOICE_CONNECT.getRawValue(); - //When the permission to view the channel is not applied it is not granted + //When the permission to view the channel or to connect to the channel is not applied it is not granted // This means that we have no access to this channel at all - return isApplied(permission, viewChannel) ? permission : 0; - /* - // currently discord doesn't implicitly grant permissions that the user can grant others - // so instead the user has to explicitly make an override to grant them the permission in order to be granted that permission - // yes this makes no sense but what can i do, the devs don't like changing things apparently... - // I've been told half a year ago this would be changed but nothing happens - // so instead I'll just bend over for them so people get "correct" permission checks... - // - // only time will tell if something happens and I can finally re-implement this section wew - final long managePerms = Permission.MANAGE_PERMISSIONS.getRawValue(); - final long manageChannel = Permission.MANAGE_CHANNEL.getRawValue(); - if ((permission & (managePerms | manageChannel)) != 0) - { - // In channels, MANAGE_CHANNEL and MANAGE_PERMISSIONS grant full text/voice permissions - permission |= Permission.ALL_TEXT_PERMISSIONS | Permission.ALL_VOICE_PERMISSIONS; - } - */ + final boolean hasConnect = channel.getType() != ChannelType.VOICE || isApplied(permission, connectChannel); + final boolean hasView = isApplied(permission, viewChannel); + return hasView && hasConnect ? permission : 0; } /** From f561f3fa612b866c6f322e6f96e39fbe52311822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 9 Jul 2020 16:35:29 +0200 Subject: [PATCH 008/121] Improve handling of I/O exceptions --- .../utils/ConcurrentSessionController.java | 14 +++++++---- .../net/dv8tion/jda/internal/JDAImpl.java | 4 +++- .../jda/internal/requests/Requester.java | 24 ++++++++++++------- .../dv8tion/jda/internal/utils/Helpers.java | 12 ++++++++++ 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java b/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java index 6517f74a44..2a111275c5 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java +++ b/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java @@ -18,8 +18,12 @@ import com.neovisionaries.ws.client.OpeningHandshakeException; import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.exceptions.ErrorResponseException; +import net.dv8tion.jda.internal.utils.Helpers; import javax.annotation.Nonnull; +import java.io.IOException; +import java.net.UnknownHostException; import java.util.NoSuchElementException; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -156,12 +160,14 @@ private void processQueue() throws InterruptedException queue.add(node); throw e; } - catch (IllegalStateException e) + catch (IllegalStateException | ErrorResponseException e) { - Throwable t = e.getCause(); - if (t instanceof OpeningHandshakeException) + if (Helpers.hasCause(e, OpeningHandshakeException.class)) log.error("Failed opening handshake, appending to queue. Message: {}", e.getMessage()); - else if (t != null && !JDA.Status.RECONNECT_QUEUED.name().equals(t.getMessage())) + else if (e instanceof ErrorResponseException && e.getCause() instanceof IOException) { /* This is already logged by the Requester */ } + else if (Helpers.hasCause(e, UnknownHostException.class)) + log.error("DNS resolution failed: {}", e.getMessage()); + else if (e.getCause() != null && !JDA.Status.RECONNECT_QUEUED.name().equals(e.getCause().getMessage())) log.error("Failed to establish connection for a node, appending to queue", e); else log.error("Unexpected exception when running connect node", e); diff --git a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java index 4dec48ce42..ef00e63aca 100644 --- a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java @@ -1023,12 +1023,14 @@ public EventCache getEventCache() public String getGatewayUrl() { + if (gatewayUrl == null) + return gatewayUrl = getGateway(); return gatewayUrl; } public void resetGatewayUrl() { - this.gatewayUrl = getGateway(); + this.gatewayUrl = null; } public ScheduledThreadPoolExecutor getAudioLifeCyclePool() diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java index 6800e42d8c..0e7bb4effd 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java @@ -33,9 +33,11 @@ import org.slf4j.MDC; import javax.net.ssl.SSLPeerUnverifiedException; +import java.io.IOException; import java.io.InterruptedIOException; import java.net.SocketException; import java.net.SocketTimeoutException; +import java.net.UnknownHostException; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Map.Entry; @@ -238,24 +240,28 @@ else if (handleOnRatelimit) return retryAfter; } - catch (SocketTimeoutException e) + catch (InterruptedIOException e) { - if (retryOnTimeout && !retried) - return execute(apiRequest, true, handleOnRatelimit); - LOG.error("Requester timed out while executing a request", e); - apiRequest.handleResponse(new Response(lastResponse, e, rays)); + LOG.warn("Got interrupted while executing request", e); return null; } - catch (InterruptedIOException e) + catch (UnknownHostException e) { - LOG.warn("Got interrupted while executing request", e); + LOG.error("DNS resolution failed: {}", e.getMessage()); + apiRequest.handleResponse(new Response(lastResponse, e, rays)); return null; } - catch (Exception e) + catch (IOException e) { if (retryOnTimeout && !retried && isRetry(e)) return execute(apiRequest, true, handleOnRatelimit); - LOG.error("There was an exception while executing a REST request", e); //This originally only printed on DEBUG in 2.x + LOG.error("There was an I/O error while executing a REST request: {}", e.getMessage()); + apiRequest.handleResponse(new Response(lastResponse, e, rays)); + return null; + } + catch (Exception e) + { + LOG.error("There was an unexpected error while executing a REST request", e); apiRequest.handleResponse(new Response(lastResponse, e, rays)); return null; } diff --git a/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java b/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java index 747cbecbcf..8501175b6a 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java @@ -159,4 +159,16 @@ public static T appendCause(T throwable, Throwable cause) t.initCause(cause); return throwable; } + + public static boolean hasCause(Throwable throwable, Class cause) + { + Throwable cursor = throwable; + while (cursor != null) + { + if (cause.isInstance(cursor)) + return true; + cursor = cursor.getCause(); + } + return false; + } } From 8f3fcd6f945276864e30c8c1c8b2e624f0183e73 Mon Sep 17 00:00:00 2001 From: Andre_601 <11576465+Andre601@users.noreply.github.com> Date: Sat, 11 Jul 2020 20:51:42 +0200 Subject: [PATCH 009/121] Add Emote#isAvailable() method (#1303) --- .../java/net/dv8tion/jda/api/entities/Emote.java | 16 ++++++++++++++++ .../dv8tion/jda/internal/entities/EmoteImpl.java | 13 +++++++++++++ .../jda/internal/entities/EntityBuilder.java | 3 ++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/Emote.java b/src/main/java/net/dv8tion/jda/api/entities/Emote.java index 8a052301d8..46cc2cd582 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Emote.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Emote.java @@ -132,6 +132,22 @@ default boolean hasRoles() */ boolean isManaged(); + /** + * Whether this emote is available. When an emote becomes unavailable, it cannot be used in messages. An emote becomes + * unavailable when the {@link net.dv8tion.jda.api.entities.Guild.BoostTier BoostTier} of the guild drops such that + * the maximum allowed emotes is lower than the total amount of emotes added to the guild. + * + *

If an emote is added to the guild when the boost tier allows for more than 50 normal and 50 animated emotes + * (BoostTier is at least {@link net.dv8tion.jda.api.entities.Guild.BoostTier#TIER_1 TIER_1}) and the emote is at least + * the 51st one added, then the emote becomes unavaiable when the BoostTier drops below a level that allows those emotes + * to be used. + *
Emotes that where added as part of a lower BoostTier (i.e. the 51st emote on BoostTier 2) will remain available, + * as long as the BoostTier stays above the required level. + * + * @return True, if this emote is available + */ + boolean isAvailable(); + /** * The {@link net.dv8tion.jda.api.JDA JDA} instance of this Emote * diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java index a6a116935c..4842c60f89 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java @@ -56,6 +56,7 @@ public class EmoteImpl implements ListedEmote private volatile EmoteManager manager = null; private boolean managed = false; + private boolean available = true; private boolean animated = false; private String name; private User user; @@ -117,6 +118,12 @@ public boolean isManaged() return managed; } + @Override + public boolean isAvailable() + { + return available; + } + @Override public boolean isFake() { @@ -209,6 +216,12 @@ public EmoteImpl setManaged(boolean val) return this; } + public EmoteImpl setAvailable(boolean available) + { + this.available = available; + return this; + } + public EmoteImpl setUser(User user) { this.user = user; diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index ae343c269e..8333b2f631 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -805,7 +805,8 @@ public EmoteImpl createEmote(GuildImpl guildObj, DataObject json, boolean fake) return emoteObj .setName(json.getString("name", "")) .setAnimated(json.getBoolean("animated")) - .setManaged(json.getBoolean("managed")); + .setManaged(json.getBoolean("managed")) + .setAvailable(json.getBoolean("available", true)); } public Category createCategory(DataObject json, long guildId) From 77ce2f4d4da3ea4ccb2810e2f0518734881aadb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 11 Jul 2020 21:40:06 +0200 Subject: [PATCH 010/121] Add support for array packing in ETF --- .../jda/api/utils/data/etf/ExTermEncoder.java | 83 +++++++++++++++++-- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java index 6058a303a8..a999b023fb 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java @@ -19,6 +19,7 @@ import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; +import java.util.Arrays; import java.util.Collection; import java.util.Map; @@ -87,6 +88,18 @@ private static ByteBuffer pack(ByteBuffer buffer, Object value) return packAtom(buffer, String.valueOf(value)); if (value == null) return packAtom(buffer, "nil"); + // imagine we had templates :O + if (value instanceof long[]) + return packArray(buffer, (long[]) value); + if (value instanceof int[]) + return packArray(buffer, (int[]) value); + if (value instanceof short[]) + return packArray(buffer, (short[]) value); + if (value instanceof byte[]) + return packArray(buffer, (byte[]) value); + // omitting other array types because we don't use them anywhere + if (value instanceof Object[]) + return packList(buffer, Arrays.asList((Object[]) value)); throw new UnsupportedOperationException("Cannot pack value of type " + value.getClass().getName()); } @@ -123,24 +136,21 @@ private static ByteBuffer packList(ByteBuffer buffer, Collection data) if (data.isEmpty()) { // NIL is for empty lists - buffer = realloc(buffer, 1); - buffer.put(NIL); - return buffer; + return packNil(buffer); } - buffer = realloc(buffer, data.size() + 5); + buffer = realloc(buffer, data.size() + 6); buffer.put(LIST); buffer.putInt(data.size()); for (Object element : data) buffer = pack(buffer, element); - buffer.put(NIL); - return buffer; + return packNil(buffer); } private static ByteBuffer packBinary(ByteBuffer buffer, String value) { byte[] encoded = value.getBytes(StandardCharsets.UTF_8); - buffer = realloc(buffer, encoded.length + 5); + buffer = realloc(buffer, encoded.length * 4 + 5); buffer.put(BINARY); buffer.putInt(value.length()); buffer.put(encoded); @@ -211,6 +221,65 @@ private static ByteBuffer packAtom(ByteBuffer buffer, String value) return buffer; } + private static ByteBuffer packArray(ByteBuffer buffer, long[] array) + { + if (array.length == 0) + return packNil(buffer); + + buffer = realloc(buffer, array.length * 8 + 6); + buffer.put(LIST); + buffer.putInt(array.length); + for (long it : array) + buffer = packLong(buffer, it); + return packNil(buffer); + } + + private static ByteBuffer packArray(ByteBuffer buffer, int[] array) + { + if (array.length == 0) + return packNil(buffer); + + buffer = realloc(buffer, array.length * 4 + 6); + buffer.put(LIST); + buffer.putInt(array.length); + for (int it : array) + buffer = packInt(buffer, it); + return packNil(buffer); + } + + private static ByteBuffer packArray(ByteBuffer buffer, short[] array) + { + if (array.length == 0) + return packNil(buffer); + + buffer = realloc(buffer, array.length * 2 + 6); + buffer.put(LIST); + buffer.putInt(array.length); + for (short it : array) + buffer = packInt(buffer, it); + return packNil(buffer); + } + + private static ByteBuffer packArray(ByteBuffer buffer, byte[] array) + { + if (array.length == 0) + return packNil(buffer); + + buffer = realloc(buffer, array.length + 6); + buffer.put(LIST); + buffer.putInt(array.length); + for (byte it : array) + buffer = packSmallInt(buffer, it); + return packNil(buffer); + } + + private static ByteBuffer packNil(ByteBuffer buffer) + { + buffer = realloc(buffer, 1); + buffer.put(NIL); + return buffer; + } + private static byte countBytes(long value) { int leadingZeros = Long.numberOfLeadingZeros(value); From af73341c1786b154303296d5185f80e4a86b12da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 13 Jul 2020 10:43:58 +0200 Subject: [PATCH 011/121] Deprecate IFakeable (#1291) * Deprecate IFakeable * Improve cache handling of private channel recipients * Remove references to fake terminology * Add deadline parameter to ForRemoval annotation * Improve cache consistency * Remove code smell for unloading guild members --- README.md | 19 +--- .../dv8tion/jda/annotations/ForRemoval.java | 6 ++ src/main/java/net/dv8tion/jda/api/JDA.java | 2 +- .../net/dv8tion/jda/api/MessageBuilder.java | 2 +- .../jda/api/entities/ApplicationInfo.java | 2 +- .../net/dv8tion/jda/api/entities/Emote.java | 15 +--- .../net/dv8tion/jda/api/entities/Guild.java | 2 +- .../dv8tion/jda/api/entities/IFakeable.java | 10 +++ .../net/dv8tion/jda/api/entities/Invite.java | 2 +- .../net/dv8tion/jda/api/entities/Message.java | 5 -- .../dv8tion/jda/api/entities/TeamMember.java | 2 +- .../net/dv8tion/jda/api/entities/Webhook.java | 10 +-- .../jda/api/events/guild/GuildBanEvent.java | 1 - .../jda/api/events/guild/GuildUnbanEvent.java | 1 - .../events/message/MessageReceivedEvent.java | 3 +- .../guild/GuildMessageReceivedEvent.java | 5 +- .../jda/api/sharding/ShardManager.java | 2 +- .../net/dv8tion/jda/internal/JDAImpl.java | 15 +--- .../jda/internal/audio/AudioWebSocket.java | 6 +- .../jda/internal/entities/EmoteImpl.java | 13 ++- .../jda/internal/entities/EntityBuilder.java | 90 +++++++------------ .../jda/internal/entities/GuildImpl.java | 6 +- .../jda/internal/entities/MemberImpl.java | 1 + .../internal/entities/PrivateChannelImpl.java | 12 ++- .../internal/entities/ReceivedMessage.java | 2 - .../jda/internal/entities/UserImpl.java | 2 - .../internal/handle/ChannelCreateHandler.java | 2 +- .../internal/handle/ChannelDeleteHandler.java | 6 -- .../jda/internal/handle/GuildBanHandler.java | 2 +- .../internal/handle/GuildDeleteHandler.java | 11 +-- .../handle/GuildMemberRemoveHandler.java | 19 ++-- .../internal/handle/InviteCreateHandler.java | 2 +- .../internal/handle/MessageDeleteHandler.java | 4 - .../handle/MessageReactionHandler.java | 8 -- .../internal/handle/MessageUpdateHandler.java | 2 - .../internal/handle/TypingStartHandler.java | 2 - .../internal/managers/EmoteManagerImpl.java | 5 +- .../internal/requests/WebSocketClient.java | 2 - .../ReactionPaginationActionImpl.java | 2 +- .../jda/internal/utils/PermissionUtil.java | 2 +- 40 files changed, 109 insertions(+), 196 deletions(-) diff --git a/README.md b/README.md index af7c5ae355..391e58d98c 100644 --- a/README.md +++ b/README.md @@ -319,28 +319,17 @@ public static void main(String[] args) throws Exception ## Entity Lifetimes -An **Entity** is the term used to describe types such as **GuildChannel**/**Message**/**User** and other entities -that Discord provides. -Instances of these entities are created and deleted by JDA when Discord instructs it. This means -the lifetime depends on signals provided by the Discord API which are used to create/update/delete entities. +An **Entity** is the term used to describe types such as **GuildChannel**/**Message**/**User** and other entities that Discord provides. +Instances of these entities are created and deleted by JDA when Discord instructs it. This means the lifetime depends on signals provided by the Discord API which are used to create/update/delete entities. This is done through Gateway Events known as "dispatches" that are handled by the JDA WebSocket handlers. When Discord instructs JDA to delete entities, they are simply removed from the JDA cache and lose their references. -Once that happens, nothing in JDA interacts or updates the instances of those entities, and they become useless. Discord -may instruct to delete these entities randomly for cache synchronization with the API. +Once that happens, nothing in JDA interacts or updates the instances of those entities, and they become useless. +Discord may instruct to delete these entities randomly for cache synchronization with the API. **It is not recommended to store _any_ of these entities for a longer period of time!** Instead of keeping (e.g.) a `User` instance in some field, an ID should be used. With the ID of a user, you can use `getUserById(id)` to get and keep the user reference in a local variable (see below). -### Fake Entities - -Some entities in JDA are marked through an interface called `IFakeable`. These entities can exist outside -of the JDA cache and are inaccessible through the common `get...ById(id)` methods. -Fake entities are essentially instances that are not directly referenced by the JDA cache and are only -temporarily created for a specific usage. It may be used for the author of a message that has left the guild -when requesting the history of a `MessageChannel` or for `Emote` instances used in a `Message` that are not part -of any of the guilds available to the bot. - ### Entity Updates When an entity is updated through its manager, they will send a request to the Discord API which will update the state diff --git a/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java b/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java index 18482cf3ff..89db186d94 100644 --- a/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java +++ b/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java @@ -27,4 +27,10 @@ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR}) public @interface ForRemoval { + /** + * Version which will most likely remove this feature. + * + * @return The deadline version or N/A if this isn't known yet + */ + String deadline() default "N/A"; } diff --git a/src/main/java/net/dv8tion/jda/api/JDA.java b/src/main/java/net/dv8tion/jda/api/JDA.java index 35d3639ff2..d44c6d3a25 100644 --- a/src/main/java/net/dv8tion/jda/api/JDA.java +++ b/src/main/java/net/dv8tion/jda/api/JDA.java @@ -1510,8 +1510,8 @@ default VoiceChannel getVoiceChannelById(long id) */ @Nonnull @Deprecated - @ForRemoval @DeprecatedSince("4.0.0") + @ForRemoval(deadline="4.3.0") @ReplaceWith("jda.getVoiceChannelsByName(name, ignoreCase)") default List getVoiceChannelByName(@Nonnull String name, boolean ignoreCase) { diff --git a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java index d6e6c53e92..6c3b3f2b41 100644 --- a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java @@ -1124,8 +1124,8 @@ public int lastIndexOf(@Nonnull CharSequence target, int fromIndex, int endIndex */ @Nonnull @Deprecated - @ForRemoval @DeprecatedSince("4.2.1") + @ForRemoval(deadline="4.3.0") @ReplaceWith("channel.sendMessage(builder.build())") public MessageAction sendTo(@Nonnull MessageChannel channel) { diff --git a/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java b/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java index 68dc28d815..ba3dda9f66 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java @@ -222,7 +222,7 @@ default String getInviteUrl(long guildId, @Nullable Permission... permissions) String getName(); /** - * The owner of the bot's application. This may be a fake user. + * The owner of the bot's application. * * @return The owner of the bot's application */ diff --git a/src/main/java/net/dv8tion/jda/api/entities/Emote.java b/src/main/java/net/dv8tion/jda/api/entities/Emote.java index 46cc2cd582..24748ec945 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Emote.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Emote.java @@ -36,13 +36,6 @@ * *

This does not represent unicode emojis like they are used in the official client! (:smiley: is not a custom emoji) * - *

Fake Emote

- * When an emote is declared as fake it cannot be updated by JDA. That means it will not be accessible - * through cache such as {@link Guild#getEmoteCache()} and similar. - *
Fake emotes may or may not have an attached {@link Guild Guild} and thus might not be manageable though - * {@link #getManager()} or {@link #delete()}. They also might lack attached roles for {@link #getRoles()}. - * - * * @since 2.2 * * @see net.dv8tion.jda.api.entities.ListedEmote ListedEmote @@ -65,9 +58,9 @@ public interface Emote extends IMentionable, IFakeable /** * The {@link net.dv8tion.jda.api.entities.Guild Guild} this emote is attached to. * - *

This is null if the emote is fake (retrieved from a Message) + *

This is null if the emote is created from a message * - * @return Guild of this emote or null if it is a fake entity + * @return Guild of this emote or null if it is created from a message */ @Nullable Guild getGuild(); @@ -171,8 +164,6 @@ default boolean hasRoles() *
If we were removed from the Guild * * - * @throws IllegalStateException - * if this Emote is fake ({@link #isFake()}) * @throws java.lang.UnsupportedOperationException * If this emote is managed by discord ({@link #isManaged()}) * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException @@ -191,7 +182,7 @@ default boolean hasRoles() *
You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * * @throws IllegalStateException - * if this emote is fake + * if this emote is created from a message or the bot does not have access to the emote * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_EMOTES Permission.MANAGE_EMOTES} * 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 b427dd0b42..82460b467c 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -1788,7 +1788,7 @@ default RestAction retrieveEmote(@Nonnull Emote emote) JDA jda = getJDA(); return new DeferredRestAction<>(jda, ListedEmote.class, () -> { - if (emote instanceof ListedEmote && !emote.isFake()) + if (emote instanceof ListedEmote) { ListedEmote listedEmote = (ListedEmote) emote; if (listedEmote.hasUser() || !getSelfMember().hasPermission(Permission.MANAGE_EMOTES)) diff --git a/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java b/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java index 2355d35a45..24537c84e1 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java +++ b/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java @@ -16,6 +16,9 @@ package net.dv8tion.jda.api.entities; +import net.dv8tion.jda.annotations.DeprecatedSince; +import net.dv8tion.jda.annotations.ForRemoval; + /** * Marks a fakeable entity. *
A fake entity ({@link #isFake()} is true) is an entity which is not directly related to this instance of JDA or @@ -33,6 +36,10 @@ * * @since 3.0 */ +@Deprecated +@DeprecatedSince("4.2.1") +@ForRemoval(deadline="4.3.0") +@SuppressWarnings("DeprecatedIsStillUsed") public interface IFakeable { /** @@ -40,5 +47,8 @@ public interface IFakeable * * @return False, if this is an actual JDA entity. */ + @Deprecated + @DeprecatedSince("4.2.1") + @ForRemoval(deadline="4.3.0") boolean isFake(); } diff --git a/src/main/java/net/dv8tion/jda/api/entities/Invite.java b/src/main/java/net/dv8tion/jda/api/entities/Invite.java index cc19df52d7..259d7fc246 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Invite.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Invite.java @@ -218,7 +218,7 @@ default String getUrl() Guild getGuild(); /** - * The user who created this invite. This may be a fake user. For not expanded invites this may be null. + * The user who created this invite. For not expanded invites this may be null. * * @return The user who created this invite */ 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 3be4a243b7..f3f16d77a8 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -724,9 +724,6 @@ default boolean isFromGuild() *
This only includes Custom Emotes, not unicode Emojis. JDA classifies Emotes as the Custom Emojis uploaded * to a Guild and retrievable with {@link net.dv8tion.jda.api.entities.Guild#getEmotes()}. These are not the same * as the unicode emojis that Discord also supports. Elements are sorted in order of appearance. - *

- * This may or may not contain fake Emotes which means they can be displayed but not used by the logged in account. - * To check whether an Emote is fake you can test if {@link Emote#isFake()} returns true. * *

Unicode emojis are not included as {@link net.dv8tion.jda.api.entities.Emote Emote}! * @@ -1145,7 +1142,6 @@ default boolean isFromGuild() * @throws java.lang.IllegalArgumentException *

    *
  • If the provided {@link net.dv8tion.jda.api.entities.Emote Emote} is null.
  • - *
  • If the provided {@link net.dv8tion.jda.api.entities.Emote Emote} is fake {@link net.dv8tion.jda.api.entities.Emote#isFake() Emote.isFake()}.
  • *
  • If the provided {@link net.dv8tion.jda.api.entities.Emote Emote} cannot be used in the current channel. * See {@link Emote#canInteract(User, MessageChannel)} or {@link Emote#canInteract(Member)} for more information.
  • *
@@ -1449,7 +1445,6 @@ default boolean isFromGuild() * @throws java.lang.IllegalArgumentException *
    *
  • If the provided {@link net.dv8tion.jda.api.entities.Emote Emote} is null.
  • - *
  • If the provided {@link net.dv8tion.jda.api.entities.Emote Emote} is fake {@link net.dv8tion.jda.api.entities.Emote#isFake() Emote.isFake()}.
  • *
  • If the provided {@link net.dv8tion.jda.api.entities.Emote Emote} cannot be used in the current channel. * See {@link Emote#canInteract(User, MessageChannel)} or {@link Emote#canInteract(Member)} for more information.
  • *
  • If the provided user is null
  • diff --git a/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java b/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java index d7633909b2..cf040ba874 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java +++ b/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java @@ -28,7 +28,7 @@ public interface TeamMember { /** - * Possibly-fake user for the team member. + * User for the team member. * * @return The user */ diff --git a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java index 18d0a3cc43..0ff499ee97 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java @@ -72,7 +72,7 @@ public interface Webhook extends ISnowflake, IFakeable TextChannel getChannel(); /** - * The owner of this Webhook. This will be null for fake Webhooks, such as those retrieved from Audit Logs. + * The owner of this Webhook. This will be null for some Webhooks, such as those retrieved from Audit Logs. * * @return Possibly-null {@link net.dv8tion.jda.api.entities.Member Member} instance * representing the owner of this Webhook. @@ -83,7 +83,7 @@ public interface Webhook extends ISnowflake, IFakeable /** * The default User for this Webhook. * - *

    The {@link net.dv8tion.jda.api.entities.User User} returned is always {@code fake}. + *

    The {@link net.dv8tion.jda.api.entities.User User} returned is always fake and cannot be interacted with. *
    This User is used for all messages posted to the Webhook route (found in {@link #getUrl()}), * it holds the default references for the message authors of messages by this Webhook. * @@ -115,7 +115,7 @@ public interface Webhook extends ISnowflake, IFakeable *
    This can be used to modify/delete/execute * this Webhook. * - *

    Note: Fake Webhooks, such as those retrieved from Audit Logs, do not contain a token + *

    Note: Some Webhooks, such as those retrieved from Audit Logs, do not contain a token * * @return The execute token for this Webhook */ @@ -125,7 +125,7 @@ public interface Webhook extends ISnowflake, IFakeable /** * The {@code POST} route for this Webhook. *
    This contains the {@link #getToken() token} and {@link #getId() id} - * of this Webhook. Fake Webhooks without tokens (such as those retrieved from Audit Logs) + * of this Webhook. Some Webhooks without tokens (such as those retrieved from Audit Logs) * will return a URL without a token. * *

    The route returned by this method does not need permission checks @@ -159,7 +159,7 @@ public interface Webhook extends ISnowflake, IFakeable *

* * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException - * If the Webhook is fake, such as the Webhooks retrieved from Audit Logs and the currently + * If the Webhook does not have a token, such as the Webhooks retrieved from Audit Logs and the currently * logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_WEBHOOKS} in this channel. * * @return {@link net.dv8tion.jda.api.requests.restaction.AuditableRestAction AuditableRestAction} diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java index f2ea2dc694..7938068e72 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java @@ -41,7 +41,6 @@ public GuildBanEvent(@Nonnull JDA api, long responseNumber, @Nonnull Guild guild /** * The banned {@link net.dv8tion.jda.api.entities.User User} - *
Possibly fake user. * * @return The banned user */ diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java index fba1ee7439..4dcdfd2fb9 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java @@ -38,7 +38,6 @@ public GuildUnbanEvent(@Nonnull JDA api, long responseNumber, @Nonnull Guild gui /** * The {@link net.dv8tion.jda.api.entities.User User} who was unbanned - *
Possibly fake user. * * @return The unbanned user */ diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java index 58af6fd9b5..971ad40800 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.Webhook; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -53,11 +54,11 @@ public Message getMessage() /** * The Author of the Message received as {@link net.dv8tion.jda.api.entities.User User} object. *
This will be never-null but might be a fake user if Message was sent via Webhook (Guild only). + * See {@link Webhook#getDefaultUser()}. * * @return The Author of the Message. * * @see #isWebhookMessage() - * @see net.dv8tion.jda.api.entities.User#isFake() */ @Nonnull public User getAuthor() diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java index eada1501cf..0c2f37db0e 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.Webhook; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -51,12 +52,12 @@ public Message getMessage() /** * The Author of the Message received as {@link net.dv8tion.jda.api.entities.User User} object. - *
This will be never-null but might be a fake User if Message was sent via Webhook + *
This will be never-null but might be a fake User if Message was sent via Webhook. + * See {@link Webhook#getDefaultUser()}. * * @return The Author of the Message. * * @see #isWebhookMessage() - * @see net.dv8tion.jda.api.entities.User#isFake() */ @Nonnull public User getAuthor() diff --git a/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java b/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java index b0b6f85c91..7547a7403a 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java @@ -582,7 +582,7 @@ default RestAction retrieveUserById(long id) JDAImpl jda = (JDAImpl) api; Route.CompiledRoute route = Route.Users.GET_USER.compile(Long.toUnsignedString(id)); - return new RestActionImpl<>(jda, route, (response, request) -> jda.getEntityBuilder().createFakeUser(response.getObject())); + return new RestActionImpl<>(jda, route, (response, request) -> jda.getEntityBuilder().createUser(response.getObject())); } /** diff --git a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java index ef00e63aca..e4d2394fd6 100644 --- a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java @@ -91,9 +91,6 @@ public class JDAImpl implements JDA protected final SnowflakeCacheViewImpl voiceChannelCache = new SnowflakeCacheViewImpl<>(VoiceChannel.class, GuildChannel::getName); protected final SnowflakeCacheViewImpl privateChannelCache = new SnowflakeCacheViewImpl<>(PrivateChannel.class, MessageChannel::getName); - protected final TLongObjectMap fakeUsers = MiscUtil.newLongMap(); - protected final TLongObjectMap fakePrivateChannels = MiscUtil.newLongMap(); - protected final AbstractCacheView audioManagers = new CacheView.SimpleCacheView<>(AudioManager.class, m -> m.getGuild().getName()); protected final PresenceImpl presence; @@ -559,7 +556,7 @@ public RestAction retrieveUserById(long id, boolean update) () -> { Route.CompiledRoute route = Route.Users.GET_USER.compile(Long.toUnsignedString(id)); return new RestActionImpl<>(this, route, - (response, request) -> getEntityBuilder().createFakeUser(response.getObject())); + (response, request) -> getEntityBuilder().createUser(response.getObject())); }); } @@ -984,16 +981,6 @@ public AbstractCacheView getAudioManagersView() return audioManagers; } - public TLongObjectMap getFakeUserMap() - { - return fakeUsers; - } - - public TLongObjectMap getFakePrivateChannelMap() - { - return fakePrivateChannels; - } - public void setSelfUser(SelfUser selfUser) { try (UnlockHook hook = userCache.writeLock()) 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 051b2b9962..14a70e4210 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java @@ -693,11 +693,7 @@ private void setupKeepAlive(final int keepAliveInterval) private User getUser(final long userId) { - JDAImpl api = getJDA(); - User user = api.getUserById(userId); - if (user != null) - return user; - return api.getFakeUserMap().get(userId); + return getJDA().getUserById(userId); } @Override diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java index 4842c60f89..4fa8b6923a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java @@ -50,7 +50,6 @@ public class EmoteImpl implements ListedEmote private final SnowflakeReference guild; private final JDAImpl api; private final Set roles; - private final boolean fake; private final ReentrantLock mngLock = new ReentrantLock(); private volatile EmoteManager manager = null; @@ -72,7 +71,6 @@ public EmoteImpl(long id, GuildImpl guild, boolean fake) this.api = guild.getJDA(); this.guild = new SnowflakeReference<>(guild, api::getGuildById); this.roles = ConcurrentHashMap.newKeySet(); - this.fake = fake; } public EmoteImpl(long id, JDAImpl api) @@ -81,7 +79,6 @@ public EmoteImpl(long id, JDAImpl api) this.api = api; this.guild = null; this.roles = null; - this.fake = true; } @Override @@ -95,7 +92,7 @@ public GuildImpl getGuild() public List getRoles() { if (!canProvideRoles()) - throw new IllegalStateException("Unable to return roles because this emote is fake. (We do not know the origin Guild of this emote)"); + throw new IllegalStateException("Unable to return roles because this emote is from a message. (We do not know the origin Guild of this emote)"); return Collections.unmodifiableList(new LinkedList<>(roles)); } @@ -125,9 +122,10 @@ public boolean isAvailable() } @Override + @Deprecated public boolean isFake() { - return fake; + return false; } @Override @@ -186,7 +184,7 @@ public boolean isAnimated() public AuditableRestAction delete() { if (getGuild() == null) - throw new IllegalStateException("The emote you are trying to delete is not an actual emote we have access to (it is fake)!"); + throw new IllegalStateException("The emote you are trying to delete is not an actual emote we have access to (it is from a message)!"); if (managed) throw new UnsupportedOperationException("You cannot delete a managed emote!"); if (!getGuild().getSelfMember().hasPermission(Permission.MANAGE_EMOTES)) @@ -221,7 +219,7 @@ public EmoteImpl setAvailable(boolean available) this.available = available; return this; } - + public EmoteImpl setUser(User user) { this.user = user; @@ -265,7 +263,6 @@ public String toString() @Override public EmoteImpl clone() { - if (isFake()) return null; EmoteImpl copy = new EmoteImpl(id, getGuild()).setUser(user).setManaged(managed).setAnimated(animated).setName(name); copy.roles.addAll(roles); return copy; diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index 8333b2f631..621f72ccce 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -291,9 +291,7 @@ private void createGuildChannel(GuildImpl guildObj, DataObject channelData) } } - public UserImpl createFakeUser(DataObject user) { return createUser(user, true); } - public UserImpl createUser(DataObject user) { return createUser(user, false); } - private UserImpl createUser(DataObject user, boolean fake) + public UserImpl createUser(DataObject user) { boolean newUser = false; final long id = user.getLong("id"); @@ -305,16 +303,12 @@ private UserImpl createUser(DataObject user, boolean fake) userObj = (UserImpl) userView.getElementById(id); if (userObj == null) { - userObj = (UserImpl) getJDA().getFakeUserMap().get(id); - if (userObj == null) - { - userObj = new UserImpl(id, getJDA()).setFake(fake); - newUser = true; - } + userObj = new UserImpl(id, getJDA()); + newUser = true; } } - if (newUser || userObj.isFake()) + if (newUser) { // Initial creation userObj.setName(user.getString("username")) @@ -323,7 +317,7 @@ private UserImpl createUser(DataObject user, boolean fake) .setBot(user.getBoolean("bot")) .setFlags(user.getInt("public_flags", 0)); } - else if (!userObj.isFake()) + else { // Fire update events updateUser(userObj, user); @@ -371,7 +365,7 @@ public void updateUser(UserImpl userObj, DataObject user) jda, responseNumber, userObj, oldAvatar)); } - + if (oldFlags != newFlags) { userObj.setFlags(newFlags); @@ -397,18 +391,11 @@ public boolean updateMemberCache(MemberImpl member, boolean forceRemove) if (membersView.remove(member.getIdLong()) == null) return false; LOG.trace("Unloading member {}", member); - if (!user.isFake() && user.getMutualGuilds().isEmpty()) + if (user.getMutualGuilds().isEmpty()) { - // we no longer share any guilds with this user so remove it from cache + // we no longer share any guilds/channels with this user so remove it from cache user.setFake(true); getJDA().getUsersView().remove(user.getIdLong()); - if (user.hasPrivateChannel()) - { - PrivateChannel channel = user.getPrivateChannel(); - getJDA().getFakeUserMap().put(user.getIdLong(), user); - getJDA().getFakePrivateChannelMap().put(channel.getIdLong(), channel); - getJDA().getPrivateChannelsView().remove(channel.getIdLong()); - } } GuildVoiceStateImpl voiceState = (GuildVoiceStateImpl) member.getVoiceState(); @@ -432,21 +419,10 @@ else if (guild.getMemberById(member.getIdLong()) != null) if (getJDA().getUserById(user.getIdLong()) == null) { - // promote fake user to real user - user.setFake(false); SnowflakeCacheViewImpl usersView = getJDA().getUsersView(); - SnowflakeCacheViewImpl privateChannels = getJDA().getPrivateChannelsView(); - try (UnlockHook hook1 = usersView.writeLock(); - UnlockHook hook2 = privateChannels.writeLock()) + try (UnlockHook hook1 = usersView.writeLock()) { usersView.getMap().put(user.getIdLong(), user); - getJDA().getFakeUserMap().remove(user.getIdLong()); - if (user.hasPrivateChannel()) - { - PrivateChannel channel = user.getPrivateChannel(); - privateChannels.getMap().put(channel.getIdLong(), channel); - getJDA().getFakePrivateChannelMap().remove(channel.getIdLong()); - } } } @@ -598,8 +574,7 @@ public void updateMember(GuildImpl guild, MemberImpl member, DataObject content, member.setJoinDate(joinEpoch); } - if (!member.getUser().isFake()) - updateUser((UserImpl) member.getUser(), content.getObject("user")); + updateUser((UserImpl) member.getUser(), content.getObject("user")); } private void updateMemberRoles(MemberImpl member, List newRoles, long responseNumber) @@ -787,7 +762,7 @@ public EmoteImpl createEmote(GuildImpl guildObj, DataObject json, boolean fake) { DataArray emoteRoles = json.optArray("roles").orElseGet(DataArray::empty); final long emoteId = json.getLong("id"); - final User user = json.isNull("user") ? null : createFakeUser(json.getObject("user")); + final User user = json.isNull("user") ? null : createUser(json.getObject("user")); EmoteImpl emoteObj = (EmoteImpl) guildObj.getEmoteById(emoteId); if (emoteObj == null) emoteObj = new EmoteImpl(emoteId, guildObj, fake); @@ -968,11 +943,14 @@ public VoiceChannel createVoiceChannel(GuildImpl guild, DataObject json, long gu } public PrivateChannel createPrivateChannel(DataObject json) + { + return createPrivateChannel(json, false); + } + + public PrivateChannel createPrivateChannel(DataObject json, boolean modifyCache) { final long channelId = json.getUnsignedLong("id"); PrivateChannel channel = api.getPrivateChannelById(channelId); - if (channel == null) - channel = api.getFakePrivateChannelMap().get(channelId); if (channel != null) return channel; @@ -984,27 +962,27 @@ public PrivateChannel createPrivateChannel(DataObject json) if (user == null) { //The getJDA() can give us private channels connected to Users that we can no longer communicate with. // As such, make a fake user and fake private channel. - user = createFakeUser(recipient); + user = createUser(recipient); } - return createPrivateChannel(json, user); + return createPrivateChannel(json, user, modifyCache); } public PrivateChannel createPrivateChannel(DataObject json, UserImpl user) + { + return createPrivateChannel(json, user, false); + } + + public PrivateChannel createPrivateChannel(DataObject json, UserImpl user, boolean modifyCache) { final long channelId = json.getLong("id"); PrivateChannelImpl priv = new PrivateChannelImpl(channelId, user) .setLastMessageId(json.getLong("last_message_id", 0)); user.setPrivateChannel(priv); - if (user.isFake()) - { - // Promote user and channel to cache of fakers - getJDA().getFakePrivateChannelMap().put(channelId, priv); - getJDA().getFakeUserMap().put(user.getIdLong(), user); - } - else + if (modifyCache) { + // only add channels to cache when they come from an event, otherwise we would never remove the channel SnowflakeCacheViewImpl privateView = getJDA().getPrivateChannelsView(); try (UnlockHook hook = privateView.writeLock()) { @@ -1073,8 +1051,6 @@ public Message createMessage(DataObject jsonObject, boolean modifyCache) MessageChannel chan = getJDA().getTextChannelById(channelId); if (chan == null) chan = getJDA().getPrivateChannelById(channelId); - if (chan == null) - chan = getJDA().getFakePrivateChannelMap().get(channelId); if (chan == null) throw new IllegalArgumentException(MISSING_CHANNEL); @@ -1138,7 +1114,7 @@ public Message createMessage(DataObject jsonObject, MessageChannel chan, boolean if (user == null) { if (fromWebhook || !modifyCache) - user = createFakeUser(author); + user = createUser(author); else throw new IllegalArgumentException(MISSING_USER); // Specifically for MESSAGE_CREATE } @@ -1196,7 +1172,7 @@ public Message createMessage(DataObject jsonObject, MessageChannel chan, boolean if (mentionJson.isNull("member")) { // Can't load user without member context so fake them if possible - User mentionedUser = createFakeUser(mentionJson); + User mentionedUser = createUser(mentionJson); mentionedUsersList.add(mentionedUser); Member mentionedMember = guild.getMember(mentionedUser); if (mentionedMember != null) @@ -1440,7 +1416,7 @@ public WebhookImpl createWebhook(DataObject object) .put("discriminator", "0000") .put("id", id) .put("avatar", avatar); - User defaultUser = createFakeUser(fakeUser); + User defaultUser = createUser(fakeUser); Optional ownerJson = object.optObject("user"); User owner = null; @@ -1454,7 +1430,7 @@ public WebhookImpl createWebhook(DataObject object) if (owner == null) { json.put("id", userId); - owner = createFakeUser(json); + owner = createUser(json); } } @@ -1467,7 +1443,7 @@ public WebhookImpl createWebhook(DataObject object) public Invite createInvite(DataObject object) { final String code = object.getString("code"); - final User inviter = object.hasKey("inviter") ? this.createFakeUser(object.getObject("inviter")) : null; + final User inviter = object.hasKey("inviter") ? createUser(object.getObject("inviter")) : null; final DataObject channelObject = object.getObject("channel"); final ChannelType channelType = ChannelType.fromId(channelObject.getInt("type")); @@ -1572,7 +1548,7 @@ public ApplicationInfo createApplicationInfo(DataObject object) final long id = object.getLong("id"); final String name = object.getString("name"); final boolean isBotPublic = object.getBoolean("bot_public"); - final User owner = createFakeUser(object.getObject("owner")); + final User owner = createUser(object.getObject("owner")); final ApplicationTeam team = !object.isNull("team") ? createApplicationTeam(object.getObject("team")) : null; return new ApplicationInfoImpl(getJDA(), description, doesBotRequireCodeGrant, iconId, id, isBotPublic, name, owner, team); @@ -1586,7 +1562,7 @@ public ApplicationTeam createApplicationTeam(DataObject object) List members = map(object, "members", (o) -> { DataObject userJson = o.getObject("user"); TeamMember.MembershipState state = TeamMember.MembershipState.fromKey(o.getInt("membership_state")); - User user = createFakeUser(userJson); + User user = createUser(userJson); return new TeamMemberImpl(user, state, id); }); return new ApplicationTeamImpl(iconId, members, id, ownerId); @@ -1601,7 +1577,7 @@ public AuditLogEntry createAuditLogEntry(GuildImpl guild, DataObject entryJson, final DataObject options = entryJson.isNull("options") ? null : entryJson.getObject("options"); final String reason = entryJson.getString("reason", null); - final UserImpl user = userJson == null ? null : createFakeUser(userJson); + final UserImpl user = userJson == null ? null : createUser(userJson); final WebhookImpl webhook = webhookJson == null ? null : createWebhook(webhookJson); final Set changesList; final ActionType type = ActionType.from(typeKey); diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 39ac860c15..a1449f0b88 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -580,7 +580,7 @@ public RestActionImpl> retrieveBanList() { final DataObject object = bannedArr.getObject(i); DataObject user = object.getObject("user"); - bans.add(new Ban(builder.createFakeUser(user), object.getString("reason", null))); + bans.add(new Ban(builder.createUser(user), object.getString("reason", null))); } return Collections.unmodifiableList(bans); }); @@ -602,7 +602,7 @@ public RestAction retrieveBanById(@Nonnull String userId) EntityBuilder builder = api.getEntityBuilder(); DataObject bannedObj = response.getObject(); DataObject user = bannedObj.getObject("user"); - return new Ban(builder.createFakeUser(user), bannedObj.getString("reason", null)); + return new Ban(builder.createUser(user), bannedObj.getString("reason", null)); }); } @@ -1467,7 +1467,7 @@ public GuildImpl setAvailable(boolean available) public GuildImpl setOwner(Member owner) { // Only cache owner if user cache is enabled - if (owner != null && !owner.isFake()) + if (owner != null && getMemberById(owner.getIdLong()) != null) this.owner = owner; return this; } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java index 5420ff81e5..34c544880a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java @@ -282,6 +282,7 @@ public boolean isOwner() } @Override + @Deprecated public boolean isFake() { return getGuild().getMemberById(getIdLong()) == null; diff --git a/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java index 8b86d0421a..0545323267 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java @@ -36,7 +36,7 @@ public class PrivateChannelImpl implements PrivateChannel { private final long id; - private final User user; + private User user; private long lastMessageId; public PrivateChannelImpl(long id, User user) @@ -45,10 +45,19 @@ public PrivateChannelImpl(long id, User user) this.user = user; } + private void updateUser() + { + // Load user from cache if one exists, otherwise we might have an outdated user instance + User realUser = getJDA().getUserById(user.getIdLong()); + if (realUser != null) + this.user = realUser; + } + @Nonnull @Override public User getUser() { + updateUser(); return user; } @@ -118,6 +127,7 @@ public long getIdLong() } @Override + @Deprecated public boolean isFake() { return user.isFake(); diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java index 8cca137267..15e0f01e13 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java @@ -294,8 +294,6 @@ private User matchUser(Matcher matcher) if (!mentionedUsers.contains(userId)) return null; User user = getJDA().getUserById(userId); - if (user == null) - user = api.getFakeUserMap().get(userId); if (user == null && userMentions != null) user = userMentions.stream().filter(it -> it.getIdLong() == userId).findFirst().orElse(null); return user; 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 bc9b06c204..d9237ccd01 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java @@ -113,8 +113,6 @@ public PrivateChannel getPrivateChannel() if (!hasPrivateChannel()) return null; PrivateChannel channel = getJDA().getPrivateChannelById(privateChannel); - if (channel == null) - channel = getJDA().getFakePrivateChannelMap().get(privateChannel); return channel != null ? channel : new PrivateChannelImpl(privateChannel, this); } diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java index 9ee91c1b7a..17cbfa30b9 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java @@ -89,7 +89,7 @@ protected Long handleInternally(DataObject content) jda.handleEvent( new PrivateChannelCreateEvent( jda, responseNumber, - builder.createPrivateChannel(content))); + builder.createPrivateChannel(content, true))); break; } case GROUP: diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java index f1ee72db8d..b1478ddbc6 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java @@ -25,7 +25,6 @@ import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.entities.GuildImpl; -import net.dv8tion.jda.internal.entities.UserImpl; import net.dv8tion.jda.internal.requests.WebSocketClient; import net.dv8tion.jda.internal.utils.cache.SnowflakeCacheViewImpl; @@ -131,8 +130,6 @@ protected Long handleInternally(DataObject content) SnowflakeCacheViewImpl privateView = getJDA().getPrivateChannelsView(); PrivateChannel channel = privateView.remove(channelId); - if (channel == null) - channel = getJDA().getFakePrivateChannelMap().remove(channelId); if (channel == null) { // getJDA().getEventCache().cache(EventCache.Type.CHANNEL, channelId, () -> handle(responseNumber, allContent)); @@ -143,9 +140,6 @@ protected Long handleInternally(DataObject content) return null; } - if (channel.getUser().isFake()) - getJDA().getFakeUserMap().remove(channel.getUser().getIdLong()); - ((UserImpl) channel.getUser()).setPrivateChannel(null); getJDA().handleEvent( new PrivateChannelDeleteEvent( getJDA(), responseNumber, diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java index deb3006c41..a7d259ffa5 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java @@ -49,7 +49,7 @@ protected Long handleInternally(DataObject content) return null; } - User user = getJDA().getEntityBuilder().createFakeUser(userJson); + User user = getJDA().getEntityBuilder().createUser(userJson); if (banned) { diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java index 14ea6e8651..040019a5e3 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java @@ -25,8 +25,6 @@ import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.entities.GuildImpl; -import net.dv8tion.jda.internal.entities.PrivateChannelImpl; -import net.dv8tion.jda.internal.entities.UserImpl; import net.dv8tion.jda.internal.managers.AudioManagerImpl; import net.dv8tion.jda.internal.requests.WebSocketClient; import net.dv8tion.jda.internal.utils.UnlockHook; @@ -115,14 +113,7 @@ protected Long handleInternally(DataObject content) memberIds.forEach(memberId -> { if (memberId == selfId) return true; // don't remove selfUser from cache - UserImpl user = (UserImpl) userView.getMap().remove(memberId); - if (user.hasPrivateChannel()) - { - PrivateChannelImpl priv = (PrivateChannelImpl) user.getPrivateChannel(); - user.setFake(true); - getJDA().getFakeUserMap().put(user.getIdLong(), user); - getJDA().getFakePrivateChannelMap().put(priv.getIdLong(), priv); - } + userView.remove(memberId); getJDA().getEventCache().clear(EventCache.Type.USER, memberId); return true; }); diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java index 7cbdba2987..67f6356fd2 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java @@ -23,7 +23,10 @@ import net.dv8tion.jda.api.events.guild.voice.GuildVoiceLeaveEvent; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; -import net.dv8tion.jda.internal.entities.*; +import net.dv8tion.jda.internal.entities.GuildImpl; +import net.dv8tion.jda.internal.entities.GuildVoiceStateImpl; +import net.dv8tion.jda.internal.entities.MemberImpl; +import net.dv8tion.jda.internal.entities.VoiceChannelImpl; import net.dv8tion.jda.internal.requests.WebSocketClient; import net.dv8tion.jda.internal.utils.UnlockHook; import net.dv8tion.jda.internal.utils.cache.SnowflakeCacheViewImpl; @@ -62,7 +65,7 @@ protected Long handleInternally(DataObject content) // Update the memberCount guild.onMemberRemove(); - User user = api.getEntityBuilder().createFakeUser(content.getObject("user")); + User user = api.getEntityBuilder().createUser(content.getObject("user")); MemberImpl member = (MemberImpl) guild.getMembersView().remove(userId); if (member == null) @@ -107,17 +110,9 @@ protected Long handleInternally(DataObject content) { if (userId != getJDA().getSelfUser().getIdLong() // don't remove selfUser from cache && getJDA().getGuildsView().stream() - .map(GuildImpl.class::cast) - .noneMatch(g -> g.getMembersView().get(userId) != null)) + .noneMatch(g -> g.getMemberById(userId) != null)) { - UserImpl removedUser = (UserImpl) userView.getMap().remove(userId); - if (removedUser.hasPrivateChannel()) - { - PrivateChannelImpl priv = (PrivateChannelImpl) removedUser.getPrivateChannel(); - removedUser.setFake(true); - getJDA().getFakeUserMap().put(removedUser.getIdLong(), removedUser); - getJDA().getFakePrivateChannelMap().put(priv.getIdLong(), priv); - } + userView.remove(userId); getJDA().getEventCache().clear(EventCache.Type.USER, userId); } } diff --git a/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java index b4bcccc4d5..c5242cf98a 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java @@ -70,7 +70,7 @@ protected Long handleInternally(DataObject content) Optional inviterJson = content.optObject("inviter"); boolean expanded = maxUses != -1; - User inviter = inviterJson.map(json -> getJDA().getEntityBuilder().createFakeUser(json)).orElse(null); + User inviter = inviterJson.map(json -> getJDA().getEntityBuilder().createUser(json)).orElse(null); InviteImpl.ChannelImpl channel = new InviteImpl.ChannelImpl(realChannel); InviteImpl.GuildImpl guild = new InviteImpl.GuildImpl(realGuild); diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java index e00ad7c55f..e142998767 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java @@ -45,10 +45,6 @@ protected Long handleInternally(DataObject content) channel = getJDA().getPrivateChannelById(channelId); } if (channel == null) - { - channel = getJDA().getFakePrivateChannelMap().get(channelId); - } - if (channel == null) { getJDA().getEventCache().cache(EventCache.Type.CHANNEL, channelId, responseNumber, allContent, this::handle); EventCache.LOG.debug("Got message delete for a channel/group that is not yet cached. ChannelId: {}", channelId); diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java index 7df0a56ded..da900045be 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java @@ -94,8 +94,6 @@ protected Long handleInternally(DataObject content) User user = getJDA().getUserById(userId); if (user == null && member != null) user = member.getUser(); // this happens when we have guild subscriptions disabled - if (user == null) - user = getJDA().getFakeUserMap().get(userId); if (user == null) { if (add && guild != null) @@ -109,13 +107,7 @@ protected Long handleInternally(DataObject content) MessageChannel channel = getJDA().getTextChannelById(channelId); if (channel == null) - { channel = getJDA().getPrivateChannelById(channelId); - } - if (channel == null) - { - channel = getJDA().getFakePrivateChannelMap().get(channelId); - } if (channel == null) { getJDA().getEventCache().cache(EventCache.Type.CHANNEL, channelId, responseNumber, allContent, this::handle); diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java index d84ed5df11..250d9849b6 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java @@ -159,8 +159,6 @@ private Long handleMessageEmbed(DataObject content) MessageChannel channel = getJDA().getTextChannelsView().get(channelId); if (channel == null) channel = getJDA().getPrivateChannelsView().get(channelId); - if (channel == null) - channel = getJDA().getFakePrivateChannelMap().get(channelId); if (channel == null) { getJDA().getEventCache().cache(EventCache.Type.CHANNEL, channelId, responseNumber, allContent, this::handle); diff --git a/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java index ef84776c9d..869902dcf0 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java @@ -48,8 +48,6 @@ protected Long handleInternally(DataObject content) MessageChannel channel = getJDA().getTextChannelsView().get(channelId); if (channel == null) channel = getJDA().getPrivateChannelsView().get(channelId); - if (channel == null) - channel = getJDA().getFakePrivateChannelMap().get(channelId); if (channel == null) return null; //We don't have the channel cached yet. We chose not to cache this event // because that happen very often and could easily fill up the EventCache if diff --git a/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java index cb47bc7ae9..008cd0cc45 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java @@ -47,9 +47,6 @@ public class EmoteManagerImpl extends ManagerBase implements Emote * * @param emote * The target {@link net.dv8tion.jda.internal.entities.EmoteImpl EmoteImpl} to modify - * - * @throws java.lang.IllegalStateException - * If the specified Emote is {@link net.dv8tion.jda.api.entities.Emote#isFake() fake} or {@link net.dv8tion.jda.api.entities.Emote#isManaged() managed}. */ public EmoteManagerImpl(EmoteImpl emote) { @@ -63,7 +60,7 @@ private static Guild notNullGuild(EmoteImpl emote) { Guild g = emote.getGuild(); if (g == null) - throw new IllegalStateException("Cannot modify a fake emote"); + throw new IllegalStateException("Cannot modify an emote without shared guild"); return g; } diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index 3c9268dd09..70ca707176 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -757,8 +757,6 @@ protected void invalidate() api.getGuildsView().clear(); api.getUsersView().clear(); api.getPrivateChannelsView().clear(); - api.getFakeUserMap().clear(); - api.getFakePrivateChannelMap().clear(); api.getEventCache().clear(); api.getGuildSetupController().clearCache(); chunkManager.clear(); diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java index a6e3656f31..06a0b6087f 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java @@ -110,7 +110,7 @@ protected void handleSuccess(Response response, Request> request) { try { - final User user = builder.createFakeUser(array.getObject(i)); + final User user = builder.createUser(array.getObject(i)); users.add(user); if (useCache) cached.add(user); diff --git a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java index efebec8cae..7f4ddeb24f 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java @@ -114,7 +114,7 @@ public static boolean canInteract(Role issuer, Role target) /** * Check whether the provided {@link net.dv8tion.jda.api.entities.Member Member} can use the specified {@link net.dv8tion.jda.api.entities.Emote Emote}. * - *

If the specified Member is not in the emote's guild or the emote provided is fake this will return false. + *

If the specified Member is not in the emote's guild or the emote provided is from a message this will return false. * Otherwise it will check if the emote is restricted to any roles and if that is the case if the Member has one of these. * *

In the case of an {@link net.dv8tion.jda.api.entities.Emote#isAnimated() animated} Emote, this will From ef087216b9907f5ec2ad05f011c132208a28c702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 16 Jul 2020 00:23:52 +0200 Subject: [PATCH 012/121] Remove explicit catch for InterruptedIOException --- .../java/net/dv8tion/jda/internal/requests/Requester.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java index 0e7bb4effd..fedc232719 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java @@ -34,7 +34,6 @@ import javax.net.ssl.SSLPeerUnverifiedException; import java.io.IOException; -import java.io.InterruptedIOException; import java.net.SocketException; import java.net.SocketTimeoutException; import java.net.UnknownHostException; @@ -240,11 +239,6 @@ else if (handleOnRatelimit) return retryAfter; } - catch (InterruptedIOException e) - { - LOG.warn("Got interrupted while executing request", e); - return null; - } catch (UnknownHostException e) { LOG.error("DNS resolution failed: {}", e.getMessage()); From 7529f41981cc0c2aa9aafee306d338edba77d7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 18 Jul 2020 15:35:32 +0200 Subject: [PATCH 013/121] Fix NullPointerException when creating channels in categories Closes #1346 --- .../net/dv8tion/jda/internal/entities/CategoryImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java index e7f04afa2d..aa7b35474a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java @@ -192,14 +192,15 @@ public String toString() return "GC:" + getName() + '(' + id + ')'; } - private void applyPermission(ChannelAction a) + @SuppressWarnings("ResultOfMethodCallIgnored") + private void applyPermission(ChannelAction a) { overrides.forEachValue(override -> { if (override.isMemberOverride()) - a.addPermissionOverride(override.getMember(), override.getAllowedRaw(), override.getDeniedRaw()); + a.addMemberPermissionOverride(override.getIdLong(), override.getAllowedRaw(), override.getDeniedRaw()); else - a.addPermissionOverride(override.getRole(), override.getAllowedRaw(), override.getDeniedRaw()); + a.addRolePermissionOverride(override.getIdLong(), override.getAllowedRaw(), override.getDeniedRaw()); return true; }); } From 1126b705c6fd3c5fa9cc6527067664b4b960db15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 21 Jul 2020 02:27:38 +0200 Subject: [PATCH 014/121] Update WebSocket library to 2.10 This added a new copy constructor so we can cleanup some code --- build.gradle.kts | 4 ++-- .../jda/internal/audio/AudioWebSocket.java | 15 +++------------ .../jda/internal/requests/WebSocketClient.java | 15 +++------------ .../net/dv8tion/jda/internal/utils/IOUtil.java | 9 +++++++++ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c24ea71da5..a34b0dbe39 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.jfrog.bintray.gradle.BintrayExtension import com.jfrog.bintray.gradle.tasks.BintrayUploadTask import org.apache.tools.ant.filters.ReplaceTokens -import java.util.* +import java.util.Date plugins { signing @@ -67,7 +67,7 @@ dependencies { api("org.slf4j:slf4j-api:1.7.25") //Web Connection Support - api("com.neovisionaries:nv-websocket-client:2.9") + api("com.neovisionaries:nv-websocket-client:2.10") api("com.squareup.okhttp3:okhttp:3.13.0") //Opus library support 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 14a70e4210..5f7addfba7 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java @@ -120,18 +120,9 @@ protected void startConnection() try { - WebSocketFactory socketFactory = getJDA().getWebSocketFactory(); - //noinspection SynchronizationOnLocalVariableOrMethodParameter - synchronized (socketFactory) - { - String host = IOUtil.getHost(wssEndpoint); - // null if the host is undefined, unlikely but we should handle it - if (host != null) - socketFactory.setServerName(host); - else // practically should never happen - socketFactory.setServerNames(null); - socket = socketFactory.createSocket(wssEndpoint); - } + WebSocketFactory socketFactory = new WebSocketFactory(getJDA().getWebSocketFactory()); + IOUtil.setServerName(socketFactory, wssEndpoint); + socket = socketFactory.createSocket(wssEndpoint); socket.setDirectTextMessage(true); socket.addListener(this); changeStatus(ConnectionStatus.CONNECTING_AWAITING_WEBSOCKET_CONNECT); diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index 70ca707176..194493b583 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -358,18 +358,9 @@ protected synchronized void connect() try { - WebSocketFactory socketFactory = api.getWebSocketFactory(); - //noinspection SynchronizationOnLocalVariableOrMethodParameter - synchronized (socketFactory) - { - String host = IOUtil.getHost(url); - // null if the host is undefined, unlikely but we should handle it - if (host != null) - socketFactory.setServerName(host); - else // practically should never happen - socketFactory.setServerNames(null); - socket = socketFactory.createSocket(url); - } + WebSocketFactory socketFactory = new WebSocketFactory(api.getWebSocketFactory()); + IOUtil.setServerName(socketFactory, url); + socket = socketFactory.createSocket(url); socket.setDirectTextMessage(true); socket.addHeader("Accept-Encoding", "gzip") .addListener(this) diff --git a/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java index 2e06842385..ba8be28677 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.internal.utils; +import com.neovisionaries.ws.client.WebSocketFactory; import okhttp3.*; import okio.Okio; import org.slf4j.Logger; @@ -56,6 +57,14 @@ public static String getHost(String uri) return URI.create(uri).getHost(); } + public static void setServerName(WebSocketFactory factory, String url) + { + String host = getHost(url); + // null if the host is undefined, unlikely but we should handle it + if (host != null) + factory.setServerName(host); + } + public static OkHttpClient.Builder newHttpClientBuilder() { Dispatcher dispatcher = new Dispatcher(); From 50c3c587fe11f5159d4d7157c48004acc3310456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 25 Jul 2020 22:11:56 +0200 Subject: [PATCH 015/121] Fix problem with encoding non-ascii strings in ETF --- .../java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java index a999b023fb..0beb556186 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java @@ -152,7 +152,7 @@ private static ByteBuffer packBinary(ByteBuffer buffer, String value) byte[] encoded = value.getBytes(StandardCharsets.UTF_8); buffer = realloc(buffer, encoded.length * 4 + 5); buffer.put(BINARY); - buffer.putInt(value.length()); + buffer.putInt(encoded.length); buffer.put(encoded); return buffer; } From 676c21673ed2a331620c36671202dcbd46c0464f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 1 Jul 2020 22:32:43 +0200 Subject: [PATCH 016/121] Use createDefault in AudioEchoExample You can't cache voice states without member cache --- src/examples/java/AudioEchoExample.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/examples/java/AudioEchoExample.java b/src/examples/java/AudioEchoExample.java index 85d481dd15..d202bf9ce7 100644 --- a/src/examples/java/AudioEchoExample.java +++ b/src/examples/java/AudioEchoExample.java @@ -52,8 +52,8 @@ public static void main(String[] args) throws LoginException GatewayIntent.GUILD_VOICE_STATES ); - // Start the JDA session with light mode (minimal cache) - JDABuilder.createLight(token, intents) // Use provided token from command line arguments + // Start the JDA session with default mode (voice member cache) + JDABuilder.createDefault(token, intents) // Use provided token from command line arguments .addEventListeners(new AudioEchoExample()) // Start listening with this listener .setActivity(Activity.listening("to jams")) // Inform users that we are jammin' it out .setStatus(OnlineStatus.DO_NOT_DISTURB) // Please don't disturb us while we're jammin' From 3e732fe9051a7ae4f8b5cc9d79f227ffac4f7da5 Mon Sep 17 00:00:00 2001 From: caneleex Date: Sun, 5 Jul 2020 16:31:49 +0200 Subject: [PATCH 017/121] Mention the default for setMaxReconnectDelay --- src/main/java/net/dv8tion/jda/api/JDABuilder.java | 2 ++ .../dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index a908b179b8..e6228c0eba 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -1368,6 +1368,8 @@ public JDABuilder removeEventListeners(@Nonnull Object... listeners) * Sets the maximum amount of time that JDA will back off to wait when attempting to reconnect the MainWebsocket. *
Provided value must be 32 or greater. * + *

Default: {@code 900} + * * @param maxReconnectDelay * The maximum amount of time that JDA will wait between reconnect attempts in seconds. * diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index 08374adc18..47cbd8663a 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -1642,6 +1642,8 @@ public DefaultShardManagerBuilder setEventPoolProvider(@Nullable ThreadPoolProvi * Sets the maximum amount of time that JDA will back off to wait when attempting to reconnect the MainWebsocket. *
Provided value must be 32 or greater. * + *

Default: {@code 900} + * * @param maxReconnectDelay * The maximum amount of time that JDA will wait between reconnect attempts in seconds. * From e5bd532dda2a5e7dc1d6a37c9001be6a1c4d3fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 13 Jul 2020 09:31:36 +0200 Subject: [PATCH 018/121] Improve example for retrieveAuditLogs --- .../net/dv8tion/jda/api/entities/Guild.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) 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 82460b467c..8523ee0b5f 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -1984,21 +1984,21 @@ default RestAction retrieveBan(@Nonnull User bannedUser) * *

Examples

*

-     * public boolean isLogged(Guild guild, ActionType type, long targetId)
-     * {
-     *     for (AuditLogEntry entry : guild.retrieveAuditLogs().cache(false))
-     *     {
-     *         if (entry.getType() == type{@literal &&} entry.getTargetIdLong() == targetId)
-     *             return true; // The action is logged
-     *     }
-     *     return false; // nothing found in audit logs
-     * }
-     *
-     * public{@literal List} getActionsBy(Guild guild, User user)
-     * {
-     *     return guild.retrieveAuditLogs().cache(false).stream()
-     *         .filter(it{@literal ->} it.getUser().equals(user))
-     *         .collect(Collectors.toList()); // collects actions done by user
+     * public void logBan(GuildBanEvent event) {
+     *     Guild guild = event.getGuild();
+     *     List modLog = guild.getTextChannelsByName("mod-log", true);
+     *     guild.retrieveAuditLogs()
+     *          .type(ActionType.BAN) // filter by type
+     *          .limit(1)
+     *          .queue(list -> {
+     *             if (list.isEmpty()) return;
+     *             AuditLogEntry entry = list.get(0);
+     *             String message = String.format("%#s banned %#s with reason %s",
+     *                                            entry.getUser(), event.getUser(), entry.getReason());
+     *             modLog.forEach(channel ->
+     *               channel.sendMessage(message).queue()
+     *             );
+     *          });
      * }
      * 
* From 9b69382c183a0820985b13ecbb0074a4448474d3 Mon Sep 17 00:00:00 2001 From: Napster Date: Sun, 19 Jul 2020 13:58:06 +0200 Subject: [PATCH 019/121] Fix Discord domain in docs --- src/main/java/net/dv8tion/jda/api/Permission.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/Permission.java b/src/main/java/net/dv8tion/jda/api/Permission.java index 55dcac714c..1b13d76bc2 100644 --- a/src/main/java/net/dv8tion/jda/api/Permission.java +++ b/src/main/java/net/dv8tion/jda/api/Permission.java @@ -138,7 +138,7 @@ public String getName() /** * The binary offset of the permission. *
For more information about Discord's offset system refer to - * Discord Permissions. + * Discord Permissions. * * @return The offset that represents this {@link net.dv8tion.jda.api.Permission Permission}. */ From b01486f92b293488d2c70a56951f4d8f3608bbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 28 Jul 2020 15:00:08 +0200 Subject: [PATCH 020/121] Improve docs for audit logs --- .../dv8tion/jda/api/audit/AuditLogKey.java | 2 ++ .../dv8tion/jda/api/audit/AuditLogOption.java | 26 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java b/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java index 5335566f49..e6ea8b16c9 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java +++ b/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java @@ -25,6 +25,8 @@ *

Each constant in this enum has elaborate documentation on expected values for the * returned {@link AuditLogChange AuditLogChange}. *
There is no guarantee that the resulting type is accurate or that the value selected is not {@code null}! + * + * @see Audit Log Change Key */ public enum AuditLogKey { diff --git a/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java b/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java index cfc06834d3..76a063712c 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java +++ b/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java @@ -21,14 +21,23 @@ *
Providing detailed description of possible occasions and expected types. * *

The expected types are not guaranteed to be accurate! + * + * @see Optional Audit Entry Info */ public enum AuditLogOption { /** - * Possible detail for {@link net.dv8tion.jda.api.audit.ActionType#MESSAGE_DELETE ActionType.MESSAGE_DELETE} - * describing the amount of deleted messages. + * Possible detail for + *

    + *
  • {@link ActionType#MESSAGE_DELETE}
  • + *
  • {@link ActionType#MESSAGE_BULK_DELETE}
  • + *
  • {@link ActionType#MEMBER_VOICE_KICK}
  • + *
  • {@link ActionType#MEMBER_VOICE_MOVE}
  • + *
+ * describing the amount of targeted entities. + *
Use with {@link Integer#parseInt(String)}. * - *

Expected type: Integer + *

Expected type: String */ COUNT("count"), @@ -42,9 +51,14 @@ public enum AuditLogOption /** * Possible secondary target of an {@link net.dv8tion.jda.api.audit.ActionType ActionType} - * such as {@link net.dv8tion.jda.api.audit.ActionType#CHANNEL_OVERRIDE_CREATE ActionType.CHANNEL_OVERRIDE_CREATE} - *
Use with {@link net.dv8tion.jda.api.entities.Guild#getTextChannelById(String) Guild.getTextChannelById(String)} - * or similar method for {@link net.dv8tion.jda.api.entities.VoiceChannel VoiceChannels} + * such as: + *

    + *
  • {@link ActionType#MEMBER_VOICE_MOVE}
  • + *
  • {@link ActionType#MESSAGE_PIN}
  • + *
  • {@link ActionType#MESSAGE_UNPIN}
  • + *
  • {@link ActionType#MESSAGE_DELETE}
  • + *
+ * Use with {@link net.dv8tion.jda.api.entities.Guild#getGuildChannelById(String) Guild.getGuildChannelById(String)}. * *

Expected type: String */ From ce08dcea3c699d4c8db83d9db32e724d70bdd4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 29 Jul 2020 01:37:38 +0200 Subject: [PATCH 021/121] Switch to new permission key The old ones are now legacy --- .../net/dv8tion/jda/internal/entities/EntityBuilder.java | 6 +++--- .../dv8tion/jda/internal/handle/ChannelUpdateHandler.java | 4 ++-- .../dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index 621f72ccce..7fbe255b5f 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -1033,7 +1033,7 @@ public Role createRole(GuildImpl guild, DataObject roleJson, long guildId) final int color = roleJson.getInt("color"); role.setName(roleJson.getString("name")) .setRawPosition(roleJson.getInt("position")) - .setRawPermissions(roleJson.getLong("permissions")) + .setRawPermissions(roleJson.getLong("permissions_new")) .setManaged(roleJson.getBoolean("managed")) .setHoisted(roleJson.getBoolean("hoist")) .setColor(color == 0 ? Role.DEFAULT_COLOR_RAW : color) @@ -1382,8 +1382,8 @@ public PermissionOverride createPermissionOverride(DataObject override, Abstract if (!role && id != api.getSelfUser().getIdLong() && !api.isCacheFlagSet(CacheFlag.MEMBER_OVERRIDES)) return null; - long allow = override.getLong("allow"); - long deny = override.getLong("deny"); + long allow = override.getLong("allow_new"); + long deny = override.getLong("deny_new"); PermissionOverrideImpl permOverride = (PermissionOverrideImpl) chan.getOverrideMap().get(id); if (permOverride == null) diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java index ece197be12..2cc023a825 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java @@ -338,8 +338,8 @@ private void addPermissionHolder(List changed, Guild guild, l private boolean handlePermissionOverride(PermissionOverride currentOverride, DataObject override, long overrideId, AbstractChannelImpl channel) { - final long allow = override.getLong("allow"); - final long deny = override.getLong("deny"); + final long allow = override.getLong("allow_new"); + final long deny = override.getLong("deny_new"); final String type = override.getString("type"); final boolean isRole = type.equals("role"); if (!isRole) diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java index 1932461abb..0950bf56fe 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java @@ -61,7 +61,7 @@ protected Long handleInternally(DataObject content) if (color == 0) color = Role.DEFAULT_COLOR_RAW; int position = rolejson.getInt("position"); - long permissions = rolejson.getLong("permissions"); + long permissions = rolejson.getLong("permissions_new"); boolean hoisted = rolejson.getBoolean("hoist"); boolean mentionable = rolejson.getBoolean("mentionable"); From 202753141dbcd619695ec7c3477412b03bc529b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 29 Jul 2020 01:49:11 +0200 Subject: [PATCH 022/121] Fix some charset issues in ETF decoder --- .../net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java index 72afa851f0..7ad4524d0b 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java @@ -239,7 +239,7 @@ private static Object unpackAtom(ByteBuffer buffer, Charset charset) private static Object unpackAtom(ByteBuffer buffer, Charset charset, int length) { - String value = getString(buffer, StandardCharsets.ISO_8859_1, length); + String value = getString(buffer, charset, length); switch (value) { case "true": return true; @@ -249,11 +249,11 @@ private static Object unpackAtom(ByteBuffer buffer, Charset charset, int length) } } - private static String getString(ByteBuffer buffer, Charset encoding, int length) + private static String getString(ByteBuffer buffer, Charset charset, int length) { byte[] array = new byte[length]; buffer.get(array); - return new String(array, StandardCharsets.UTF_8); + return new String(array, charset); } private static List unpackList0(ByteBuffer buffer) From bfd18b62884ef4b2d1dd97879c368596a825b101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 2 Aug 2020 18:05:41 +0200 Subject: [PATCH 023/121] Add UserById wrapper (#1334) --- .../net/dv8tion/jda/api/entities/User.java | 84 +++++++- .../jda/internal/entities/UserById.java | 180 ++++++++++++++++++ .../jda/internal/entities/UserImpl.java | 37 +--- 3 files changed, 266 insertions(+), 35 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/internal/entities/UserById.java 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 423dd5ccc6..8c327ce083 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/User.java +++ b/src/main/java/net/dv8tion/jda/api/entities/User.java @@ -18,6 +18,8 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.requests.RestAction; +import net.dv8tion.jda.api.utils.MiscUtil; +import net.dv8tion.jda.internal.entities.UserById; import net.dv8tion.jda.internal.utils.Checks; import javax.annotation.CheckReturnValue; @@ -80,9 +82,49 @@ public interface User extends IMentionable, IFakeable /** Template for {@link #getDefaultAvatarUrl()} */ String DEFAULT_AVATAR_URL = "https://cdn.discordapp.com/embed/avatars/%s.png"; + /** + * Creates a User instance which only wraps an ID. + *
All other methods beside {@link #getIdLong()} and {@link #getId()} will throw {@link UnsupportedOperationException}. + * + * @param id + * The user id + * + * @return A user instance + * + * @see JDA#retrieveUserById(long) + */ + @Nonnull + static User fromId(long id) + { + return new UserById(id); + } + + /** + * Creates a User instance which only wraps an ID. + *
All other methods beside {@link #getIdLong()} and {@link #getId()} will throw {@link UnsupportedOperationException}. + * + * @param id + * The user id + * + * @throws IllegalArgumentException + * If the provided ID is not a valid snowflake + * + * @return A user instance + * + * @see JDA#retrieveUserById(String) + */ + @Nonnull + static User fromId(@Nonnull String id) + { + return fromId(MiscUtil.parseSnowflake(id)); + } + /** * The username of the {@link net.dv8tion.jda.api.entities.User User}. Length is between 2 and 32 characters (inclusive). * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Never-null String containing the {@link net.dv8tion.jda.api.entities.User User}'s username. */ @Nonnull @@ -91,6 +133,9 @@ public interface User extends IMentionable, IFakeable /** *
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 #. + * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} * Ex: 6297 * * @return Never-null String containing the {@link net.dv8tion.jda.api.entities.User User} discriminator. @@ -102,6 +147,9 @@ public interface User extends IMentionable, IFakeable * The Discord Id for this user's avatar image. * If the user has not set an image, this will return null. * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Possibly-null String containing the {@link net.dv8tion.jda.api.entities.User User} avatar id. */ @Nullable @@ -111,6 +159,9 @@ public interface User extends IMentionable, IFakeable * The URL for the user's avatar image. * If the user has not set an image, this will return null. * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Possibly-null String containing the {@link net.dv8tion.jda.api.entities.User User} avatar url. */ @Nullable @@ -123,6 +174,9 @@ default String getAvatarUrl() /** * The Discord Id for this user's default avatar image. * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Never-null String containing the {@link net.dv8tion.jda.api.entities.User User} default avatar id. */ @Nonnull @@ -131,6 +185,9 @@ default String getAvatarUrl() /** * The URL for the for the user's default avatar image. * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Never-null String containing the {@link net.dv8tion.jda.api.entities.User User} default avatar url. */ @Nonnull @@ -144,6 +201,9 @@ default String getDefaultAvatarUrl() * If they do not have an avatar set, this will return the URL of their * default avatar * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Never-null String containing the {@link net.dv8tion.jda.api.entities.User User} effective avatar url. */ @Nonnull @@ -157,6 +217,9 @@ default String getEffectiveAvatarUrl() * The "tag" for this user *

This is the equivalent of calling {@link java.lang.String#format(String, Object...) String.format}("%#s", user) * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Never-null String containing the tag for this user, for example DV8FromTheWorld#6297 */ @Nonnull @@ -166,6 +229,9 @@ default String getEffectiveAvatarUrl() * Whether or not the currently logged in user and this user have a currently open * {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel} or not. * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return True if the logged in account shares a PrivateChannel with this user. */ boolean hasPrivateChannel(); @@ -193,8 +259,9 @@ default String getEffectiveAvatarUrl() * } * } * - * @throws java.lang.UnsupportedOperationException + * @throws UnsupportedOperationException * If the recipient User is the currently logged in account (represented by {@link net.dv8tion.jda.api.entities.SelfUser SelfUser}) + * or if the user was created with {@link #fromId(long)} * * @return {@link net.dv8tion.jda.api.requests.RestAction RestAction} - Type: {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel} *
Retrieves the PrivateChannel to use to directly message this User. @@ -209,6 +276,9 @@ default String getEffectiveAvatarUrl() * Finds and collects all {@link net.dv8tion.jda.api.entities.Guild Guild} instances that contain this {@link net.dv8tion.jda.api.entities.User User} within the current {@link net.dv8tion.jda.api.JDA JDA} instance.
*

This method is a shortcut for {@link net.dv8tion.jda.api.JDA#getMutualGuilds(User...) JDA.getMutualGuilds(User)}.

* + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return Immutable list of all {@link net.dv8tion.jda.api.entities.Guild Guilds} that this user is a member of. */ @Nonnull @@ -217,6 +287,9 @@ default String getEffectiveAvatarUrl() /** * Returns whether or not the given user is a Bot-Account (special badge in client, some different behaviour) * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return If the User's Account is marked as Bot */ boolean isBot(); @@ -224,6 +297,9 @@ default String getEffectiveAvatarUrl() /** * Returns the {@link net.dv8tion.jda.api.JDA JDA} instance of this User * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} + * * @return the corresponding JDA instance */ @Nonnull @@ -231,6 +307,9 @@ default String getEffectiveAvatarUrl() /** * Returns the {@link net.dv8tion.jda.api.entities.User.UserFlag UserFlags} of this user. + * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} * * @return EnumSet containing the flags of the user. */ @@ -239,6 +318,9 @@ default String getEffectiveAvatarUrl() /** * Returns the bitmask representation of the {@link net.dv8tion.jda.api.entities.User.UserFlag UserFlags} of this user. + * + * @throws UnsupportedOperationException + * If this User was created with {@link #fromId(long)} * * @return bitmask representation of the user's flags. */ diff --git a/src/main/java/net/dv8tion/jda/internal/entities/UserById.java b/src/main/java/net/dv8tion/jda/internal/entities/UserById.java new file mode 100644 index 0000000000..0c2ce6c24c --- /dev/null +++ b/src/main/java/net/dv8tion/jda/internal/entities/UserById.java @@ -0,0 +1,180 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.internal.entities; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.PrivateChannel; +import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.requests.RestAction; +import org.jetbrains.annotations.Contract; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.EnumSet; +import java.util.List; + +public class UserById implements User +{ + protected final long id; + + public UserById(long id) + { + this.id = id; + } + + @Override + public long getIdLong() + { + return this.id; + } + + @Nonnull + @Override + public String getAsMention() + { + return "<@" + getId() + ">"; + } + + @Override + public int hashCode() + { + return Long.hashCode(id); + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + if (!(obj instanceof User)) + return false; + return ((User) obj).getIdLong() == this.id; + } + + @Override + public String toString() + { + return "U:(" + getId() + ')'; + } + + @Contract("->fail") + private void unsupported() + { + throw new UnsupportedOperationException("This User instance only wraps an ID. Other operations are unsupported"); + } + + @Nonnull + @Override + public String getName() + { + unsupported(); + return null; + } + + @Nonnull + @Override + public String getDiscriminator() + { + unsupported(); + return null; + } + + @Nullable + @Override + public String getAvatarId() + { + unsupported(); + return null; + } + + @Nonnull + @Override + public String getDefaultAvatarId() + { + unsupported(); + return null; + } + + @Nonnull + @Override + public String getAsTag() + { + unsupported(); + return null; + } + + @Override + public boolean hasPrivateChannel() + { + unsupported(); + return false; + } + + @Nonnull + @Override + public RestAction openPrivateChannel() + { + unsupported(); + return null; + } + + @Nonnull + @Override + public List getMutualGuilds() + { + unsupported(); + return null; + } + + @Override + public boolean isBot() + { + unsupported(); + return false; + } + + @Nonnull + @Override + public JDA getJDA() + { + unsupported(); + return null; + } + + @Nonnull + @Override + public EnumSet getFlags() + { + unsupported(); + return null; + } + + @Override + public int getFlagsRaw() + { + unsupported(); + return 0; + } + + @Override + public boolean isFake() + { + unsupported(); + return false; + } +} 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 d9237ccd01..9ad2bdbf53 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java @@ -33,9 +33,8 @@ import java.util.Formatter; import java.util.List; -public class UserImpl implements User +public class UserImpl extends UserById implements User { - protected final long id; protected final JDAImpl api; protected short discriminator; @@ -48,7 +47,7 @@ public class UserImpl implements User public UserImpl(long id, JDAImpl api) { - this.id = id; + super(id); this.api = api; } @@ -136,19 +135,6 @@ public JDAImpl getJDA() return api; } - @Nonnull - @Override - public String getAsMention() - { - return "<@" + getId() + '>'; - } - - @Override - public long getIdLong() - { - return id; - } - @Override public boolean isFake() { @@ -168,27 +154,10 @@ public int getFlagsRaw() return flags; } - @Override - public boolean equals(Object o) - { - if (o == this) - return true; - if (!(o instanceof UserImpl)) - return false; - UserImpl oUser = (UserImpl) o; - return this.id == oUser.id; - } - - @Override - public int hashCode() - { - return Long.hashCode(id); - } - @Override public String toString() { - return "U:" + getName() + '(' + id + ')'; + return "U:" + getName() + '(' + getId() + ')'; } // -- Setters -- From c92cd6cfb831128d916e86918c23bbc945198895 Mon Sep 17 00:00:00 2001 From: Daedalus Date: Tue, 4 Aug 2020 21:31:28 -0600 Subject: [PATCH 024/121] Make StoreChannel implement IMentionable (#1358) --- .../java/net/dv8tion/jda/api/entities/StoreChannel.java | 2 +- .../dv8tion/jda/internal/entities/StoreChannelImpl.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java b/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java index b27fadb9dc..a9359a5ec7 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java @@ -33,4 +33,4 @@ * @see JDA#getStoreChannelsByName(String, boolean) * @see JDA#getStoreChannelById(long) */ -public interface StoreChannel extends GuildChannel {} +public interface StoreChannel extends GuildChannel, IMentionable {} diff --git a/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java index fb107e6fdc..c5f8453a7f 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java @@ -38,6 +38,13 @@ public StoreChannelImpl setPosition(int rawPosition) return super.setPosition(rawPosition); } + @Nonnull + @Override + public String getAsMention() + { + return "<#" + id + '>'; + } + @Nonnull @Override public ChannelType getType() From 0f0fe96617e0788c30313ddd271c56775ffca788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 5 Aug 2020 14:14:35 +0200 Subject: [PATCH 025/121] Handle cloudflare rate limits (#1355) --- .../requests/ratelimit/BotRateLimiter.java | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java index 902c670c6b..c890df346f 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java @@ -229,8 +229,8 @@ private Bucket updateBucket(Route.CompiledRoute route, okhttp3.Response response Bucket bucket = getBucket(route, true); Headers headers = response.headers(); - boolean wasUnlimited = bucket.isUnlimited(); boolean global = headers.get(GLOBAL_HEADER) != null; + boolean cloudflare = headers.get("via") == null; String hash = headers.get(HASH_HEADER); long now = getNow(); @@ -247,28 +247,35 @@ private Bucket updateBucket(Route.CompiledRoute route, okhttp3.Response response bucket = getBucket(route, true); } - // Handle global rate limit if necessary - if (global) + if (response.code() == 429) { String retryAfterHeader = headers.get(RETRY_AFTER_HEADER); long retryAfter = parseLong(retryAfterHeader); - requester.getJDA().getSessionController().setGlobalRatelimit(now + retryAfter); - log.error("Encountered global rate limit! Retry-After: {} ms", retryAfter); - } - // Handle hard rate limit, pretty much just log that it happened - else if (response.code() == 429) - { - boolean firstHit = hitRatelimit.add(baseRoute); - // Update the bucket to the new information - String retryAfterHeader = headers.get(RETRY_AFTER_HEADER); - long retryAfter = parseLong(retryAfterHeader); - bucket.remaining = 0; - bucket.reset = getNow() + retryAfter; - // don't log warning if we hit the rate limit for the first time, likely due to initialization of the bucket - if (firstHit) - log.debug("Encountered 429 on route {} with bucket {} Retry-After: {} ms", baseRoute, bucket.bucketId, retryAfter); + // Handle global rate limit if necessary + if (global) + { + requester.getJDA().getSessionController().setGlobalRatelimit(now + retryAfter); + log.error("Encountered global rate limit! Retry-After: {} ms", retryAfter); + } + // Handle cloudflare rate limits, this applies to all routes and uses seconds for retry-after + else if (cloudflare) + { + requester.getJDA().getSessionController().setGlobalRatelimit(now + retryAfter * 1000); + log.error("Encountered cloudflare rate limit! Retry-After: {} s", retryAfter); + } + // Handle hard rate limit, pretty much just log that it happened else - log.warn("Encountered 429 on route {} with bucket {} Retry-After: {} ms", baseRoute, bucket.bucketId, retryAfter); + { + boolean firstHit = hitRatelimit.add(baseRoute); + // Update the bucket to the new information + bucket.remaining = 0; + bucket.reset = getNow() + retryAfter; + // don't log warning if we hit the rate limit for the first time, likely due to initialization of the bucket + if (firstHit) + log.debug("Encountered 429 on route {} with bucket {} Retry-After: {} ms", baseRoute, bucket.bucketId, retryAfter); + else + log.warn("Encountered 429 on route {} with bucket {} Retry-After: {} ms", baseRoute, bucket.bucketId, retryAfter); + } return bucket; } From 70240d16c8df46c63baf80357d95c5ec5605679f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 5 Aug 2020 20:07:54 +0200 Subject: [PATCH 026/121] Add support for guild locale (#1359) --- .../net/dv8tion/jda/api/entities/Guild.java | 8 +++ .../guild/update/GuildUpdateLocaleEvent.java | 55 +++++++++++++++++++ .../jda/api/hooks/ListenerAdapter.java | 3 + .../jda/internal/entities/EntityBuilder.java | 2 + .../jda/internal/entities/GuildImpl.java | 14 +++++ .../internal/handle/GuildUpdateHandler.java | 11 ++++ 6 files changed, 93 insertions(+) create mode 100644 src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java 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 82460b467c..36bbc82ff9 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -414,6 +414,14 @@ default String getVanityUrl() @Nullable String getDescription(); + /** + * The preferred locale for this guild. + * + * @return The preferred {@link Locale} for this guild + */ + @Nonnull + Locale getLocale(); + /** * The guild banner id. *
This is shown in guilds below the guild name. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java new file mode 100644 index 0000000000..cff15c685f --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.guild.update; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Guild; + +import javax.annotation.Nonnull; +import java.util.Locale; + +/** + * Indicates that the {@link Locale} of a {@link net.dv8tion.jda.api.entities.Guild Guild} changed. + * + *

Can be used to detect when a Locale changes and retrieve the old one + * + *

Identifier: {@code locale} + */ +@SuppressWarnings("ConstantConditions") +public class GuildUpdateLocaleEvent extends GenericGuildUpdateEvent +{ + public static final String IDENTIFIER = "locale"; + + public GuildUpdateLocaleEvent(@Nonnull JDA api, long responseNumber, @Nonnull Guild guild, @Nonnull Locale previous) + { + super(api, responseNumber, guild, previous, guild.getLocale(), IDENTIFIER); + } + + @Nonnull + @Override + public Locale getOldValue() + { + return super.getOldValue(); + } + + @Nonnull + @Override + public Locale getNewValue() + { + return super.getNewValue(); + } +} diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 9370cf6455..70a218cde0 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -274,6 +274,7 @@ public void onGuildUpdateOwner(@Nonnull GuildUpdateOwnerEvent event) {} public void onGuildUpdateRegion(@Nonnull GuildUpdateRegionEvent event) {} public void onGuildUpdateSplash(@Nonnull GuildUpdateSplashEvent event) {} public void onGuildUpdateVerificationLevel(@Nonnull GuildUpdateVerificationLevelEvent event) {} + public void onGuildUpdateLocale(@Nonnull GuildUpdateLocaleEvent event) {} public void onGuildUpdateFeatures(@Nonnull GuildUpdateFeaturesEvent event) {} public void onGuildUpdateVanityCode(@Nonnull GuildUpdateVanityCodeEvent event) {} public void onGuildUpdateBanner(@Nonnull GuildUpdateBannerEvent event) {} @@ -596,6 +597,8 @@ else if (event instanceof GuildUpdateSplashEvent) onGuildUpdateSplash((GuildUpdateSplashEvent) event); else if (event instanceof GuildUpdateVerificationLevelEvent) onGuildUpdateVerificationLevel((GuildUpdateVerificationLevelEvent) event); + else if (event instanceof GuildUpdateLocaleEvent) + onGuildUpdateLocale((GuildUpdateLocaleEvent) event); else if (event instanceof GuildUpdateFeaturesEvent) onGuildUpdateFeatures((GuildUpdateFeaturesEvent) event); else if (event instanceof GuildUpdateVanityCodeEvent) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index 7fbe255b5f..6336ab9b55 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -170,6 +170,7 @@ public GuildImpl createGuild(long guildId, DataObject guildJson, TLongObjectMap< final String description = guildJson.getString("description", null); final String vanityCode = guildJson.getString("vanity_url_code", null); final String bannerId = guildJson.getString("banner", null); + final String locale = guildJson.getString("preferred_locale", "en"); final DataArray roleArray = guildJson.getArray("roles"); final DataArray channelArray = guildJson.getArray("channels"); final DataArray emotesArray = guildJson.getArray("emojis"); @@ -205,6 +206,7 @@ public GuildImpl createGuild(long guildId, DataObject guildJson, TLongObjectMap< .setDefaultNotificationLevel(Guild.NotificationLevel.fromKey(notificationLevel)) .setExplicitContentLevel(Guild.ExplicitContentLevel.fromKey(explicitContentLevel)) .setRequiredMFALevel(Guild.MFALevel.fromKey(mfaLevel)) + .setLocale(locale) .setBoostCount(boostCount) .setBoostTier(boostTier) .setMemberCount(memberCount); diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index a1449f0b88..30c1a9ab4d 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -111,6 +111,7 @@ public class GuildImpl implements Guild private ExplicitContentLevel explicitContentLevel = ExplicitContentLevel.UNKNOWN; private Timeout afkTimeout; private BoostTier boostTier = BoostTier.NONE; + private Locale preferredLocale = Locale.ENGLISH; private boolean available; private boolean canSendVerification = false; private int memberCount; @@ -249,6 +250,13 @@ public String getDescription() return description; } + @Nonnull + @Override + public Locale getLocale() + { + return preferredLocale; + } + @Nullable @Override public String getBannerId() @@ -1581,6 +1589,12 @@ public GuildImpl setAfkTimeout(Timeout afkTimeout) return this; } + public GuildImpl setLocale(String locale) + { + this.preferredLocale = Locale.forLanguageTag(locale); + return this; + } + public GuildImpl setBoostTier(int tier) { this.boostTier = BoostTier.fromKey(tier); diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java index 8a7b37cb2b..812ccdd6ae 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java @@ -27,6 +27,7 @@ import net.dv8tion.jda.internal.requests.WebSocketClient; import java.util.Collections; +import java.util.Locale; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -80,6 +81,7 @@ protected Long handleInternally(DataObject content) Guild.MFALevel mfaLevel = Guild.MFALevel.fromKey(content.getInt("mfa_level")); Guild.ExplicitContentLevel explicitContentLevel = Guild.ExplicitContentLevel.fromKey(content.getInt("explicit_content_filter")); Guild.Timeout afkTimeout = Guild.Timeout.fromKey(content.getInt("afk_timeout")); + Locale locale = Locale.forLanguageTag(content.getString("preferred_locale")); VoiceChannel afkChannel = content.isNull("afk_channel_id") ? null : guild.getVoiceChannelsView().get(content.getLong("afk_channel_id")); TextChannel systemChannel = content.isNull("system_channel_id") @@ -263,6 +265,15 @@ protected Long handleInternally(DataObject content) getJDA(), responseNumber, guild, oldAfkTimeout)); } + if (!Objects.equals(locale, guild.getLocale())) + { + Locale oldLocale = guild.getLocale(); + guild.setLocale(locale.toLanguageTag()); + getJDA().handleEvent( + new GuildUpdateLocaleEvent( + getJDA(), responseNumber, + guild, oldLocale)); + } if (!Objects.equals(afkChannel, guild.getAfkChannel())) { VoiceChannel oldAfkChannel = guild.getAfkChannel(); From a9e4ded7dd47608d905389af943cf92e70a7d6a5 Mon Sep 17 00:00:00 2001 From: caneleex Date: Fri, 7 Aug 2020 21:25:57 +0200 Subject: [PATCH 027/121] Fix typo in GuildJoinEvent docs --- .../java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java index a2635c1169..40df1ea4a1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java @@ -22,7 +22,7 @@ /** * Indicates that you joined a {@link net.dv8tion.jda.api.entities.Guild Guild}. - *
This requires that the guild is available when the guild leave happens. Otherwise a {@link UnavailableGuildJoinedEvent} is fired instead. + *
This requires that the guild is available when the guild join happens. Otherwise a {@link UnavailableGuildJoinedEvent} is fired instead. * *

Warning: Discord already triggered a mass amount of these events due to a downtime. Be careful! * From 9240d585e0b0456feac6c7a044bd10adb0fe050f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 8 Aug 2020 18:25:30 +0200 Subject: [PATCH 028/121] Add some convenience methods to GenericGuildMessageReactionEvent (#1364) * Add some convenience methods to GenericGuildMessageReactionEvent * Improve handling of dm reactions --- .../GenericGuildMessageReactionEvent.java | 58 +++++++++++++++++-- .../GenericPrivateMessageReactionEvent.java | 8 +-- .../react/PrivateMessageReactionAddEvent.java | 6 +- .../PrivateMessageReactionRemoveEvent.java | 6 +- .../react/GenericMessageReactionEvent.java | 16 ++--- .../handle/MessageReactionHandler.java | 4 +- 6 files changed, 72 insertions(+), 26 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java index 6e8432791e..81cf0229aa 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java @@ -17,12 +17,12 @@ package net.dv8tion.jda.api.events.message.guild.react; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.MessageReaction; -import net.dv8tion.jda.api.entities.TextChannel; -import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.events.message.guild.GenericGuildMessageEvent; +import net.dv8tion.jda.api.requests.RestAction; +import net.dv8tion.jda.internal.requests.CompletedRestAction; +import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -114,4 +114,54 @@ public MessageReaction.ReactionEmote getReactionEmote() { return reaction.getReactionEmote(); } + + /** + * Retrieves the {@link User} who added or removed the reaction. + *
If a user is known, this will return {@link #getUser()}. + * + * @return {@link RestAction} - Type: {@link User} + */ + @Nonnull + @CheckReturnValue + public RestAction retrieveUser() + { + if (issuer != null) + return new CompletedRestAction<>(getJDA(), issuer.getUser()); + return getJDA().retrieveUserById(getUserIdLong()); + } + + /** + * Retrieves the {@link Member} who added or removed the reaction. + *
If a member is known, this will return {@link #getMember()}. + * + *

Note that banning a member will also fire {@link GuildMessageReactionRemoveEvent} and no member will be available + * in those cases. An {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MEMBER UNKNOWN_MEMBER} error response + * should be the failure result. + * + * @return {@link RestAction} - Type: {@link Member} + */ + @Nonnull + @CheckReturnValue + public RestAction retrieveMember() + { + if (issuer != null) + return new CompletedRestAction<>(getJDA(), issuer); + return getGuild().retrieveMemberById(getUserIdLong()); + } + + /** + * Retrieves the message for this reaction event. + *
Simple shortcut for {@code getChannel().retrieveMessageById(getMessageId())}. + * + *

The {@link Message#getMember() Message.getMember()} method will always return null for the resulting message. + * You can, instead, retrieve the member via {@link #getMember()} or {@link #retrieveMember()}. + * + * @return {@link RestAction} - Type: {@link Message} + */ + @Nonnull + @CheckReturnValue + public RestAction retrieveMessage() + { + return getChannel().retrieveMessageById(getMessageId()); + } } diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java index 6c63f0d634..f476d26029 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java @@ -33,14 +33,12 @@ public class GenericPrivateMessageReactionEvent extends GenericPrivateMessageEvent { protected final long userId; - protected final User issuer; protected final MessageReaction reaction; - public GenericPrivateMessageReactionEvent(@Nonnull JDA api, long responseNumber, @Nullable User user, @Nonnull MessageReaction reaction, long userId) + public GenericPrivateMessageReactionEvent(@Nonnull JDA api, long responseNumber, @Nonnull MessageReaction reaction, long userId) { super(api, responseNumber, reaction.getMessageIdLong(), (PrivateChannel) reaction.getChannel()); this.userId = userId; - this.issuer = user; this.reaction = reaction; } @@ -74,7 +72,9 @@ public long getUserIdLong() @Nullable public User getUser() { - return issuer; + return userId == getJDA().getSelfUser().getIdLong() + ? getJDA().getSelfUser() + : getChannel().getUser(); } /** diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java index cb2a97b4e8..f1f3811893 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java @@ -18,10 +18,8 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.MessageReaction; -import net.dv8tion.jda.api.entities.User; import javax.annotation.Nonnull; -import javax.annotation.Nullable; /** * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was added to a Message in a PrivateChannel. @@ -30,8 +28,8 @@ */ public class PrivateMessageReactionAddEvent extends GenericPrivateMessageReactionEvent { - public PrivateMessageReactionAddEvent(@Nonnull JDA api, long responseNumber, @Nullable User user, @Nonnull MessageReaction reaction, long userId) + public PrivateMessageReactionAddEvent(@Nonnull JDA api, long responseNumber, @Nonnull MessageReaction reaction, long userId) { - super(api, responseNumber, user, reaction, userId); + super(api, responseNumber, reaction, userId); } } diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java index e6feff2fcd..ff722a8586 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java @@ -18,10 +18,8 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.MessageReaction; -import net.dv8tion.jda.api.entities.User; import javax.annotation.Nonnull; -import javax.annotation.Nullable; /** * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was removed from a Message in a PrivateChannel. @@ -30,8 +28,8 @@ */ public class PrivateMessageReactionRemoveEvent extends GenericPrivateMessageReactionEvent { - public PrivateMessageReactionRemoveEvent(@Nonnull JDA api, long responseNumber, @Nullable User user, @Nonnull MessageReaction reaction, long userId) + public PrivateMessageReactionRemoveEvent(@Nonnull JDA api, long responseNumber, @Nonnull MessageReaction reaction, long userId) { - super(api, responseNumber, user, reaction, userId); + super(api, responseNumber, reaction, userId); } } diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java index 86c9878982..ff463a205c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java @@ -17,10 +17,7 @@ package net.dv8tion.jda.api.events.message.react; import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.MessageReaction; -import net.dv8tion.jda.api.entities.User; +import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.events.message.GenericMessageEvent; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.internal.requests.CompletedRestAction; @@ -42,7 +39,7 @@ public class GenericMessageReactionEvent extends GenericMessageEvent protected Member member; protected MessageReaction reaction; - public GenericMessageReactionEvent(@Nonnull JDA api, long responseNumber, @Nonnull User user, + public GenericMessageReactionEvent(@Nonnull JDA api, long responseNumber, @Nullable User user, @Nullable Member member, @Nonnull MessageReaction reaction, long userId) { super(api, responseNumber, reaction.getMessageIdLong(), reaction.getChannel()); @@ -82,7 +79,9 @@ public long getUserIdLong() @Nullable public User getUser() { - return issuer; + return issuer == null && isFromType(ChannelType.PRIVATE) + ? getPrivateChannel().getUser() // this can't be the self user because then issuer would be nonnull + : null; } /** @@ -136,8 +135,9 @@ public MessageReaction.ReactionEmote getReactionEmote() @CheckReturnValue public RestAction retrieveUser() { - if (issuer != null) - return new CompletedRestAction<>(getJDA(), issuer); + User user = getUser(); + if (user != null) + return new CompletedRestAction<>(getJDA(), user); return getJDA().retrieveUserById(getUserIdLong()); } diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java index da900045be..74b366cb0f 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java @@ -162,7 +162,7 @@ private void onAdd(MessageReaction reaction, User user, Member member, long user jda.handleEvent( new PrivateMessageReactionAddEvent( jda, responseNumber, - user, reaction, userId)); + reaction, userId)); break; case GROUP: WebSocketClient.LOG.debug("Received a reaction add for a group which should not be possible"); @@ -190,7 +190,7 @@ private void onRemove(MessageReaction reaction, User user, Member member, long u jda.handleEvent( new PrivateMessageReactionRemoveEvent( jda, responseNumber, - user, reaction, userId)); + reaction, userId)); break; case GROUP: WebSocketClient.LOG.debug("Received a reaction remove for a group which should not be possible"); From 26f7800b8444754dc3d018be51062e78a743f3cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 9 Aug 2020 23:13:14 +0200 Subject: [PATCH 029/121] Fix ConcurrentModificationException in WebSocketClient --- .../internal/requests/WebSocketClient.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index 194493b583..8777dfe53e 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -62,6 +62,7 @@ import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -1240,15 +1241,12 @@ protected ConnectionRequest getNextAudioConnectRequest() return null; long now = System.currentTimeMillis(); - TLongObjectIterator it = queuedAudioConnections.iterator(); - while (it.hasNext()) + AtomicReference request = new AtomicReference<>(); + queuedAudioConnections.retainEntries((guildId, audioRequest) -> // we use this because it locks the mutex { - it.advance(); - ConnectionRequest audioRequest = it.value(); if (audioRequest.getNextAttemptEpoch() < now) { // Check if the guild is ready - long guildId = audioRequest.getGuildIdLong(); Guild guild = api.getGuildById(guildId); if (guild == null) { @@ -1258,37 +1256,37 @@ protected ConnectionRequest getNextAudioConnectRequest() { // The guild is not tracked anymore -> we can't connect the audio channel LOG.debug("Removing audio connection request because the guild has been removed. {}", audioRequest); - it.remove(); + return false; } - continue; + return true; } ConnectionListener listener = guild.getAudioManager().getConnectionListener(); if (audioRequest.getStage() != ConnectionStage.DISCONNECT) { + // Check if we can connect to the target channel VoiceChannel channel = guild.getVoiceChannelById(audioRequest.getChannelId()); if (channel == null) { - it.remove(); if (listener != null) listener.onStatusChange(ConnectionStatus.DISCONNECTED_CHANNEL_DELETED); - continue; + return false; } if (!guild.getSelfMember().hasPermission(channel, Permission.VOICE_CONNECT)) { - it.remove(); if (listener != null) listener.onStatusChange(ConnectionStatus.DISCONNECTED_LOST_PERMISSION); - continue; + return false; } } - - return audioRequest; + // This will take the first result + request.compareAndSet(null, audioRequest); } - } + return true; + }); - return null; + return request.get(); } public Map getHandlers() From 995495c0eff5693134bc4ab8a0bb98e84480c8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Fri, 14 Aug 2020 07:22:34 +0200 Subject: [PATCH 030/121] Improve transitivity of DeferredRestAction This fixes a bug where reasons would not be applied sometimes --- .../dv8tion/jda/internal/requests/DeferredRestAction.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java index b97ce04ca5..db5dddb840 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java @@ -20,6 +20,7 @@ import net.dv8tion.jda.api.exceptions.RateLimitedException; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; +import net.dv8tion.jda.internal.utils.Checks; import javax.annotation.Nonnull; import java.util.concurrent.CompletableFuture; @@ -35,6 +36,7 @@ public class DeferredRestAction> implements Auditable private final Supplier valueSupplier; private final Supplier actionSupplier; + private String reason; private long deadline = -1; private BooleanSupplier isAction; private BooleanSupplier transitiveChecks; @@ -65,6 +67,7 @@ public JDA getJDA() @Override public AuditableRestAction reason(String reason) { + this.reason = reason; return this; } @@ -80,7 +83,8 @@ public AuditableRestAction setCheck(BooleanSupplier checks) @Override public AuditableRestAction timeout(long timeout, @Nonnull TimeUnit unit) { - return this; + Checks.notNull(unit, "TimeUnit"); + return deadline(timeout <= 0 ? 0 : System.currentTimeMillis() + unit.toMillis(timeout)); } @Nonnull @@ -166,6 +170,8 @@ private R getAction() action.setCheck(transitiveChecks); if (deadline >= 0) action.deadline(deadline); + if (action instanceof AuditableRestAction && reason != null) + ((AuditableRestAction) action).reason(reason); return action; } } From 2b2d8cd5c48c5eeecc6c515e0f4a3110691654f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Fri, 14 Aug 2020 10:28:36 +0200 Subject: [PATCH 031/121] Fix issue with unexpected null in MessageReactionAddEvent#getUser --- .../api/events/message/react/GenericMessageReactionEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java index ff463a205c..775e46c2ce 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java @@ -81,7 +81,7 @@ public User getUser() { return issuer == null && isFromType(ChannelType.PRIVATE) ? getPrivateChannel().getUser() // this can't be the self user because then issuer would be nonnull - : null; + : issuer; } /** From d2f1a8e97a25b6b86e817c2ce47b7c820728b802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 16 Aug 2020 22:45:48 +0200 Subject: [PATCH 032/121] Replace SnowflakeReference (#1344) --- .../entities/AbstractChannelImpl.java | 10 +++-- .../jda/internal/entities/EmoteImpl.java | 13 +++--- .../entities/GuildVoiceStateImpl.java | 19 +++++---- .../jda/internal/entities/MemberImpl.java | 21 +++++----- .../entities/PermissionOverrideImpl.java | 12 +++--- .../jda/internal/entities/RoleImpl.java | 10 +++-- .../internal/managers/ChannelManagerImpl.java | 10 +++-- .../internal/managers/GuildManagerImpl.java | 10 +++-- .../managers/PermOverrideManagerImpl.java | 40 +++++-------------- .../internal/managers/RoleManagerImpl.java | 10 +++-- .../utils/cache/SnowflakeReference.java | 3 ++ 11 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java index 4e415ec716..c58d06c17b 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java @@ -38,7 +38,6 @@ import net.dv8tion.jda.internal.requests.restaction.InviteActionImpl; import net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl; import net.dv8tion.jda.internal.utils.Checks; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -51,7 +50,6 @@ public abstract class AbstractChannelImpl> implements GuildChannel { protected final long id; - protected final SnowflakeReference guild; protected final JDAImpl api; protected final TLongObjectMap overrides = MiscUtil.newLongMap(); @@ -59,6 +57,7 @@ public abstract class AbstractChannelImpl(guild, api::getGuildById); + this.guild = guild; } @Override @@ -103,7 +102,10 @@ public String getName() @Override public GuildImpl getGuild() { - return (GuildImpl) guild.resolve(); + GuildImpl realGuild = (GuildImpl) api.getGuildById(guild.getIdLong()); + if (realGuild != null) + guild = realGuild; + return guild; } @Override diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java index 4fa8b6923a..2790c738d7 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java @@ -17,7 +17,6 @@ package net.dv8tion.jda.internal.entities; import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.ListedEmote; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; @@ -29,7 +28,6 @@ import net.dv8tion.jda.internal.managers.EmoteManagerImpl; import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import javax.annotation.Nonnull; import java.util.Collections; @@ -47,13 +45,13 @@ public class EmoteImpl implements ListedEmote { private final long id; - private final SnowflakeReference guild; private final JDAImpl api; private final Set roles; private final ReentrantLock mngLock = new ReentrantLock(); private volatile EmoteManager manager = null; + private GuildImpl guild; private boolean managed = false; private boolean available = true; private boolean animated = false; @@ -69,7 +67,7 @@ public EmoteImpl(long id, GuildImpl guild, boolean fake) { this.id = id; this.api = guild.getJDA(); - this.guild = new SnowflakeReference<>(guild, api::getGuildById); + this.guild = guild; this.roles = ConcurrentHashMap.newKeySet(); } @@ -84,7 +82,12 @@ public EmoteImpl(long id, JDAImpl api) @Override public GuildImpl getGuild() { - return guild == null ? null : (GuildImpl) guild.resolve(); + if (guild == null) + return null; + GuildImpl realGuild = (GuildImpl) api.getGuildById(guild.getIdLong()); + if (realGuild != null) + guild = realGuild; + return guild; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java index 05ad244360..c6d2e92cf1 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java @@ -21,15 +21,14 @@ import net.dv8tion.jda.api.entities.GuildVoiceState; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.VoiceChannel; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import javax.annotation.Nonnull; public class GuildVoiceStateImpl implements GuildVoiceState { - private final SnowflakeReference guild; - private final SnowflakeReference member; private final JDA api; + private Guild guild; + private Member member; private VoiceChannel connectedChannel; private String sessionId; @@ -43,8 +42,8 @@ public class GuildVoiceStateImpl implements GuildVoiceState public GuildVoiceStateImpl(Member member) { this.api = member.getJDA(); - this.guild = new SnowflakeReference<>(member.getGuild(), api::getGuildById); - this.member = new SnowflakeReference<>(member, (id) -> guild.resolve().getMemberById(id)); + this.guild = member.getGuild(); + this.member = member; } @Override @@ -118,14 +117,20 @@ public VoiceChannel getChannel() @Override public Guild getGuild() { - return this.guild.resolve(); + Guild realGuild = api.getGuildById(guild.getIdLong()); + if (realGuild != null) + guild = realGuild; + return guild; } @Nonnull @Override public Member getMember() { - return this.member.resolve(); + Member realMember = getGuild().getMemberById(member.getIdLong()); + if (realMember != null) + member = realMember; + return member; } @Override diff --git a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java index 34c544880a..d046a61e49 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java @@ -24,7 +24,6 @@ import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.utils.Checks; import net.dv8tion.jda.internal.utils.PermissionUtil; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -39,12 +38,12 @@ public class MemberImpl implements Member { private static final ZoneOffset OFFSET = ZoneOffset.of("+00:00"); - private final SnowflakeReference guild; private final JDAImpl api; private final Set roles = ConcurrentHashMap.newKeySet(); private final GuildVoiceState voiceState; private final Map clientStatus; + private GuildImpl guild; private User user; private String nickname; private long joinDate, boostDate; @@ -54,7 +53,7 @@ public class MemberImpl implements Member public MemberImpl(GuildImpl guild, User user) { this.api = (JDAImpl) user.getJDA(); - this.guild = new SnowflakeReference<>(guild, api::getGuildById); + this.guild = guild; this.user = user; this.joinDate = 0; boolean cacheState = api.isCacheFlagSet(CacheFlag.VOICE_STATE) || user.equals(api.getSelfUser()); @@ -63,19 +62,14 @@ public MemberImpl(GuildImpl guild, User user) this.clientStatus = cacheOnline ? Collections.synchronizedMap(new EnumMap<>(ClientType.class)) : null; } - private void updateUser() + @Nonnull + @Override + public User getUser() { // Load user from cache if one exists, ideally two members with the same id should wrap the same user object User realUser = getJDA().getUserById(user.getIdLong()); if (realUser != null) this.user = realUser; - } - - @Nonnull - @Override - public User getUser() - { - updateUser(); return user; } @@ -83,7 +77,10 @@ public User getUser() @Override public GuildImpl getGuild() { - return (GuildImpl) guild.resolve(); + GuildImpl realGuild = (GuildImpl) api.getGuildById(guild.getIdLong()); + if (realGuild != null) + guild = realGuild; + return guild; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java index efdffb42e1..8e4638ebb1 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java @@ -28,7 +28,6 @@ import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl; import net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import javax.annotation.Nonnull; import java.util.EnumSet; @@ -38,10 +37,9 @@ public class PermissionOverrideImpl implements PermissionOverride { private final long id; - private final SnowflakeReference channel; - private final ChannelType channelType; private final boolean isRole; private final JDAImpl api; + private GuildChannel channel; protected final ReentrantLock mngLock = new ReentrantLock(); protected volatile PermissionOverrideAction manager; @@ -52,9 +50,8 @@ public class PermissionOverrideImpl implements PermissionOverride public PermissionOverrideImpl(GuildChannel channel, long id, boolean isRole) { this.isRole = isRole; - this.channelType = channel.getType(); this.api = (JDAImpl) channel.getJDA(); - this.channel = new SnowflakeReference<>(channel, (channelId) -> api.getGuildChannelById(channelType, channelId)); + this.channel = channel; this.id = id; } @@ -126,7 +123,10 @@ public Role getRole() @Override public GuildChannel getChannel() { - return channel.resolve(); + GuildChannel realChannel = api.getGuildChannelById(channel.getType(), channel.getIdLong()); + if (realChannel != null) + channel = realChannel; + return channel; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java index 50533a0d56..2dfb7db255 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java @@ -33,7 +33,6 @@ import net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl; import net.dv8tion.jda.internal.utils.Checks; import net.dv8tion.jda.internal.utils.PermissionUtil; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import net.dv8tion.jda.internal.utils.cache.SortedSnowflakeCacheViewImpl; import javax.annotation.Nonnull; @@ -46,8 +45,8 @@ public class RoleImpl implements Role { private final long id; - private final SnowflakeReference guild; private final JDAImpl api; + private Guild guild; private final ReentrantLock mngLock = new ReentrantLock(); private volatile RoleManager manager; @@ -64,7 +63,7 @@ public RoleImpl(long id, Guild guild) { this.id = id; this.api =(JDAImpl) guild.getJDA(); - this.guild = new SnowflakeReference<>(guild, api::getGuildById); + this.guild = guild; } @Override @@ -220,7 +219,10 @@ public boolean canInteract(@Nonnull Role role) @Override public Guild getGuild() { - return guild.resolve(); + Guild realGuild = api.getGuildById(guild.getIdLong()); + if (realGuild != null) + guild = realGuild; + return guild; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java index 3c364756d9..4b7c1bef14 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java @@ -30,7 +30,6 @@ import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.requests.restaction.PermOverrideData; import net.dv8tion.jda.internal.utils.Checks; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import okhttp3.RequestBody; import javax.annotation.CheckReturnValue; @@ -39,7 +38,7 @@ public class ChannelManagerImpl extends ManagerBase implements ChannelManager { - protected final SnowflakeReference channel; + protected GuildChannel channel; protected String name; protected String parent; @@ -67,7 +66,7 @@ public ChannelManagerImpl(GuildChannel channel) Route.Channels.MODIFY_CHANNEL.compile(channel.getId())); JDA jda = channel.getJDA(); ChannelType type = channel.getType(); - this.channel = new SnowflakeReference<>(channel, (channelId) -> jda.getGuildChannelById(type, channelId)); + this.channel = channel; if (isPermissionChecksEnabled()) checkPermissions(); this.overridesAdd = new TLongObjectHashMap<>(); @@ -78,7 +77,10 @@ public ChannelManagerImpl(GuildChannel channel) @Override public GuildChannel getChannel() { - return channel.resolve(); + GuildChannel realChannel = api.getGuildChannelById(channel.getType(), channel.getIdLong()); + if (realChannel != null) + channel = realChannel; + return channel; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java index 4cb465dacc..67ce21b20c 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java @@ -28,7 +28,6 @@ import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.utils.Checks; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import okhttp3.RequestBody; import javax.annotation.CheckReturnValue; @@ -37,7 +36,7 @@ public class GuildManagerImpl extends ManagerBase implements GuildManager { - protected final SnowflakeReference guild; + protected Guild guild; protected String name; protected String region; @@ -54,7 +53,7 @@ public GuildManagerImpl(Guild guild) { super(guild.getJDA(), Route.Guilds.MODIFY_GUILD.compile(guild.getId())); JDA api = guild.getJDA(); - this.guild = new SnowflakeReference<>(guild, api::getGuildById); + this.guild = guild; if (isPermissionChecksEnabled()) checkPermissions(); } @@ -63,7 +62,10 @@ public GuildManagerImpl(Guild guild) @Override public Guild getGuild() { - return guild.resolve(); + Guild realGuild = api.getGuildById(guild.getIdLong()); + if (realGuild != null) + guild = realGuild; + return guild; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java index 2096bde806..c7c3c4260f 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java @@ -16,15 +16,16 @@ package net.dv8tion.jda.internal.managers; -import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.GuildChannel; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.PermissionOverride; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.managers.PermOverrideManager; import net.dv8tion.jda.api.utils.data.DataObject; +import net.dv8tion.jda.internal.entities.AbstractChannelImpl; import net.dv8tion.jda.internal.requests.Route; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import okhttp3.RequestBody; import javax.annotation.CheckReturnValue; @@ -32,8 +33,8 @@ public class PermOverrideManagerImpl extends ManagerBase implements PermOverrideManager { - protected final SnowflakeReference override; protected final boolean role; + protected PermissionOverride override; protected long allowed; protected long denied; @@ -49,7 +50,7 @@ public PermOverrideManagerImpl(PermissionOverride override) super(override.getJDA(), Route.Channels.MODIFY_PERM_OVERRIDE.compile( override.getChannel().getId(), override.getId())); - this.override = setupReferent(override); + this.override = override; this.role = override.isRoleOverride(); this.allowed = override.getAllowedRaw(); this.denied = override.getDeniedRaw(); @@ -57,29 +58,6 @@ public PermOverrideManagerImpl(PermissionOverride override) checkPermissions(); } - private SnowflakeReference setupReferent(PermissionOverride override) - { - JDA api = override.getJDA(); - GuildChannel channel = override.getChannel(); - long channelId = channel.getIdLong(); - ChannelType type = channel.getType(); - boolean role = override.isRoleOverride(); - return new SnowflakeReference<>(override, (holderId) -> { - GuildChannel targetChannel = api.getGuildChannelById(type, channelId); - if (targetChannel == null) - return null; - Guild guild = targetChannel.getGuild(); - IPermissionHolder holder; - if (role) - holder = guild.getRoleById(holderId); - else - holder = guild.getMemberById(holderId); - if (holder == null) - return null; - return targetChannel.getPermissionOverride(holder); - }); - } - private void setupValues() { if (!shouldUpdate(ALLOWED)) @@ -92,7 +70,11 @@ private void setupValues() @Override public PermissionOverride getPermissionOverride() { - return override.resolve(); + AbstractChannelImpl channel = (AbstractChannelImpl) override.getChannel(); + PermissionOverride realOverride = channel.getOverrideMap().get(override.getIdLong()); + if (realOverride != null) + override = realOverride; + return override; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java index ec581af0f6..b3486263f4 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java @@ -27,7 +27,6 @@ import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.utils.Checks; import net.dv8tion.jda.internal.utils.PermissionUtil; -import net.dv8tion.jda.internal.utils.cache.SnowflakeReference; import okhttp3.RequestBody; import javax.annotation.CheckReturnValue; @@ -37,7 +36,7 @@ public class RoleManagerImpl extends ManagerBase implements RoleManager { - protected final SnowflakeReference role; + protected Role role; protected String name; protected int color; @@ -55,7 +54,7 @@ public RoleManagerImpl(Role role) { super(role.getJDA(), Route.Roles.MODIFY_ROLE.compile(role.getGuild().getId(), role.getId())); JDA api = role.getJDA(); - this.role = new SnowflakeReference<>(role, api::getRoleById); + this.role = role; if (isPermissionChecksEnabled()) checkPermissions(); } @@ -64,7 +63,10 @@ public RoleManagerImpl(Role role) @Override public Role getRole() { - return role.resolve(); + Role realRole = role.getGuild().getRoleById(role.getIdLong()); + if (realRole != null) + role = realRole; + return role; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java index ec295da42d..76fa690451 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java @@ -16,12 +16,15 @@ package net.dv8tion.jda.internal.utils.cache; +import net.dv8tion.jda.annotations.ForRemoval; import net.dv8tion.jda.api.entities.ISnowflake; import javax.annotation.Nonnull; import java.lang.ref.WeakReference; import java.util.function.LongFunction; +@ForRemoval +@Deprecated public class SnowflakeReference implements ISnowflake { private final LongFunction fallbackProvider; From 305d010b4db17ac25b5d5f7d0698c7ea1ffa568f Mon Sep 17 00:00:00 2001 From: caneleex Date: Fri, 14 Aug 2020 10:54:44 +0200 Subject: [PATCH 033/121] Change wording of OrderAction#sortOrder to match other methods --- .../jda/api/requests/restaction/order/OrderAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java index 3c9509e224..678bf52381 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java @@ -251,8 +251,8 @@ public interface OrderAction> extends RestAction< /** * Sorts the {@link #getCurrentOrder() current order} based on - * the specified {@link java.util.Comparator Comparator}. - *
Using {@link java.util.ArrayList#sort(java.util.Comparator) ArrayList.sort(comparator)} + * the specified {@link java.util.Comparator Comparator} by using + * {@link java.util.ArrayList#sort(java.util.Comparator) ArrayList.sort(comparator)} * * @param comparator * Comparator used to sort the current order From 67851e476615c2a21af04b839818936c6c30c397 Mon Sep 17 00:00:00 2001 From: caneleex Date: Tue, 11 Aug 2020 20:19:55 +0200 Subject: [PATCH 034/121] Add "missing" dots to permission override methods params --- .../jda/api/requests/restaction/ChannelAction.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java index 7bc1214920..de9704059b 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java @@ -236,10 +236,10 @@ default ChannelAction addPermissionOverride(@Nonnull IPermissionHolder target * @param target * The not-null {@link net.dv8tion.jda.api.entities.Role Role} or {@link net.dv8tion.jda.api.entities.Member Member} for the override * @param allow - * The granted {@link net.dv8tion.jda.api.Permission Permissions} for the override + * The granted {@link net.dv8tion.jda.api.Permission Permissions} for the override. * Use {@link net.dv8tion.jda.api.Permission#getRawValue()} to retrieve these Permissions. * @param deny - * The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override + * The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override. * Use {@link net.dv8tion.jda.api.Permission#getRawValue()} to retrieve these Permissions. * * @throws java.lang.IllegalArgumentException @@ -347,10 +347,10 @@ default ChannelAction addRolePermissionOverride(long roleId, @Nullable Collec * @param memberId * The id for the member * @param allow - * The granted {@link net.dv8tion.jda.api.Permission Permissions} for the override + * The granted {@link net.dv8tion.jda.api.Permission Permissions} for the override. * Use {@link net.dv8tion.jda.api.Permission#getRawValue()} to retrieve these Permissions. * @param deny - * The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override + * The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override. * Use {@link net.dv8tion.jda.api.Permission#getRawValue()} to retrieve these Permissions. * * @throws java.lang.IllegalArgumentException @@ -380,10 +380,10 @@ default ChannelAction addRolePermissionOverride(long roleId, @Nullable Collec * @param roleId * The id for the role * @param allow - * The granted {@link net.dv8tion.jda.api.Permission Permissions} for the override + * The granted {@link net.dv8tion.jda.api.Permission Permissions} for the override. * Use {@link net.dv8tion.jda.api.Permission#getRawValue()} to retrieve these Permissions. * @param deny - * The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override + * The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override. * Use {@link net.dv8tion.jda.api.Permission#getRawValue()} to retrieve these Permissions. * * @throws java.lang.IllegalArgumentException From a4c15e674eadf43e159afb540b64d6b3761d2720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 18 Aug 2020 07:57:39 +0200 Subject: [PATCH 035/121] Implement RestAction#and operator (#1320) * Implement RestAction#and operator * Add more convenience overloads * Add RestAction.allOf and docs * Add mapToResult and some documentation --- .../dv8tion/jda/api/requests/RestAction.java | 267 +++++++++++++++- .../net/dv8tion/jda/api/utils/Result.java | 298 ++++++++++++++++++ .../internal/requests/DeferredRestAction.java | 8 + .../jda/internal/requests/RestActionImpl.java | 8 + .../operator/CombineRestAction.java | 177 +++++++++++ .../operator/RestActionOperator.java | 11 +- 6 files changed, 763 insertions(+), 6 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/api/utils/Result.java create mode 100644 src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java diff --git a/src/main/java/net/dv8tion/jda/api/requests/RestAction.java b/src/main/java/net/dv8tion/jda/api/requests/RestAction.java index 40484845dc..604e0bcf86 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/RestAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/RestAction.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.exceptions.ContextException; import net.dv8tion.jda.api.exceptions.RateLimitedException; +import net.dv8tion.jda.api.utils.Result; import net.dv8tion.jda.api.utils.concurrent.DelayedCompletableFuture; import net.dv8tion.jda.internal.requests.RestActionImpl; import net.dv8tion.jda.internal.requests.restaction.operator.*; @@ -29,14 +30,14 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.time.Duration; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import java.util.function.BooleanSupplier; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Predicate; +import java.util.function.*; +import java.util.stream.Collector; +import java.util.stream.Collectors; /** * A class representing a terminal between the user and the discord API. @@ -262,6 +263,119 @@ static Consumer getDefaultSuccess() return RestActionImpl.getDefaultSuccess(); } + /** + * Creates a RestAction instance which accumulates all results of the provided actions. + *
If one action fails, all others will be cancelled. + * To handle failures individually instead of cancelling you can use {@link #mapToResult()}. + * + * @param first + * The initial RestAction starting point + * @param others + * The remaining actions to accumulate + * @param + * The result type + * + * @throws IllegalArgumentException + * If null is provided + * + * @return RestAction - Type: {@link List} of the results + * + * @see #and(RestAction, BiFunction) + * @see #zip(RestAction, RestAction[]) + */ + @Nonnull + @SafeVarargs + @CheckReturnValue + static RestAction> allOf(@Nonnull RestAction first, @Nonnull RestAction... others) + { + Checks.notNull(first, "RestAction"); + Checks.noneNull(others, "RestAction"); + List> list = new ArrayList<>(others.length + 1); + list.add(first); + Collections.addAll(list, others); + return allOf(list); + } + + /** + * Creates a RestAction instance which accumulates all results of the provided actions. + *
If one action fails, all others will be cancelled. + * To handle failures individually instead of cancelling you can use {@link #mapToResult()}. + * + * @param actions + * Non-empty collection of RestActions to accumulate + * @param + * The result type + * + * @throws IllegalArgumentException + * If null is provided or the collection is empty + * + * @return RestAction - Type: {@link List} of the results + * + * @see #and(RestAction, BiFunction) + * @see #zip(RestAction, RestAction[]) + */ + @Nonnull + @CheckReturnValue + static RestAction> allOf(@Nonnull Collection> actions) + { + return accumulate(actions, Collectors.toList()); + } + + /** + * Creates a RestAction instance which accumulates all results of the provided actions. + *
If one action fails, all others will be cancelled. + * To handle failures individually instead of cancelling you can use {@link #mapToResult()}. + * + * @param actions + * Non-empty collection of RestActions to accumulate + * @param collector + * The {@link Collector} to use + * @param + * The input type + * @param + * The accumulator type + * @param + * The output type + * + * @throws IllegalArgumentException + * If null is provided or the collection is empty + * + * @return RestAction - Type: {@link List} of the results + * + * @see #and(RestAction, BiFunction) + * @see #zip(RestAction, RestAction[]) + */ + @Nonnull + @CheckReturnValue + static RestAction accumulate(@Nonnull Collection> actions, @Nonnull Collector collector) + { + Checks.noneNull(actions, "RestAction"); + Checks.notEmpty(actions, "RestActions"); + Checks.notNull(collector, "Collector"); + Supplier accumulator = collector.supplier(); + BiConsumer add = collector.accumulator(); + Function output = collector.finisher(); + + actions = new LinkedHashSet<>(actions); + Iterator> iterator = actions.iterator(); + RestAction result = iterator.next().map(it -> { + A list = accumulator.get(); + add.accept(list, it); + return list; + }); + + while (iterator.hasNext()) + { + RestAction next = iterator.next(); + result = result.and(next, (list, b) -> { + add.accept(list, b); + return list; + }); + } + + return result.map(output); + } + /** * The current JDA instance * @@ -279,10 +393,48 @@ static Consumer getDefaultSuccess() * The checks to run before executing the request, or {@code null} to run no checks * * @return The current RestAction for chaining convenience + * + * @see #getCheck() + * @see #addCheck(BooleanSupplier) */ @Nonnull RestAction setCheck(@Nullable BooleanSupplier checks); + /** + * The current checks for this RestAction. + * + * @return The current checks, or null if none were set + * + * @see #setCheck(BooleanSupplier) + */ + @Nullable + default BooleanSupplier getCheck() + { + return null; + } + + /** + * Shortcut for {@code setCheck(() -> getCheck().getAsBoolean() && checks.getAsBoolean())}. + * + * @param checks + * Other checks to run + * + * @throws IllegalArgumentException + * If the provided checks are null + * + * @return The current RestAction for chaining convenience + * + * @see #setCheck(BooleanSupplier) + */ + @Nonnull + @CheckReturnValue + default RestAction addCheck(@Nonnull BooleanSupplier checks) + { + Checks.notNull(checks, "Checks"); + BooleanSupplier check = getCheck(); + return setCheck(() -> (check == null || check.getAsBoolean()) && checks.getAsBoolean()); + } + /** * Timeout for this RestAction instance. *
If the request doesn't get executed within the timeout it will fail. @@ -548,6 +700,27 @@ default CompletableFuture submit() @Nonnull CompletableFuture submit(boolean shouldQueue); + /** + * Converts the success and failure callbacks into a {@link Result}. + *
This means the {@link #queue(Consumer, Consumer)} failure consumer will never be used. + * Instead, all results will be evaluated into a success consumer which provides an instance of {@link Result}. + * + *

{@link Result} will either be {@link Result#isSuccess() successful} or {@link Result#isFailure() failed}. + * This can be useful in combination with {@link #allOf(Collection)} to handle failed requests individually for each + * action. + * + *

Note: You have to handle failures explicitly with this. + * You should use {@link Result#onFailure(Consumer)}, {@link Result#getFailure()}, or {@link Result#expect(Predicate)}! + * + * @return RestAction - Type: {@link Result} + */ + @Nonnull + @CheckReturnValue + default RestAction> mapToResult() + { + return map(Result::success).onErrorMap(Result::failure); + } + /** * Intermediate operator that returns a modified RestAction. * @@ -809,6 +982,92 @@ default RestAction flatMap(@Nullable Predicate condition, @Non return new FlatMapRestAction<>(this, condition, flatMap); } + /** + * Combines this RestAction with the provided action. + *
The result is computed by the provided {@link BiFunction}. + * + *

If one of the actions fails, the other will be cancelled. + * To handle failures individually instead of cancelling you can use {@link #mapToResult()}. + * + * @param other + * The action to combine + * @param accumulator + * BiFunction to compute the result + * @param + * The type of the other action + * @param + * The result type after applying the accumulator function + * + * @throws IllegalArgumentException + * If null is provided or you tried to combine an action with itself + * + * @return Combined RestAction + */ + @Nonnull + @CheckReturnValue + default RestAction and(@Nonnull RestAction other, @Nonnull BiFunction accumulator) + { + Checks.notNull(other, "RestAction"); + Checks.notNull(accumulator, "Accumulator"); + return new CombineRestAction<>(this, other, accumulator); + } + + /** + * Combines this RestAction with the provided action. + * + *

If one of the actions fails, the other will be cancelled. + * To handle failures individually instead of cancelling you can use {@link #mapToResult()}. + * + * @param other + * The action to combine + * @param + * The type of the other action + * + * @throws IllegalArgumentException + * If null is provided or you tried to combine an action with itself + * + * @return Combined RestAction with empty result + */ + @Nonnull + @CheckReturnValue + default RestAction and(@Nonnull RestAction other) + { + return and(other, (a, b) -> null); + } + + /** + * Accumulates this RestAction with the provided actions into a {@link List}. + * + *

If one of the actions fails, the others will be cancelled. + * To handle failures individually instead of cancelling you can use {@link #mapToResult()}. + * + * @param first + * The first other action to accumulate into the list + * @param other + * The other actions to accumulate into the list + * + * @throws IllegalArgumentException + * If null is provided or you tried to combine an action with itself + * + * @return Combined RestAction with empty result + * + * @see #allOf(RestAction, RestAction[]) + * @see #and(RestAction, BiFunction) + */ + @Nonnull + @CheckReturnValue + @SuppressWarnings("unchecked") + default RestAction> zip(@Nonnull RestAction first, @Nonnull RestAction... other) + { + Checks.notNull(first, "RestAction"); + Checks.noneNull(other, "RestAction"); + List> list = new ArrayList<>(); + list.add(this); + list.add(first); + Collections.addAll(list, other); + return allOf(list); + } + /** * Intermediate operator that returns a modified RestAction. * diff --git a/src/main/java/net/dv8tion/jda/api/utils/Result.java b/src/main/java/net/dv8tion/jda/api/utils/Result.java new file mode 100644 index 0000000000..91b59b52e5 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/utils/Result.java @@ -0,0 +1,298 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.utils; + +import net.dv8tion.jda.internal.utils.Checks; + +import javax.annotation.CheckReturnValue; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.Supplier; + +/** + * Represents a computation or task result. + *
This result may be a {@link #getFailure() failure} or {@link #get() success}. + * + *

This is a value type and does not implement {@link #equals(Object)} or {@link #hashCode()}! + * + * @param + * The success type + */ +public class Result +{ + private final T value; + private final Throwable error; + + private Result(T value, Throwable error) + { + this.value = value; + this.error = error; + } + + /** + * Creates a successful result. + * + * @param value + * The success value + * @param + * The success type + * + * @return Result + */ + @Nonnull + @CheckReturnValue + public static Result success(@Nullable E value) + { + return new Result<>(value, null); + } + + /** + * Creates a failure result. + * + * @param error + * The failure throwable + * @param + * The success type + * + * @throws IllegalArgumentException + * If the provided error is null + * + * @return Result + */ + @Nonnull + @CheckReturnValue + public static Result failure(@Nonnull Throwable error) + { + Checks.notNull(error, "Error"); + return new Result<>(null, error); + } + + /** + * Creates a result instance from the provided supplier. + *
If the supplier throws an exception, a failure result is returned. + * + * @param supplier + * The supplier + * @param + * The success type + * + * @throws IllegalArgumentException + * If the supplier is null + * + * @return Result instance with the supplied value or exception failure + */ + @Nonnull + @CheckReturnValue + public static Result defer(@Nonnull Supplier supplier) + { + Checks.notNull(supplier, "Supplier"); + try + { + return Result.success(supplier.get()); + } + catch (Exception ex) + { + return Result.failure(ex); + } + } + + /** + * True if this result is a failure. + *
Use {@link #getFailure()} or {@link #expect(Predicate)} to handle failures. + * + * @return True, if this is a failure result + */ + public boolean isFailure() + { + return error != null; + } + + /** + * True if this result is a success. + *
Use {@link #get()} or {@link #map(Function)} to handle success values. + * + * @return True, if this is a successful result + */ + public boolean isSuccess() + { + return error == null; + } + + /** + * Passive error handler. + *
This will apply the provided callback if {@link #isFailure()} is true + * and return the same result for further chaining. + * + * @param callback + * The passive callback + * + * @throws IllegalArgumentException + * If the callback is null + * + * @return The same result instance + */ + @Nonnull + public Result onFailure(@Nonnull Consumer callback) + { + Checks.notNull(callback, "Callback"); + if (isFailure()) + callback.accept(error); + return this; + } + + /** + * Passive success handler. + *
This will apply the provided callback if {@link #isSuccess()} is true + * and return the same result for further chaining. + * + * @param callback + * The passive callback + * + * @throws IllegalArgumentException + * If the callback is null + * + * @return The same result instance + */ + @Nonnull + public Result onSuccess(@Nonnull Consumer callback) + { + Checks.notNull(callback, "Callback"); + if (isSuccess()) + callback.accept(value); + return this; + } + + /** + * Composite function to convert a result value to another value. + *
This will only apply the function is {@link #isSuccess()} is true. + * + * @param function + * The conversion function + * @param + * The result type + * + * @throws IllegalArgumentException + * If the provided function is null + * + * @return The mapped result + * + * @see #flatMap(Function) + */ + @Nonnull + @CheckReturnValue + @SuppressWarnings("unchecked") + public Result map(@Nonnull Function function) + { + Checks.notNull(function, "Function"); + if (isSuccess()) + return Result.defer(() -> function.apply(value)); + return (Result) this; + } + + /** + * Composite function to convert a result value to another result. + *
This will only apply the function is {@link #isSuccess()} is true. + * + * @param function + * The conversion function + * @param + * The result type + * + * @throws IllegalArgumentException + * If the provided function is null + * + * @return The mapped result + */ + @Nonnull + @CheckReturnValue + @SuppressWarnings("unchecked") + public Result flatMap(@Nonnull Function> function) + { + Checks.notNull(function, "Function"); + try + { + if (isSuccess()) + return function.apply(value); + } + catch (Exception ex) + { + return Result.failure(ex); + } + return (Result) this; + } + + /** + * Unwraps the success value of this result. + *
This only works if {@link #isSuccess()} is true and throws otherwise. + * + * @throws IllegalStateException + * If the result is not successful + * + * @return The result value + */ + public T get() + { + if (isFailure()) + throw new IllegalStateException(error); + return value; + } + + /** + * Unwraps the error for this result. + *
This will be {@code null} if {@link #isFailure()} is false. + * + * @return The error or null + */ + @Nullable + public Throwable getFailure() + { + return error; + } + + /** + * Throws the wrapped exception if the provided predicate returns true. + *
This will never provide a null error to the predicate. + * A successful result will never throw. + * + * @param predicate + * The test predicate + * + * @throws IllegalArgumentException + * If the provided predicate is null + * @throws IllegalStateException + * If the predicate returns true, the {@link Throwable#getCause() cause} will be the wrapped exception + * + * @return The same result instance + */ + @Nonnull + public Result expect(@Nonnull Predicate predicate) + { + Checks.notNull(predicate, "Predicate"); + if (isFailure() && predicate.test(error)) + throw new IllegalStateException(error); + return this; + } + + @Override + public String toString() + { + return isSuccess() ? "Result(success=" + value + ")" : "Result(error=" + error + ")"; + } +} diff --git a/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java index db5dddb840..c8de99fc8d 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java @@ -21,6 +21,7 @@ import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.internal.utils.Checks; +import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; import java.util.concurrent.CompletableFuture; @@ -79,6 +80,13 @@ public AuditableRestAction setCheck(BooleanSupplier checks) return this; } + @Nullable + @Override + public BooleanSupplier getCheck() + { + return transitiveChecks; + } + @Nonnull @Override public AuditableRestAction timeout(long timeout, @Nonnull TimeUnit unit) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java index 4e0824c956..11e206df40 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java @@ -33,6 +33,7 @@ import org.slf4j.Logger; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.concurrent.*; import java.util.function.BiFunction; import java.util.function.BooleanSupplier; @@ -166,6 +167,13 @@ public RestAction setCheck(BooleanSupplier checks) return this; } + @Nullable + @Override + public BooleanSupplier getCheck() + { + return this.checks; + } + @Nonnull @Override public RestAction deadline(long timestamp) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java new file mode 100644 index 0000000000..ee3bf9d783 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java @@ -0,0 +1,177 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.internal.requests.restaction.operator; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.exceptions.RateLimitedException; +import net.dv8tion.jda.api.requests.RestAction; +import net.dv8tion.jda.internal.utils.Checks; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.ReentrantLock; +import java.util.function.BiFunction; +import java.util.function.BooleanSupplier; +import java.util.function.Consumer; + +public class CombineRestAction implements RestAction +{ + private final RestAction action1; + private final RestAction action2; + private final BiFunction accumulator; + private volatile boolean failed = false; + + public CombineRestAction(RestAction action1, RestAction action2, BiFunction accumulator) + { + Checks.check(action1 != action2, "Cannot combine a RestAction with itself!"); + this.action1 = action1; + this.action2 = action2; + this.accumulator = accumulator; + BooleanSupplier checks = () -> !failed; + action1.addCheck(checks); + action2.addCheck(checks); + } + + @Nonnull + @Override + public JDA getJDA() + { + return action1.getJDA(); + } + + @Nonnull + @Override + public RestAction setCheck(@Nullable BooleanSupplier checks) + { + BooleanSupplier check = () -> !failed && (checks == null || checks.getAsBoolean()); + action1.setCheck(check); + action2.setCheck(check); + return this; + } + + @Nonnull + @Override + public RestAction addCheck(@Nonnull BooleanSupplier checks) + { + action1.addCheck(checks); + action2.addCheck(checks); + return this; + } + + @Nullable + @Override + public BooleanSupplier getCheck() + { + BooleanSupplier check1 = action1.getCheck(); + BooleanSupplier check2 = action2.getCheck(); + return () -> + (check1 == null || check1.getAsBoolean()) + && (check2 == null || check2.getAsBoolean()) + && !failed; + } + + @Nonnull + @Override + public RestAction deadline(long timestamp) + { + action1.deadline(timestamp); + action2.deadline(timestamp); + return this; + } + + @Override + public void queue(@Nullable Consumer success, @Nullable Consumer failure) + { + ReentrantLock lock = new ReentrantLock(); + AtomicBoolean done1 = new AtomicBoolean(false); + AtomicBoolean done2 = new AtomicBoolean(false); + AtomicReference result1 = new AtomicReference<>(); + AtomicReference result2 = new AtomicReference<>(); + Consumer failureCallback = (e) -> + { + if (failed) return; + failed = true; + RestActionOperator.doFailure(failure, e); + }; + action1.queue((s) -> { + lock.lock(); + try + { + done1.set(true); + result1.set(s); + if (done2.get()) + RestActionOperator.doSuccess(success, accumulator.apply(result1.get(), result2.get())); + } + catch (Exception e) + { + failureCallback.accept(e); + } + finally + { + lock.unlock(); + } + }, failureCallback); + action2.queue((s) -> { + lock.lock(); + try + { + done2.set(true); + result2.set(s); + if (done1.get()) + RestActionOperator.doSuccess(success, accumulator.apply(result1.get(), result2.get())); + } + catch (Exception e) + { + failureCallback.accept(e); + } + finally + { + lock.unlock(); + } + }, failureCallback); + } + + @Override + public O complete(boolean shouldQueue) throws RateLimitedException + { + if (!shouldQueue) + return accumulator.apply(action1.complete(false), action2.complete(false)); + try + { + return submit(true).join(); + } + catch (CompletionException e) + { + if (e.getCause() instanceof RuntimeException) + throw (RuntimeException) e.getCause(); + else if (e.getCause() instanceof RateLimitedException) + throw (RateLimitedException) e.getCause(); + throw e; + } + } + + @Nonnull + @Override + public CompletableFuture submit(boolean shouldQueue) + { + return action1.submit(shouldQueue).thenCombine(action2.submit(shouldQueue), accumulator); + } +} diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java index bd12f764b6..b513606e64 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java @@ -36,7 +36,7 @@ public RestActionOperator(RestAction action) this.action = action; } - protected void doSuccess(Consumer callback, E value) + protected static void doSuccess(Consumer callback, E value) { if (callback == null) RestAction.getDefaultSuccess().accept(value); @@ -44,7 +44,7 @@ protected void doSuccess(Consumer callback, E value) callback.accept(value); } - protected void doFailure(Consumer callback, Throwable throwable) + protected static void doFailure(Consumer callback, Throwable throwable) { if (callback == null) RestAction.getDefaultFailure().accept(throwable); @@ -70,6 +70,13 @@ public RestAction setCheck(@Nullable BooleanSupplier checks) return this; } + @Nullable + @Override + public BooleanSupplier getCheck() + { + return action.getCheck(); + } + @Nonnull @Override public RestAction deadline(long timestamp) From 5388904ac8ae5010b42b4dd5a18e46815f9f1788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 18 Aug 2020 08:26:34 +0200 Subject: [PATCH 036/121] Fix NullPointerException in PermOverrideData Fixes #1375 --- .../requests/restaction/PermOverrideData.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java index 19586f1634..fa396e82d3 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java @@ -41,16 +41,8 @@ public PermOverrideData(int type, long id, long allow, long deny) public PermOverrideData(PermissionOverride override) { - if (override.isMemberOverride()) - { - this.id = override.getMember().getUser().getIdLong(); - this.type = MEMBER_TYPE; - } - else - { - this.id = override.getRole().getIdLong(); - this.type = ROLE_TYPE; - } + this.id = override.getIdLong(); + this.type = override.isMemberOverride() ? MEMBER_TYPE : ROLE_TYPE; this.allow = override.getAllowedRaw(); this.deny = override.getDeniedRaw(); } From 402260efc476bacf0e728fb04822a19c34d24da8 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Sat, 22 Aug 2020 03:00:36 -0400 Subject: [PATCH 037/121] Fix sanitization issues within quotes (#1363) --- .../net/dv8tion/jda/api/utils/MarkdownSanitizer.java | 10 ++++------ src/test/java/MarkdownTest.java | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java b/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java index 99c418d2b5..9656a80011 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java @@ -504,16 +504,14 @@ private String handleQuote(@Nonnull String sequence, boolean newline) // Special handling for quote if (!isIgnored(QUOTE) && quote.matcher(sequence).matches()) { - int end = sequence.indexOf('\n'); - if (end < 0) - end = sequence.length(); - StringBuilder builder = new StringBuilder(compute(sequence.substring(2, end))); + int start = sequence.indexOf('>'); + if (start < 0) + start = 0; + StringBuilder builder = new StringBuilder(compute(sequence.substring(start + 2))); if (strategy == SanitizationStrategy.ESCAPE) builder.insert(0, "\\> "); if (newline) builder.insert(0, '\n'); - if (end < sequence.length()) - builder.append(compute(sequence.substring(end))); return builder.toString(); } diff --git a/src/test/java/MarkdownTest.java b/src/test/java/MarkdownTest.java index 730c15aa0e..91c473ec6e 100644 --- a/src/test/java/MarkdownTest.java +++ b/src/test/java/MarkdownTest.java @@ -388,5 +388,6 @@ public void testQuote() Assertions.assertEquals("\\>>> Hello\nWorld", markdown.compute(">>> Hello\nWorld")); Assertions.assertEquals("\\>>>\nHello\nWorld", markdown.compute(">>>\nHello\nWorld")); Assertions.assertEquals("\\>>>\nHello > World", markdown.compute(">>>\nHello > World")); + Assertions.assertEquals("\\> \\_Hello \n\\> World\\_", markdown.compute("> _Hello \n> World_")); } } From 00763b2af3c569b9b9cc8b503f3561aab090a72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 22 Aug 2020 10:24:31 +0200 Subject: [PATCH 038/121] Fix some javadoc errors --- src/main/java/net/dv8tion/jda/api/entities/Guild.java | 4 ++-- src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java | 1 + .../java/net/dv8tion/jda/internal/entities/WebhookImpl.java | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) 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 8523ee0b5f..a2d5886275 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -1983,7 +1983,7 @@ default RestAction retrieveBan(@Nonnull User bannedUser) *
This iterates from the most recent action to the first logged one. (Limit 90 days into history by discord api) * *

Examples

- *

+     * 
{@code
      * public void logBan(GuildBanEvent event) {
      *     Guild guild = event.getGuild();
      *     List modLog = guild.getTextChannelsByName("mod-log", true);
@@ -2000,7 +2000,7 @@ default RestAction retrieveBan(@Nonnull User bannedUser)
      *             );
      *          });
      * }
-     * 
+ * }
* * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account 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 d9237ccd01..391ce004ca 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java @@ -150,6 +150,7 @@ public long getIdLong() } @Override + @Deprecated public boolean isFake() { return fake; diff --git a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java index 72f0a668d1..b05694c0aa 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java @@ -165,6 +165,7 @@ public long getIdLong() } @Override + @Deprecated public boolean isFake() { return token == null; From 7bc8ae6b6debe0f1d04b7eb7d0d598addf2006ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sat, 22 Aug 2020 13:29:10 +0200 Subject: [PATCH 039/121] Add Message.Attachment#isSpoiler (#1374) --- .../java/net/dv8tion/jda/api/entities/Message.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 f3f16d77a8..5f644fcf3e 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -2342,5 +2342,17 @@ public boolean isVideo() String extension = getFileExtension(); return extension != null && VIDEO_EXTENSIONS.contains(extension.toLowerCase()); } + + /** + * Whether or not this attachment is marked as spoiler, + * based on {@link #getFileName()}. + * + * @return True if this attachment is marked as spoiler + */ + public boolean isSpoiler() + { + return getFileName().startsWith("SPOILER_"); + } + } } From 6b899bf7e11e71cb4230f5be454182ec7706c4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 23 Aug 2020 08:25:58 +0200 Subject: [PATCH 040/121] Use tryLock with timeouts to avoid deadlocks where possible (#1377) --- .../net/dv8tion/jda/api/utils/MiscUtil.java | 7 +++++-- .../internal/requests/WebSocketClient.java | 6 ++++-- .../requests/WebSocketSendingThread.java | 6 +++++- .../operator/CombineRestAction.java | 21 +++++++------------ .../utils/cache/ReadWriteLockCache.java | 21 +++++++++++++++++-- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java b/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java index e174b38f09..a814744d52 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.util.Formatter; +import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Supplier; @@ -121,7 +122,8 @@ public static E locked(ReentrantLock lock, Supplier task) { try { - lock.lockInterruptibly(); + if (!lock.tryLock() && !lock.tryLock(10, TimeUnit.SECONDS)) + throw new IllegalStateException("Could not acquire lock in reasonable timeframe! (10 seconds)"); return task.get(); } catch (InterruptedException e) @@ -139,7 +141,8 @@ public static void locked(ReentrantLock lock, Runnable task) { try { - lock.lockInterruptibly(); + if (!lock.tryLock() && !lock.tryLock(10, TimeUnit.SECONDS)) + throw new IllegalStateException("Could not acquire lock in reasonable timeframe! (10 seconds)"); task.run(); } catch (InterruptedException e) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index 8777dfe53e..0915686f9a 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -1080,7 +1080,8 @@ protected void locked(String comment, Runnable task) { try { - queueLock.lockInterruptibly(); + if (!queueLock.tryLock() && !queueLock.tryLock(10, TimeUnit.SECONDS)) + throw new IllegalStateException("Could not acquire lock in reasonable timeframe! (10 seconds)"); task.run(); } catch (InterruptedException e) @@ -1097,7 +1098,8 @@ protected T locked(String comment, Supplier task) { try { - queueLock.lockInterruptibly(); + if (!queueLock.tryLock() && !queueLock.tryLock(10, TimeUnit.SECONDS)) + throw new IllegalStateException("Could not acquire lock in reasonable timeframe! (10 seconds)"); return task.get(); } catch (InterruptedException e) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java index 954d8b2952..975e955fec 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java @@ -116,7 +116,11 @@ public void run() needRateLimit = false; // We do this outside of the lock because otherwise we could potentially deadlock here audioRequest = client.getNextAudioConnectRequest(); - queueLock.lockInterruptibly(); + if (!queueLock.tryLock() && !queueLock.tryLock(10, TimeUnit.SECONDS)) + { + scheduleNext(); + return; + } chunkRequest = chunkQueue.peek(); if (chunkRequest != null) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java index ee3bf9d783..8bf17af3f3 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.exceptions.RateLimitedException; import net.dv8tion.jda.api.requests.RestAction; +import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.utils.Checks; import javax.annotation.Nonnull; @@ -111,8 +112,8 @@ public void queue(@Nullable Consumer success, @Nullable Consumer { - lock.lock(); + action1.queue((s) -> MiscUtil.locked(lock, () -> + { try { done1.set(true); @@ -124,13 +125,9 @@ public void queue(@Nullable Consumer success, @Nullable Consumer { - lock.lock(); + }), failureCallback); + action2.queue((s) -> MiscUtil.locked(lock, () -> + { try { done2.set(true); @@ -142,11 +139,7 @@ public void queue(@Nullable Consumer success, @Nullable Consumer @@ -36,7 +37,15 @@ public UnlockHook writeLock() if (lock.getReadHoldCount() > 0) throw new IllegalStateException("Unable to acquire write-lock while holding read-lock!"); ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); - writeLock.lock(); + try + { + if (!writeLock.tryLock() && !writeLock.tryLock(10, TimeUnit.SECONDS)) + throw new IllegalStateException("Could not acquire write-lock in a reasonable timeframe! (10 seconds)"); + } + catch (InterruptedException e) + { + throw new IllegalStateException("Unable to acquire write-lock while thread is interrupted!"); + } onAcquireWriteLock(); clearCachedLists(); return new UnlockHook(writeLock); @@ -45,7 +54,15 @@ public UnlockHook writeLock() public UnlockHook readLock() { ReentrantReadWriteLock.ReadLock readLock = lock.readLock(); - readLock.lock(); + try + { + if (!readLock.tryLock() && !readLock.tryLock(10, TimeUnit.SECONDS)) + throw new IllegalStateException("Could not acquire read-lock in a reasonable timeframe! (10 seconds)"); + } + catch (InterruptedException e) + { + throw new IllegalStateException("Unable to acquire read-lock while thread is interrupted!"); + } onAcquireReadLock(); return new UnlockHook(readLock); } From 641bccf80d6bde4aede4159e25a81c7a05b61a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 24 Aug 2020 09:37:46 +0200 Subject: [PATCH 041/121] Implement support for news channels (#1362) --- .../net/dv8tion/jda/api/entities/Message.java | 39 +++++++ .../dv8tion/jda/api/entities/TextChannel.java | 108 ++++++++++++++++++ .../update/TextChannelUpdateNewsEvent.java | 55 +++++++++ .../jda/api/hooks/ListenerAdapter.java | 3 + .../jda/api/requests/ErrorResponse.java | 1 + .../internal/entities/AbstractMessage.java | 8 ++ .../jda/internal/entities/EntityBuilder.java | 1 + .../internal/entities/ReceivedMessage.java | 15 +++ .../internal/entities/TextChannelImpl.java | 13 +++ .../internal/handle/ChannelUpdateHandler.java | 13 ++- .../dv8tion/jda/internal/requests/Route.java | 1 + 11 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java 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 5f644fcf3e..1a4d3d0ced 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -1774,6 +1774,45 @@ default boolean isFromGuild() @CheckReturnValue AuditableRestAction suppressEmbeds(boolean suppressed); + /** + * Attempts to crosspost this message. + * + *

The following {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} are possible: + *

    + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#ALREADY_CROSSPOSTED ALREADY_CROSSPOSTED} + *
    The target message has already been crossposted.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} + *
    The request was attempted after the account lost access to the + * {@link net.dv8tion.jda.api.entities.Guild Guild} + * typically due to being kicked or removed, or after {@link net.dv8tion.jda.api.Permission#MESSAGE_READ Permission.MESSAGE_READ} + * was revoked in the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
    The request was attempted after the account lost + * {@link net.dv8tion.jda.api.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} in the TextChannel.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} + *
    The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or + * the message it referred to has already been deleted.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} + *
    The request was attempted after the channel was deleted.
  • + *
+ * + * @throws IllegalStateException + * If the channel is not a text or news channel. See {@link TextChannel#isNews()}. + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have + * {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL Permission.VIEW_CHANNEL} in this channel + * or if this message is from another user and we don't have {@link Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE}. + * + * @return {@link net.dv8tion.jda.api.requests.RestAction} - Type: {@link Message} + */ + @Nonnull + @CheckReturnValue + RestAction crosspost(); + /** * Whether embeds are suppressed for this message. * When Embeds are suppressed, they are not displayed on clients nor provided via API until un-suppressed. diff --git a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java index 3219e0421f..8d12ad76f2 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java @@ -18,11 +18,14 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; +import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.ChannelAction; import net.dv8tion.jda.api.requests.restaction.WebhookAction; import net.dv8tion.jda.api.utils.MiscUtil; +import net.dv8tion.jda.internal.requests.RestActionImpl; +import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.utils.Checks; import javax.annotation.CheckReturnValue; @@ -77,6 +80,14 @@ public interface TextChannel extends GuildChannel, MessageChannel, IMentionable */ boolean isNSFW(); + /** + * Whether or not this channel is considered an Announcement-/News-Channel. + *
These channels can be used to crosspost messages to other guilds by using a follower type webhook. + * + * @return True, if this is considered a news channel + */ + boolean isNews(); + /** * The slowmode set for this TextChannel. *
If slowmode is set this returns an {@code int} between 1 and {@link net.dv8tion.jda.api.entities.TextChannel#MAX_SLOWMODE TextChannel.MAX_SLOWMODE}. @@ -763,6 +774,103 @@ default RestAction removeReactionById(long messageId, @Nonnull Emote emote return removeReactionById(Long.toUnsignedString(messageId), emote, user); } + /** + * Attempts to crosspost the provided message. + * + *

The following {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} are possible: + *

    + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#ALREADY_CROSSPOSTED ALREADY_CROSSPOSTED} + *
    The target message has already been crossposted.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} + *
    The request was attempted after the account lost access to the + * {@link net.dv8tion.jda.api.entities.Guild Guild} + * typically due to being kicked or removed, or after {@link net.dv8tion.jda.api.Permission#MESSAGE_READ Permission.MESSAGE_READ} + * was revoked in the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
    The request was attempted after the account lost + * {@link net.dv8tion.jda.api.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} in the TextChannel.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} + *
    The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or + * the message it referred to has already been deleted.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} + *
    The request was attempted after the channel was deleted.
  • + *
+ * + * @param messageId + * The messageId to crosspost + * + * @throws IllegalStateException + * If this channel is not a news channel. See {@link #isNews()}. + * @throws java.lang.IllegalArgumentException + * If provided {@code messageId} is {@code null} or empty. + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have + * {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL Permission.VIEW_CHANNEL} in this channel. + * + * @return {@link net.dv8tion.jda.api.requests.RestAction} - Type: {@link Message} + */ + @Nonnull + @CheckReturnValue + default RestAction crosspostMessageById(@Nonnull String messageId) + { + if (!isNews()) + throw new IllegalStateException("You can only crosspost messages in news channels!"); + Checks.isSnowflake(messageId); + if (!getGuild().getSelfMember().hasAccess(this)) + throw new MissingAccessException(this, Permission.VIEW_CHANNEL); + Route.CompiledRoute route = Route.Messages.CROSSPOST_MESSAGE.compile(getId(), messageId); + return new RestActionImpl<>(getJDA(), route, + (response, request) -> request.getJDA().getEntityBuilder().createMessage(response.getObject())); + } + + /** + * Attempts to crosspost the provided message. + * + *

The following {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} are possible: + *

    + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#ALREADY_CROSSPOSTED ALREADY_CROSSPOSTED} + *
    The target message has already been crossposted.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} + *
    The request was attempted after the account lost access to the + * {@link net.dv8tion.jda.api.entities.Guild Guild} + * typically due to being kicked or removed, or after {@link net.dv8tion.jda.api.Permission#MESSAGE_READ Permission.MESSAGE_READ} + * was revoked in the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
    The request was attempted after the account lost + * {@link net.dv8tion.jda.api.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} in the TextChannel.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} + *
    The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or + * the message it referred to has already been deleted.
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} + *
    The request was attempted after the channel was deleted.
  • + *
+ * + * @param messageId + * The messageId to crosspost + * + * @throws IllegalStateException + * If this channel is not a news channel. See {@link #isNews()}. + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have + * {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL Permission.VIEW_CHANNEL} in this channel. + * + * @return {@link net.dv8tion.jda.api.requests.RestAction} - Type: {@link Message} + */ + @Nonnull + @CheckReturnValue + default RestAction crosspostMessageById(long messageId) + { + return crosspostMessageById(Long.toUnsignedString(messageId)); + } + /** * Whether we can send messages in this channel. *
This is an overload of {@link #canTalk(Member)} with the SelfMember. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java new file mode 100644 index 0000000000..0eafb5915f --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.channel.text.update; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.TextChannel; + +import javax.annotation.Nonnull; + +/** + * Indicates that a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}'s has been converted into a news channel + * or reverted into a normal channel. + * + *

Can be used to detect when a TextChannel becomes a news channel. + * + *

Identifier: {@code news} + */ +@SuppressWarnings("ConstantConditions") +public class TextChannelUpdateNewsEvent extends GenericTextChannelUpdateEvent +{ + public static final String IDENTIFIER = "news"; + + public TextChannelUpdateNewsEvent(@Nonnull JDA api, long responseNumber, @Nonnull TextChannel channel) + { + super(api, responseNumber, channel, !channel.isNews(), channel.isNews(), IDENTIFIER); + } + + @Nonnull + @Override + public Boolean getOldValue() + { + return super.getOldValue(); + } + + @Nonnull + @Override + public Boolean getNewValue() + { + return super.getNewValue(); + } +} diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 70a218cde0..bb68cb3934 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -228,6 +228,7 @@ public void onTextChannelUpdatePosition(@Nonnull TextChannelUpdatePositionEvent public void onTextChannelUpdateNSFW(@Nonnull TextChannelUpdateNSFWEvent event) {} public void onTextChannelUpdateParent(@Nonnull TextChannelUpdateParentEvent event) {} public void onTextChannelUpdateSlowmode(@Nonnull TextChannelUpdateSlowmodeEvent event) {} + public void onTextChannelUpdateNews(@Nonnull TextChannelUpdateNewsEvent event) {} public void onTextChannelCreate(@Nonnull TextChannelCreateEvent event) {} //VoiceChannel Events @@ -513,6 +514,8 @@ else if (event instanceof TextChannelDeleteEvent) onTextChannelDelete((TextChannelDeleteEvent) event); else if (event instanceof TextChannelUpdatePermissionsEvent) onTextChannelUpdatePermissions((TextChannelUpdatePermissionsEvent) event); + else if (event instanceof TextChannelUpdateNewsEvent) + onTextChannelUpdateNews((TextChannelUpdateNewsEvent) event); //VoiceChannel Events else if (event instanceof VoiceChannelCreateEvent) diff --git a/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java b/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java index 8ceb70f173..25400573fd 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java +++ b/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java @@ -73,6 +73,7 @@ public enum ErrorResponse UNAUTHORIZED( 40001, "Unauthorized"), REQUEST_ENTITY_TOO_LARGE( 40005, "Request entity too large"), USER_NOT_CONNECTED( 40032, "Target user is not connected to voice."), + ALREADY_CROSSPOSTED( 40033, "This message has already been crossposted."), MISSING_ACCESS( 50001, "Missing Access"), INVALID_ACCOUNT_TYPE( 50002, "Invalid Account Type"), INVALID_DM_ACTION( 50003, "Cannot execute action on a DM channel"), diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java index 484e58daeb..0db4a965ee 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java @@ -542,6 +542,14 @@ public AuditableRestAction suppressEmbeds(boolean suppressed) return null; } + @Nonnull + @Override + public RestAction crosspost() + { + unsupported(); + return null; + } + @Override public boolean isSuppressedEmbeds() { diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index 6336ab9b55..e3ea42044d 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -896,6 +896,7 @@ public TextChannel createTextChannel(GuildImpl guildObj, DataObject json, long g .setTopic(json.getString("topic", null)) .setPosition(json.getInt("position")) .setNSFW(json.getBoolean("nsfw")) + .setNews(json.getInt("type") == 5) .setSlowmode(json.getInt("rate_limit_per_user", 0)); createOverridesPass(channel, json.getArray("permission_overwrites")); diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java index 15e0f01e13..d67e56e1c6 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java @@ -31,6 +31,7 @@ import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; +import net.dv8tion.jda.internal.requests.CompletedRestAction; import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl; import net.dv8tion.jda.internal.utils.Checks; @@ -830,6 +831,20 @@ public AuditableRestAction suppressEmbeds(boolean suppressed) return new AuditableRestActionImpl<>(jda, route, DataObject.empty().put("flags", newFlags)); } + @Nonnull + @Override + public RestAction crosspost() + { + if (getFlags().contains(MessageFlag.CROSSPOSTED)) + return new CompletedRestAction<>(getJDA(), this); + TextChannel textChannel = getTextChannel(); + if (!getGuild().getSelfMember().hasAccess(textChannel)) + throw new MissingAccessException(textChannel, Permission.VIEW_CHANNEL); + if (!getAuthor().equals(getJDA().getSelfUser()) && !getGuild().getSelfMember().hasPermission(textChannel, Permission.MESSAGE_MANAGE)) + throw new InsufficientPermissionException(textChannel, Permission.MESSAGE_MANAGE); + return textChannel.crosspostMessageById(getId()); + } + @Override public boolean isSuppressedEmbeds() { diff --git a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java index d9abb9116b..76d550adf3 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java @@ -53,6 +53,7 @@ public class TextChannelImpl extends AbstractChannelImpl deleteMessages0(Collection messageIds) { diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java index 2cc023a825..62784af53c 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java @@ -51,7 +51,9 @@ public ChannelUpdateHandler(JDAImpl api) @Override protected Long handleInternally(DataObject content) { - ChannelType type = ChannelType.fromId(content.getInt("type")); + int rawType = content.getInt("type"); + boolean news = rawType == 5; + ChannelType type = ChannelType.fromId(rawType); if (type == ChannelType.GROUP) { WebSocketClient.LOG.warn("Ignoring CHANNEL_UPDATE for a group which we don't support"); @@ -169,6 +171,15 @@ protected Long handleInternally(DataObject content) textChannel, oldSlowmode)); } + if (news != textChannel.isNews()) + { + textChannel.setNews(news); + getJDA().handleEvent( + new TextChannelUpdateNewsEvent( + getJDA(), responseNumber, + textChannel)); + } + applyPermissions(textChannel, permOverwrites); break; //Finish the TextChannelUpdate case } diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Route.java b/src/main/java/net/dv8tion/jda/internal/requests/Route.java index 53e240b8f8..25e064e287 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Route.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Route.java @@ -208,6 +208,7 @@ public static class Messages public static final Route DELETE_MESSAGE = new Route(DELETE, "channels/{channel_id}/messages/{message_id}"); public static final Route GET_MESSAGE_HISTORY = new Route(GET, "channels/{channel_id}/messages"); + public static final Route CROSSPOST_MESSAGE = new Route(POST, "channels/{channel_id}/messages/{message_id}/crosspost"); //Bot only public static final Route GET_MESSAGE = new Route(GET, "channels/{channel_id}/messages/{message_id}"); From 29c1b7d60891b8c8911a1cd375ded0cda538f92f Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Sun, 30 Aug 2020 07:34:55 -0400 Subject: [PATCH 042/121] Fix inconsistency with MarkdownSanitizer (#1379) --- src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java b/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java index 9656a80011..a0f31664bf 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java @@ -71,7 +71,7 @@ public class MarkdownSanitizer private static final int ESCAPED_QUOTE_BLOCK = Integer.MIN_VALUE | QUOTE_BLOCK; private static final Pattern codeLanguage = Pattern.compile("^\\w+\n.*", Pattern.MULTILINE | Pattern.DOTALL); - private static final Pattern quote = Pattern.compile("> +\\S.*", Pattern.DOTALL | Pattern.MULTILINE); + private static final Pattern quote = Pattern.compile("> +.*", Pattern.DOTALL | Pattern.MULTILINE); private static final Pattern quoteBlock = Pattern.compile(">>>\\s+\\S.*", Pattern.DOTALL | Pattern.MULTILINE); private static final TIntObjectMap tokens; From 2c4f8a464b864272239a9cc68560746a5004d09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 31 Aug 2020 20:32:09 +0200 Subject: [PATCH 043/121] Properly update Member instances from message reactions --- .../internal/handle/MessageReactionHandler.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java index 74b366cb0f..a921907ce3 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java @@ -23,6 +23,7 @@ import net.dv8tion.jda.api.events.message.priv.react.PrivateMessageReactionRemoveEvent; import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent; import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent; +import net.dv8tion.jda.api.utils.data.DataArray; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.entities.EmoteImpl; @@ -31,8 +32,10 @@ import net.dv8tion.jda.internal.requests.WebSocketClient; import net.dv8tion.jda.internal.utils.JDALogger; +import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.stream.Collectors; public class MessageReactionHandler extends SocketHandler { @@ -81,8 +84,20 @@ protected Long handleInternally(DataObject content) Optional memberJson = content.optObject("member"); if (memberJson.isPresent()) // Check if we can load a member here { + DataObject json = memberJson.get(); if (member == null || !member.hasTimeJoined()) // do we need to load a member? - member = getJDA().getEntityBuilder().createMember((GuildImpl) guild, memberJson.get()); + member = getJDA().getEntityBuilder().createMember((GuildImpl) guild, json); + else // otherwise update the cache + { + List roles = json.getArray("roles") + .stream(DataArray::getUnsignedLong) + .map(guild::getRoleById) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + getJDA().getEntityBuilder().updateMember((GuildImpl) guild, member, json, roles); + } + // update internal references + getJDA().getEntityBuilder().updateMemberCache(member); } if (member == null && add && guild.isLoaded()) { From 2eb8bc9a843badb59dab3c613a15dc79452bdc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 3 Sep 2020 18:28:03 +0200 Subject: [PATCH 044/121] Improve handling of unavailable guilds during startup --- .../internal/handle/GuildSetupController.java | 20 ++++++++++++------- .../jda/internal/handle/GuildSetupNode.java | 8 -------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java index f67c49efef..cd6a1e06a8 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java @@ -53,8 +53,8 @@ public class GuildSetupController private final TLongLongMap pendingChunks = new TLongLongHashMap(); private final TLongSet unavailableGuilds = new TLongHashSet(); + // TODO: Rewrite this incompleteCount system to just rely on the state of each node private int incompleteCount = 0; - private int syncingCount = 0; private Future timeoutHandle; @@ -98,10 +98,18 @@ void remove(long id) public void ready(long id) { remove(id); + incompleteCount--; + checkReady(); + } + + // Check if we can send a ready event + private void checkReady() + { WebSocketClient client = getJDA().getClient(); - if (--incompleteCount < 1 && !client.isReady()) + // If no guilds are marked as incomplete we can fire a ready + if (incompleteCount < 1 && !client.isReady()) client.ready(); - else + else // otherwise see if we can chunk any guilds tryChunking(); } @@ -109,7 +117,6 @@ public boolean setIncompleteCount(int count) { log.debug("Setting incomplete count to {}", count); this.incompleteCount = count; - this.syncingCount = count; boolean ready = count == 0; if (ready) getJDA().getClient().ready(); @@ -187,7 +194,6 @@ public boolean onDelete(long id, DataObject obj) chunkingGuilds.remove(id); synchronized (pendingChunks) { pendingChunks.remove(id); } incompleteCount--; - tryChunking(); } } node.reset(); @@ -202,7 +208,8 @@ public boolean onDelete(long id, DataObject obj) ready(id); api.getEventManager().handle(new UnavailableGuildLeaveEvent(api, api.getResponseTotal(), id)); } - log.debug("Updated incompleteCount to {} and syncCount to {}", incompleteCount, syncingCount); + log.debug("Updated incompleteCount to {}", incompleteCount); + checkReady(); return true; } @@ -424,7 +431,6 @@ public void onUnavailable(long id) public enum Status { INIT, - SYNCING, CHUNKING, BUILDING, READY, diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java index 69733fc9a3..1d58562028 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java @@ -52,7 +52,6 @@ public class GuildSetupNode private TLongSet removedMembers; private DataObject partialGuild; private int expectedMemberCount = 1; - private boolean requestedSync; boolean requestedChunk; final Type type; @@ -120,11 +119,6 @@ public boolean requestedChunks() return requestedChunk; } - public boolean requestedSync() - { - return requestedSync; - } - public boolean containsMember(long userId) { if (members == null || members.isEmpty()) @@ -138,7 +132,6 @@ public String toString() return "GuildSetupNode[" + id + "|" + status + ']' + '{' + "expectedMemberCount=" + expectedMemberCount + ", " + - "requestedSync=" + requestedSync + ", " + "requestedChunk=" + requestedChunk + ", " + "type=" + type + ", " + "markedUnavailable=" + markedUnavailable + @@ -186,7 +179,6 @@ void reset() expectedMemberCount = 1; partialGuild = null; requestedChunk = false; - requestedSync = false; if (members != null) members.clear(); if (removedMembers != null) From 81b68e677489efabe26e4a9ca2e686ad46fb2402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 3 Sep 2020 22:36:02 +0200 Subject: [PATCH 045/121] Fix permission check in PermissionOverride#delete --- .../dv8tion/jda/internal/entities/PermissionOverrideImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java index 8e4638ebb1..7d57aa69c6 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java @@ -180,7 +180,7 @@ public AuditableRestAction delete() Member selfMember = getGuild().getSelfMember(); GuildChannel channel = getChannel(); - if (!selfMember.hasPermission(Permission.VIEW_CHANNEL)) + if (!selfMember.hasPermission(channel, Permission.VIEW_CHANNEL)) throw new MissingAccessException(channel, Permission.VIEW_CHANNEL); if (!selfMember.hasAccess(channel)) throw new MissingAccessException(channel, Permission.VOICE_CONNECT); From 9094d8207072442e48f3541c25208d5c5dd9f168 Mon Sep 17 00:00:00 2001 From: dan1st <34687786+danthe1st@users.noreply.github.com> Date: Thu, 3 Sep 2020 09:35:01 +0200 Subject: [PATCH 046/121] fix typo in Presence An activity, not a activity --- src/main/java/net/dv8tion/jda/api/managers/Presence.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/managers/Presence.java b/src/main/java/net/dv8tion/jda/api/managers/Presence.java index 7ed5c40ab3..3bc9c7cfdf 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/Presence.java +++ b/src/main/java/net/dv8tion/jda/api/managers/Presence.java @@ -82,7 +82,7 @@ public interface Presence /** * Sets the {@link net.dv8tion.jda.api.entities.Activity Activity} for this session. - *
A Activity can be retrieved via {@link net.dv8tion.jda.api.entities.Activity#playing(String)}. + *
An Activity can be retrieved via {@link net.dv8tion.jda.api.entities.Activity#playing(String)}. * For streams you provide a valid streaming url as second parameter * *

Examples: @@ -90,7 +90,7 @@ public interface Presence *
{@code presence.setActivity(Activity.streaming("Thrones", "https://twitch.tv/EasterEggs"));} * * @param activity - * A {@link net.dv8tion.jda.api.entities.Activity Activity} instance or null to reset + * An {@link net.dv8tion.jda.api.entities.Activity Activity} instance or null to reset * * @see net.dv8tion.jda.api.entities.Activity#playing(String) * @see net.dv8tion.jda.api.entities.Activity#streaming(String, String) From bf7286bb23dc467bfd9a46ca271f05bd69c42451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 5 Sep 2020 12:34:58 +0200 Subject: [PATCH 047/121] Apply MANAGE_CHANNEL context to categories (#1388) --- .../net/dv8tion/jda/api/entities/Guild.java | 74 ++++++++++++++++++- .../jda/internal/entities/CategoryImpl.java | 4 +- .../jda/internal/entities/GuildImpl.java | 32 ++++++-- .../restaction/ChannelActionImpl.java | 9 --- .../jda/internal/utils/PermissionUtil.java | 4 + 5 files changed, 104 insertions(+), 19 deletions(-) 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 b033ba99a3..2752ea6409 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -4273,7 +4273,42 @@ default AuditableRestAction modifyMemberRoles(@Nonnull Member member, @Non */ @Nonnull @CheckReturnValue - ChannelAction createTextChannel(@Nonnull String name); + default ChannelAction createTextChannel(@Nonnull String name) + { + return createTextChannel(name, null); + } + + /** + * Creates a new {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} in this Guild. + * For this to be successful, the logged in account has to have the {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} Permission + * + *

Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by + * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: + *

    + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
    The channel could not be created due to a permission discrepancy
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MAX_CHANNELS MAX_CHANNELS} + *
    The maximum number of channels were exceeded
  • + *
+ * + * @param name + * The name of the TextChannel to create + * @param parent + * The optional parent category for this channel, or null + * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the logged in account does not have the {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL} permission + * @throws IllegalArgumentException + * If the provided name is {@code null} or empty or greater than 100 characters in length; + * or the provided parent is not in the same guild. + * + * @return A specific {@link net.dv8tion.jda.api.requests.restaction.ChannelAction ChannelAction} + *
This action allows to set fields for the new TextChannel before creating it + */ + @Nonnull + @CheckReturnValue + ChannelAction createTextChannel(@Nonnull String name, @Nullable Category parent); /** * Creates a new {@link net.dv8tion.jda.api.entities.VoiceChannel VoiceChannel} in this Guild. @@ -4302,7 +4337,42 @@ default AuditableRestAction modifyMemberRoles(@Nonnull Member member, @Non */ @Nonnull @CheckReturnValue - ChannelAction createVoiceChannel(@Nonnull String name); + default ChannelAction createVoiceChannel(@Nonnull String name) + { + return createVoiceChannel(name, null); + } + + /** + * Creates a new {@link net.dv8tion.jda.api.entities.VoiceChannel VoiceChannel} in this Guild. + * For this to be successful, the logged in account has to have the {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} Permission. + * + *

Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by + * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: + *

    + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
    The channel could not be created due to a permission discrepancy
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MAX_CHANNELS MAX_CHANNELS} + *
    The maximum number of channels were exceeded
  • + *
+ * + * @param name + * The name of the VoiceChannel to create + * @param parent + * The optional parent category for this channel, or null + * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the logged in account does not have the {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL} permission + * @throws IllegalArgumentException + * If the provided name is {@code null} or empty or greater than 100 characters in length; + * or the provided parent is not in the same guild. + * + * @return A specific {@link ChannelAction ChannelAction} + *
This action allows to set fields for the new VoiceChannel before creating it + */ + @Nonnull + @CheckReturnValue + ChannelAction createVoiceChannel(@Nonnull String name, @Nullable Category parent); /** * Creates a new {@link net.dv8tion.jda.api.entities.Category Category} in this Guild. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java index aa7b35474a..9cafe8cf1e 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java @@ -158,7 +158,7 @@ public List getVoiceChannels() @Override public ChannelAction createTextChannel(@Nonnull String name) { - ChannelAction action = getGuild().createTextChannel(name).setParent(this); + ChannelAction action = getGuild().createTextChannel(name, this); applyPermission(action); return action; } @@ -167,7 +167,7 @@ public ChannelAction createTextChannel(@Nonnull String name) @Override public ChannelAction createVoiceChannel(@Nonnull String name) { - ChannelAction action = getGuild().createVoiceChannel(name).setParent(this); + ChannelAction action = getGuild().createVoiceChannel(name, this); applyPermission(action); return action; } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 30c1a9ab4d..e5e639345c 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -1317,26 +1317,46 @@ public AuditableRestAction transferOwnership(@Nonnull Member newOwner) @Nonnull @Override - public ChannelAction createTextChannel(@Nonnull String name) + public ChannelAction createTextChannel(@Nonnull String name, Category parent) { - checkPermission(Permission.MANAGE_CHANNEL); + if (parent != null) + { + Checks.check(parent.getGuild().equals(this), "Category is not from the same guild!"); + if (!getSelfMember().hasPermission(parent, Permission.MANAGE_CHANNEL)) + throw new InsufficientPermissionException(parent, Permission.MANAGE_CHANNEL); + } + else + { + checkPermission(Permission.MANAGE_CHANNEL); + } + Checks.notBlank(name, "Name"); name = name.trim(); Checks.check(name.length() > 0 && name.length() <= 100, "Provided name must be 1 - 100 characters in length"); - return new ChannelActionImpl<>(TextChannel.class, name, this, ChannelType.TEXT); + return new ChannelActionImpl<>(TextChannel.class, name, this, ChannelType.TEXT).setParent(parent); } @Nonnull @Override - public ChannelAction createVoiceChannel(@Nonnull String name) + public ChannelAction createVoiceChannel(@Nonnull String name, Category parent) { - checkPermission(Permission.MANAGE_CHANNEL); + if (parent != null) + { + Checks.check(parent.getGuild().equals(this), "Category is not from the same guild!"); + if (!getSelfMember().hasPermission(parent, Permission.MANAGE_CHANNEL)) + throw new InsufficientPermissionException(parent, Permission.MANAGE_CHANNEL); + } + else + { + checkPermission(Permission.MANAGE_CHANNEL); + } + Checks.notBlank(name, "Name"); name = name.trim(); Checks.check(name.length() > 0 && name.length() <= 100, "Provided name must be 1 - 100 characters in length"); - return new ChannelActionImpl<>(VoiceChannel.class, name, this, ChannelType.VOICE); + return new ChannelActionImpl<>(VoiceChannel.class, name, this, ChannelType.VOICE).setParent(parent); } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java index a448d59d84..869b0c852f 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java @@ -32,7 +32,6 @@ import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; -import java.util.Collection; import java.util.concurrent.TimeUnit; import java.util.function.BooleanSupplier; @@ -282,12 +281,4 @@ protected void handleSuccess(Response response, Request request) } request.onSuccess(clazz.cast(channel)); } - - protected void checkPermissions(Collection permissions) - { - if (permissions == null) - return; - for (Permission p : permissions) - Checks.notNull(p, "Permissions"); - } } diff --git a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java index 7f4ddeb24f..b164bcb8fb 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java @@ -354,6 +354,10 @@ public static long getEffectivePermission(GuildChannel channel, Member member) final long admin = Permission.ADMINISTRATOR.getRawValue(); if (isApplied(permission, admin)) return Permission.ALL_PERMISSIONS; + // MANAGE_CHANNEL allows to delete channels within a category (this is undocumented behavior) + if (channel.getParent() != null && checkPermission(channel.getParent(), member, Permission.MANAGE_CHANNEL)) + permission |= Permission.MANAGE_CHANNEL.getRawValue(); + AtomicLong allow = new AtomicLong(0); AtomicLong deny = new AtomicLong(0); From 39fb72f00ff382fad50d8780a455d663f6e8193b Mon Sep 17 00:00:00 2001 From: Den Neufeld Date: Sun, 27 Sep 2020 22:27:37 +0200 Subject: [PATCH 048/121] Make audio thread pool configurable by users (#1398) --- .../java/net/dv8tion/jda/api/JDABuilder.java | 47 +++++++++++++ .../jda/api/sharding/DefaultShardManager.java | 5 ++ .../sharding/DefaultShardManagerBuilder.java | 66 ++++++++++++++++++- .../net/dv8tion/jda/internal/JDAImpl.java | 19 +----- .../jda/internal/audio/AudioWebSocket.java | 4 +- .../utils/config/ThreadingConfig.java | 36 ++++++++++ .../sharding/ThreadingProviderConfig.java | 11 +++- 7 files changed, 167 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index e6228c0eba..eebdf7bed3 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -69,6 +69,8 @@ public class JDABuilder protected boolean shutdownCallbackPool = true; protected ExecutorService eventPool = null; protected boolean shutdownEventPool = true; + protected ScheduledExecutorService audioPool = null; + protected boolean shutdownAudioPool = true; protected EnumSet cacheFlags = EnumSet.allOf(CacheFlag.class); protected ConcurrentMap contextMap = null; protected SessionController controller = null; @@ -1155,6 +1157,50 @@ public JDABuilder setEventPool(@Nullable ExecutorService executor, boolean autom return this; } + /** + * Sets the {@link ScheduledExecutorService ScheduledExecutorService} used by + * the audio WebSocket connection. Used for sending keepalives and closing the connection. + *
Only change this pool if you know what you're doing. + * + *

Default: {@link ScheduledThreadPoolExecutor} with 1 thread + * + * @param pool + * The thread-pool to use for the audio WebSocket + * + * @return The JDABuilder instance. Useful for chaining. + * + * @since 4.2.1 + */ + @Nonnull + public JDABuilder setAudioPool(@Nullable ScheduledExecutorService pool) + { + return setAudioPool(pool, pool == null); + } + + /** + * Sets the {@link ScheduledExecutorService ScheduledExecutorService} used by + * the audio WebSocket connection. Used for sending keepalives and closing the connection. + *
Only change this pool if you know what you're doing. + * + *

Default: {@link ScheduledThreadPoolExecutor} with 1 thread + * + * @param pool + * The thread-pool to use for the audio WebSocket + * @param automaticShutdown + * Whether {@link JDA#shutdown()} should shutdown this pool + * + * @return The JDABuilder instance. Useful for chaining. + * + * @since 4.2.1 + */ + @Nonnull + public JDABuilder setAudioPool(@Nullable ScheduledExecutorService pool, boolean automaticShutdown) + { + this.audioPool = pool; + this.shutdownAudioPool = automaticShutdown; + return this; + } + /** * If enabled, JDA will separate the bulk delete event into individual delete events, but this isn't as efficient as * handling a single event would be. It is recommended that BulkDelete Splitting be disabled and that the developer @@ -1843,6 +1889,7 @@ public JDA build() throws LoginException threadingConfig.setGatewayPool(mainWsPool, shutdownMainWsPool); threadingConfig.setRateLimitPool(rateLimitPool, shutdownRateLimitPool); threadingConfig.setEventPool(eventPool, shutdownEventPool); + threadingConfig.setAudioPool(audioPool, shutdownAudioPool); SessionConfig sessionConfig = new SessionConfig(controller, httpClient, wsFactory, voiceDispatchInterceptor, flags, maxReconnectDelay, largeThreshold); MetaConfig metaConfig = new MetaConfig(maxBufferSize, contextMap, cacheFlags, flags); diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java index 2f94416b6e..b0e0254b79 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java @@ -501,6 +501,10 @@ protected JDAImpl buildInstance(final int shardId) throws LoginException, Interr ExecutorService eventPool = eventPair.executor; boolean shutdownEventPool = eventPair.automaticShutdown; + ExecutorPair audioPair = resolveExecutor(threadingConfig.getAudioPoolProvider(), shardId); + ScheduledExecutorService audioPool = audioPair.executor; + boolean shutdownAudioPool = audioPair.automaticShutdown; + AuthorizationConfig authConfig = new AuthorizationConfig(token); SessionConfig sessionConfig = this.sessionConfig.toSessionConfig(httpClient); ThreadingConfig threadingConfig = new ThreadingConfig(); @@ -508,6 +512,7 @@ protected JDAImpl buildInstance(final int shardId) throws LoginException, Interr threadingConfig.setGatewayPool(gatewayPool, shutdownGatewayPool); threadingConfig.setCallbackPool(callbackPool, shutdownCallbackPool); threadingConfig.setEventPool(eventPool, shutdownEventPool); + threadingConfig.setAudioPool(audioPool, shutdownAudioPool); MetaConfig metaConfig = new MetaConfig(this.metaConfig.getMaxBufferSize(), this.metaConfig.getContextMap(shardId), this.metaConfig.getCacheFlags(), this.sessionConfig.getFlags()); final JDAImpl jda = new JDAImpl(authConfig, sessionConfig, threadingConfig, metaConfig); jda.setMemberCachePolicy(shardingConfig.getMemberCachePolicy()); diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index 47cbd8663a..1e123ebc2c 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -85,6 +85,7 @@ public class DefaultShardManagerBuilder protected ThreadPoolProvider gatewayPoolProvider = null; protected ThreadPoolProvider callbackPoolProvider = null; protected ThreadPoolProvider eventPoolProvider = null; + protected ThreadPoolProvider audioPoolProvider = null; protected Collection shards = null; protected OkHttpClient.Builder httpClientBuilder = null; protected OkHttpClient httpClient = null; @@ -1638,6 +1639,69 @@ public DefaultShardManagerBuilder setEventPoolProvider(@Nullable ThreadPoolProvi return this; } + /** + * Sets the {@link ScheduledExecutorService ScheduledExecutorService} used by + * the audio WebSocket connection. Used for sending keepalives and closing the connection. + *
Only change this pool if you know what you're doing. + * + *

Default: {@link ScheduledThreadPoolExecutor} with 1 thread + * + * @param pool + * The thread-pool to use for the audio WebSocket + * + * @return The DefaultShardManagerBuilder instance. Useful for chaining. + * + * @since 4.2.1 + */ + @Nonnull + public DefaultShardManagerBuilder setAudioPool(@Nullable ScheduledExecutorService pool) + { + return setAudioPool(pool, pool == null); + } + + /** + * Sets the {@link ScheduledExecutorService ScheduledExecutorService} used by + * the audio WebSocket connection. Used for sending keepalives and closing the connection. + *
Only change this pool if you know what you're doing. + * + *

Default: {@link ScheduledThreadPoolExecutor} with 1 thread + * + * @param pool + * The thread-pool to use for the audio WebSocket + * @param automaticShutdown + * True, if the executor should be shutdown when JDA shuts down + * + * @return The DefaultShardManagerBuilder instance. Useful for chaining. + * + * @since 4.2.1 + */ + @Nonnull + public DefaultShardManagerBuilder setAudioPool(@Nullable ScheduledExecutorService pool, boolean automaticShutdown) + { + return setAudioPoolProvider(pool == null ? null : new ThreadPoolProviderImpl<>(pool, automaticShutdown)); + } + + /** + * Sets the {@link ScheduledExecutorService ScheduledExecutorService} used by + * the audio WebSocket connection. Used for sending keepalives and closing the connection. + *
Only change this pool if you know what you're doing. + * + *

Default: {@link ScheduledThreadPoolExecutor} with 1 thread + * + * @param provider + * The thread-pool provider to use for the audio WebSocket + * + * @return The DefaultShardManagerBuilder instance. Useful for chaining. + * + * @since 4.2.1 + */ + @Nonnull + public DefaultShardManagerBuilder setAudioPoolProvider(@Nullable ThreadPoolProvider provider) + { + this.audioPoolProvider = provider; + return this; + } + /** * Sets the maximum amount of time that JDA will back off to wait when attempting to reconnect the MainWebsocket. *
Provided value must be 32 or greater. @@ -2221,7 +2285,7 @@ public ShardManager build() throws LoginException, IllegalArgumentException presenceConfig.setActivityProvider(activityProvider); presenceConfig.setStatusProvider(statusProvider); presenceConfig.setIdleProvider(idleProvider); - final ThreadingProviderConfig threadingConfig = new ThreadingProviderConfig(rateLimitPoolProvider, gatewayPoolProvider, callbackPoolProvider, eventPoolProvider, threadFactory); + final ThreadingProviderConfig threadingConfig = new ThreadingProviderConfig(rateLimitPoolProvider, gatewayPoolProvider, callbackPoolProvider, eventPoolProvider, audioPoolProvider, threadFactory); final ShardingSessionConfig sessionConfig = new ShardingSessionConfig(sessionController, voiceDispatchInterceptor, httpClient, httpClientBuilder, wsFactory, audioSendFactory, flags, shardingFlags, maxReconnectDelay, largeThreshold); final ShardingMetaConfig metaConfig = new ShardingMetaConfig(maxBufferSize, contextProvider, cacheFlags, flags, compression, encoding); final DefaultShardManager manager = new DefaultShardManager(this.token, this.shards, shardingConfig, eventConfig, presenceConfig, threadingConfig, sessionConfig, metaConfig, chunkingFilter); diff --git a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java index e4d2394fd6..2600f581f3 100644 --- a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java @@ -80,9 +80,6 @@ public class JDAImpl implements JDA { public static final Logger LOG = JDALogger.getLog(JDA.class); - protected final Object audioLifeCycleLock = new Object(); - protected ScheduledThreadPoolExecutor audioLifeCyclePool; - protected final SnowflakeCacheViewImpl userCache = new SnowflakeCacheViewImpl<>(User.class, User::getName); protected final SnowflakeCacheViewImpl guildCache = new SnowflakeCacheViewImpl<>(Guild.class, Guild::getName); protected final SnowflakeCacheViewImpl categories = new SnowflakeCacheViewImpl<>(Category.class, GuildChannel::getName); @@ -715,8 +712,6 @@ public synchronized void shutdownInternals() // stop accepting new requests if (requester.stop()) // returns true if no more requests will be executed shutdownRequester(); // in that case shutdown entirely - if (audioLifeCyclePool != null) - audioLifeCyclePool.shutdownNow(); threadConfig.shutdown(); if (shutdownHook != null) @@ -1020,18 +1015,8 @@ public void resetGatewayUrl() this.gatewayUrl = null; } - public ScheduledThreadPoolExecutor getAudioLifeCyclePool() + public ScheduledExecutorService getAudioLifeCyclePool() { - ScheduledThreadPoolExecutor pool = audioLifeCyclePool; - if (pool == null) - { - synchronized (audioLifeCycleLock) - { - pool = audioLifeCyclePool; - if (pool == null) - pool = audioLifeCyclePool = ThreadingConfig.newScheduler(1, this::getIdentifierString, "AudioLifeCycle"); - } - } - return pool; + return threadConfig.getAudioPool(this::getIdentifierString); } } 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 5f7addfba7..60a8b36627 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java @@ -43,7 +43,7 @@ import java.util.Map; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; @@ -58,7 +58,7 @@ class AudioWebSocket extends WebSocketAdapter private final AudioConnection audioConnection; private final ConnectionListener listener; - private final ScheduledThreadPoolExecutor keepAlivePool; + private final ScheduledExecutorService keepAlivePool; private final Guild guild; private final String sessionId; private final String token; diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java index bfa8b3a563..18501f688d 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java @@ -25,15 +25,19 @@ public class ThreadingConfig { + private final Object audioLock = new Object(); + private ScheduledExecutorService rateLimitPool; private ScheduledExecutorService gatewayPool; private ExecutorService callbackPool; private ExecutorService eventPool; + private ScheduledExecutorService audioPool; private boolean shutdownRateLimitPool; private boolean shutdownGatewayPool; private boolean shutdownCallbackPool; private boolean shutdownEventPool; + private boolean shutdownAudioPool; public ThreadingConfig() { @@ -42,6 +46,7 @@ public ThreadingConfig() this.shutdownRateLimitPool = true; this.shutdownGatewayPool = true; this.shutdownCallbackPool = false; + this.shutdownAudioPool = true; } public void setRateLimitPool(@Nullable ScheduledExecutorService executor, boolean shutdown) @@ -68,6 +73,12 @@ public void setEventPool(@Nullable ExecutorService executor, boolean shutdown) this.shutdownEventPool = shutdown; } + public void setAudioPool(@Nullable ScheduledExecutorService executor, boolean shutdown) + { + this.audioPool = executor; + this.shutdownAudioPool = shutdown; + } + public void init(@Nonnull Supplier identifier) { if (this.rateLimitPool == null) @@ -84,6 +95,8 @@ public void shutdown() gatewayPool.shutdown(); if (shutdownEventPool && eventPool != null) eventPool.shutdown(); + if (shutdownAudioPool && audioPool != null) + audioPool.shutdown(); if (shutdownRateLimitPool) { if (rateLimitPool instanceof ScheduledThreadPoolExecutor) @@ -115,6 +128,8 @@ public void shutdownNow() rateLimitPool.shutdownNow(); if (shutdownEventPool && eventPool != null) eventPool.shutdownNow(); + if (shutdownAudioPool && audioPool != null) + audioPool.shutdownNow(); } @Nonnull @@ -141,6 +156,22 @@ public ExecutorService getEventPool() return eventPool; } + @Nullable + public ScheduledExecutorService getAudioPool(@Nonnull Supplier identifier) + { + ScheduledExecutorService pool = audioPool; + if (pool == null) + { + synchronized (audioLock) + { + pool = audioPool; + if (pool == null) + pool = audioPool = ThreadingConfig.newScheduler(1, identifier, "AudioLifeCycle"); + } + } + return pool; + } + public boolean isShutdownRateLimitPool() { return shutdownRateLimitPool; @@ -161,6 +192,11 @@ public boolean isShutdownEventPool() return shutdownEventPool; } + public boolean isShutdownAudioPool() + { + return shutdownAudioPool; + } + @Nonnull public static ScheduledThreadPoolExecutor newScheduler(int coreSize, Supplier identifier, String baseName) { diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java index 7492e3eba0..059cb6dd8e 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java @@ -30,6 +30,7 @@ public class ThreadingProviderConfig private final ThreadPoolProvider gatewayPoolProvider; private final ThreadPoolProvider callbackPoolProvider; private final ThreadPoolProvider eventPoolProvider; + private final ThreadPoolProvider audioPoolProvider; private final ThreadFactory threadFactory; public ThreadingProviderConfig( @@ -37,12 +38,14 @@ public ThreadingProviderConfig( @Nullable ThreadPoolProvider gatewayPoolProvider, @Nullable ThreadPoolProvider callbackPoolProvider, @Nullable ThreadPoolProvider eventPoolProvider, + @Nullable ThreadPoolProvider audioPoolProvider, @Nullable ThreadFactory threadFactory) { this.rateLimitPoolProvider = rateLimitPoolProvider; this.gatewayPoolProvider = gatewayPoolProvider; this.callbackPoolProvider = callbackPoolProvider; this.eventPoolProvider = eventPoolProvider; + this.audioPoolProvider = audioPoolProvider; this.threadFactory = threadFactory; } @@ -76,9 +79,15 @@ public ThreadPoolProvider getEventPoolProvider() return eventPoolProvider; } + @Nullable + public ThreadPoolProvider getAudioPoolProvider() + { + return audioPoolProvider; + } + @Nonnull public static ThreadingProviderConfig getDefault() { - return new ThreadingProviderConfig(null, null, null, null, null); + return new ThreadingProviderConfig(null, null, null, null, null, null); } } From ffcd0bcc77ce2b84f6c607473a3a2d89e8905c55 Mon Sep 17 00:00:00 2001 From: Simon <52353587+Simon-official@users.noreply.github.com> Date: Mon, 28 Sep 2020 18:31:42 +0200 Subject: [PATCH 049/121] Add length check to Activity#playing and similar methods (#1404) --- .../dv8tion/jda/api/entities/Activity.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/Activity.java b/src/main/java/net/dv8tion/jda/api/entities/Activity.java index 9c79edbdd9..06813721e4 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Activity.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Activity.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.internal.entities.EntityBuilder; import net.dv8tion.jda.internal.utils.Checks; import net.dv8tion.jda.internal.utils.EncodingUtil; +import net.dv8tion.jda.internal.utils.Helpers; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -114,7 +115,7 @@ public interface Activity * The not-null name of the newly created game * * @throws IllegalArgumentException - * if the specified name is null, empty or blank + * if the specified name is null, empty, blank or longer than 128 characters * * @return A valid Activity instance with the provided name with {@link net.dv8tion.jda.api.entities.Activity.ActivityType#DEFAULT} */ @@ -122,6 +123,8 @@ public interface Activity static Activity playing(@Nonnull String name) { Checks.notBlank(name, "Name"); + name = name.trim(); + Checks.check(name.length() <= 128, "Name must not be greater than 128 characters in length"); return EntityBuilder.createActivity(name, null, ActivityType.DEFAULT); } @@ -136,7 +139,7 @@ static Activity playing(@Nonnull String name) * The streaming url to use, required to display as "streaming" * * @throws IllegalArgumentException - * If the specified name is null or empty + * If the specified name is null, empty or longer than 128 characters * * @return A valid Activity instance with the provided name and url * @@ -146,6 +149,8 @@ static Activity playing(@Nonnull String name) static Activity streaming(@Nonnull String name, @Nullable String url) { Checks.notEmpty(name, "Provided game name"); + name = Helpers.isBlank(name) ? name : name.trim(); + Checks.check(name.length() <= 128, "Name must not be greater than 128 characters in length"); ActivityType type; if (isValidStreamingUrl(url)) type = ActivityType.STREAMING; @@ -162,7 +167,7 @@ static Activity streaming(@Nonnull String name, @Nullable String url) * The not-null name of the newly created game * * @throws IllegalArgumentException - * if the specified name is null, empty or blank + * if the specified name is null, empty, blank or longer than 128 characters * * @return A valid Activity instance with the provided name with {@link net.dv8tion.jda.api.entities.Activity.ActivityType#LISTENING} */ @@ -170,6 +175,8 @@ static Activity streaming(@Nonnull String name, @Nullable String url) static Activity listening(@Nonnull String name) { Checks.notBlank(name, "Name"); + name = name.trim(); + Checks.check(name.length() <= 128, "Name must not be greater than 128 characters in length"); return EntityBuilder.createActivity(name, null, ActivityType.LISTENING); } @@ -181,7 +188,7 @@ static Activity listening(@Nonnull String name) * The not-null name of the newly created game * * @throws IllegalArgumentException - * if the specified name is null, empty or blank + * if the specified name is null, empty, blank or longer than 128 characters * * @return A valid Activity instance with the provided name with {@link net.dv8tion.jda.api.entities.Activity.ActivityType#WATCHING} * @@ -192,6 +199,8 @@ static Activity listening(@Nonnull String name) static Activity watching(@Nonnull String name) { Checks.notBlank(name, "Name"); + name = name.trim(); + Checks.check(name.length() <= 128, "Name must not be greater than 128 characters in length"); return EntityBuilder.createActivity(name, null, ActivityType.WATCHING); } @@ -204,7 +213,7 @@ static Activity watching(@Nonnull String name) * The not-null name of the newly created game * * @throws IllegalArgumentException - * If the specified name is null or empty + * If the specified name is null, empty or longer than 128 characters * * @return A valid Activity instance with the provided name and url */ @@ -227,7 +236,7 @@ static Activity of(@Nonnull ActivityType type, @Nonnull String name) * The streaming url to use, required to display as "streaming". * * @throws IllegalArgumentException - * If the specified name is null or empty + * If the specified name is null, empty or longer than 128 characters * * @return A valid Activity instance with the provided name and url * From c2491f1d4cd5d2f41f3db7b3a95b8a0d672dc516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 29 Sep 2020 21:44:40 +0200 Subject: [PATCH 050/121] Improve lock scopes and timeouts for DefaultShardManager --- .../jda/api/sharding/DefaultShardManager.java | 30 ++++++--------- .../net/dv8tion/jda/api/utils/MiscUtil.java | 37 +++++++++++++------ .../utils/cache/AbstractCacheView.java | 3 +- .../utils/cache/ReadWriteLockCache.java | 22 ++--------- .../utils/cache/ShardCacheViewImpl.java | 11 +++++- 5 files changed, 52 insertions(+), 51 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java index b0e0254b79..8798e253cf 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java @@ -305,16 +305,13 @@ public void restart(final int shardId) Checks.notNegative(shardId, "shardId"); Checks.check(shardId < getShardsTotal(), "shardId must be lower than shardsTotal"); - try (UnlockHook hook = this.shards.writeLock()) + JDA jda = this.shards.remove(shardId); + if (jda != null) { - final JDA jda = this.shards.getMap().remove(shardId); - if (jda != null) - { - if (shardingConfig.isUseShutdownNow()) - jda.shutdownNow(); - else - jda.shutdown(); - } + if (shardingConfig.isUseShutdownNow()) + jda.shutdownNow(); + else + jda.shutdown(); } enqueueShard(shardId); @@ -370,16 +367,13 @@ public void shutdown() @Override public void shutdown(final int shardId) { - try (UnlockHook hook = this.shards.writeLock()) + final JDA jda = this.shards.remove(shardId); + if (jda != null) { - final JDA jda = this.shards.getMap().remove(shardId); - if (jda != null) - { - if (shardingConfig.isUseShutdownNow()) - jda.shutdownNow(); - else - jda.shutdown(); - } + if (shardingConfig.isUseShutdownNow()) + jda.shutdownNow(); + else + jda.shutdown(); } } diff --git a/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java b/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java index a814744d52..13603a86eb 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java @@ -26,6 +26,7 @@ import java.io.UncheckedIOException; import java.util.Formatter; import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Supplier; @@ -122,14 +123,9 @@ public static E locked(ReentrantLock lock, Supplier task) { try { - if (!lock.tryLock() && !lock.tryLock(10, TimeUnit.SECONDS)) - throw new IllegalStateException("Could not acquire lock in reasonable timeframe! (10 seconds)"); + tryLock(lock); return task.get(); } - catch (InterruptedException e) - { - throw new IllegalStateException(e); - } finally { if (lock.isHeldByCurrentThread()) @@ -141,14 +137,9 @@ public static void locked(ReentrantLock lock, Runnable task) { try { - if (!lock.tryLock() && !lock.tryLock(10, TimeUnit.SECONDS)) - throw new IllegalStateException("Could not acquire lock in reasonable timeframe! (10 seconds)"); + tryLock(lock); task.run(); } - catch (InterruptedException e) - { - throw new IllegalStateException(e); - } finally { if (lock.isHeldByCurrentThread()) @@ -156,6 +147,28 @@ public static void locked(ReentrantLock lock, Runnable task) } } + /** + * Tries to acquire the provided lock in a 10 second timeframe. + * + * @param lock + * The lock to acquire + * + * @throws IllegalStateException + * If the lock could not be acquired + */ + public static void tryLock(Lock lock) + { + try + { + if (!lock.tryLock() && !lock.tryLock(10, TimeUnit.SECONDS)) + throw new IllegalStateException("Could not acquire lock in a reasonable timeframe! (10 seconds)"); + } + catch (InterruptedException e) + { + throw new IllegalStateException("Unable to acquire lock while thread is interrupted!"); + } + } + /** * Can be used to append a String to a formatter. * diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java index 3b25ac73ea..5aa3fc9e0e 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java @@ -21,6 +21,7 @@ import gnu.trove.set.TLongSet; import gnu.trove.set.hash.TLongHashSet; import net.dv8tion.jda.api.utils.LockIterator; +import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.api.utils.cache.CacheView; import net.dv8tion.jda.internal.utils.Checks; import net.dv8tion.jda.internal.utils.UnlockHook; @@ -107,7 +108,7 @@ public void forEach(Consumer action) public LockIterator lockedIterator() { ReentrantReadWriteLock.ReadLock readLock = lock.readLock(); - readLock.lock(); + MiscUtil.tryLock(readLock); try { Iterator directIterator = elements.valueCollection().iterator(); diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java index 3740e6255e..294c7d4b8e 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.internal.utils.cache; +import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.utils.UnlockHook; import java.lang.ref.WeakReference; @@ -23,7 +24,6 @@ import java.util.List; import java.util.NavigableSet; import java.util.Set; -import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantReadWriteLock; public abstract class ReadWriteLockCache @@ -37,15 +37,7 @@ public UnlockHook writeLock() if (lock.getReadHoldCount() > 0) throw new IllegalStateException("Unable to acquire write-lock while holding read-lock!"); ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); - try - { - if (!writeLock.tryLock() && !writeLock.tryLock(10, TimeUnit.SECONDS)) - throw new IllegalStateException("Could not acquire write-lock in a reasonable timeframe! (10 seconds)"); - } - catch (InterruptedException e) - { - throw new IllegalStateException("Unable to acquire write-lock while thread is interrupted!"); - } + MiscUtil.tryLock(writeLock); onAcquireWriteLock(); clearCachedLists(); return new UnlockHook(writeLock); @@ -54,15 +46,7 @@ public UnlockHook writeLock() public UnlockHook readLock() { ReentrantReadWriteLock.ReadLock readLock = lock.readLock(); - try - { - if (!readLock.tryLock() && !readLock.tryLock(10, TimeUnit.SECONDS)) - throw new IllegalStateException("Could not acquire read-lock in a reasonable timeframe! (10 seconds)"); - } - catch (InterruptedException e) - { - throw new IllegalStateException("Unable to acquire read-lock while thread is interrupted!"); - } + MiscUtil.tryLock(readLock); onAcquireReadLock(); return new UnlockHook(readLock); } diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java index 79771c7a52..a91d1ee4d3 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java @@ -22,6 +22,7 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.utils.ClosableIterator; import net.dv8tion.jda.api.utils.LockIterator; +import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.api.utils.cache.CacheView; import net.dv8tion.jda.api.utils.cache.ShardCacheView; import net.dv8tion.jda.internal.utils.ChainedClosableIterator; @@ -61,6 +62,14 @@ public void clear() } } + public JDA remove(int shardId) + { + try (UnlockHook hook = writeLock()) + { + return elements.remove(shardId); + } + } + public TIntObjectMap getMap() { if (!lock.writeLock().isHeldByCurrentThread()) @@ -124,7 +133,7 @@ public Set asSet() public LockIterator lockedIterator() { ReentrantReadWriteLock.ReadLock readLock = lock.readLock(); - readLock.lock(); + MiscUtil.tryLock(readLock); try { Iterator directIterator = elements.valueCollection().iterator(); From d0d97de696255abcff80cae631a12fbad45538cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 4 Oct 2020 21:31:58 +0200 Subject: [PATCH 051/121] Allow using reactions on system messages (#1407) --- .../net/dv8tion/jda/api/entities/Message.java | 29 ------------------- .../jda/internal/entities/SystemMessage.java | 21 -------------- 2 files changed, 50 deletions(-) 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 1a4d3d0ced..a8af468060 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -1130,8 +1130,6 @@ default boolean isFromGuild() * @param emote * The {@link net.dv8tion.jda.api.entities.Emote Emote} to add as a reaction to this Message. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} * and the logged in account does not have @@ -1203,8 +1201,6 @@ default boolean isFromGuild() * @param unicode * The unicode emoji to add as a reaction to this Message. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} * and the logged in account does not have @@ -1245,8 +1241,6 @@ default boolean isFromGuild() * The clear-reactions request was attempted after the Message had been deleted. * * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} * and the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} @@ -1294,8 +1288,6 @@ default boolean isFromGuild() * @param unicode * The unicode emoji to remove reactions for * - * @throws UnsupportedOperationException - * If this reaction happened in a private channel * @throws InsufficientPermissionException * If the currently logged in account does not have {@link Permission#MESSAGE_MANAGE} in the channel * @throws IllegalArgumentException @@ -1333,8 +1325,6 @@ default boolean isFromGuild() * @param emote * The {@link Emote} to remove reactions for * - * @throws UnsupportedOperationException - * If this reaction happened in a private channel * @throws InsufficientPermissionException * If the currently logged in account does not have {@link Permission#MESSAGE_MANAGE} in the channel * @throws IllegalArgumentException @@ -1380,8 +1370,6 @@ default boolean isFromGuild() * @param emote * The {@link net.dv8tion.jda.api.entities.Emote Emote} to remove as a reaction from this Message. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} * and the logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} @@ -1437,8 +1425,6 @@ default boolean isFromGuild() * @param user * The {@link net.dv8tion.jda.api.entities.User User} to remove the reaction for. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} * and the logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}. @@ -1503,8 +1489,6 @@ default boolean isFromGuild() * @param unicode * The unicode emoji to add as a reaction to this Message. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} * and the logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} @@ -1558,8 +1542,6 @@ default boolean isFromGuild() * @param user * The {@link net.dv8tion.jda.api.entities.User User} to remove the reaction for. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} * and the logged in account does not have @@ -1607,8 +1589,6 @@ default boolean isFromGuild() * @param emote * The {@link net.dv8tion.jda.api.entities.Emote emote} to retrieve users for. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} and the * logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel. @@ -1650,8 +1630,6 @@ default boolean isFromGuild() * @param unicode * The unicode emote to retrieve users for. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the MessageChannel this message was sent in was a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} and the * logged in account does not have {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel. @@ -1677,8 +1655,6 @@ default boolean isFromGuild() * @param unicode * The unicode value of the reaction emoji. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws java.lang.IllegalArgumentException * If the provided unicode value is null or empty. * @@ -1701,8 +1677,6 @@ default boolean isFromGuild() * @param id * The string id of the reaction emote. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} * @throws java.lang.IllegalArgumentException * If the provided id is not a valid snowflake. * @@ -1725,9 +1699,6 @@ default boolean isFromGuild() * @param id * The long id of the reaction emote. * - * @throws java.lang.UnsupportedOperationException - * If this is not a Received Message from {@link net.dv8tion.jda.api.entities.MessageType#DEFAULT MessageType.DEFAULT} - * * @return The {@link net.dv8tion.jda.api.entities.MessageReaction.ReactionEmote ReactionEmote} of this message or null if not present. * * @since 4.1.0 diff --git a/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java index db57654561..ddf475f5d6 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java @@ -52,27 +52,6 @@ public RestAction unpin() throw new UnsupportedOperationException("Cannot unpin message of this Message Type. MessageType: " + getType()); } - @Nonnull - @Override - public RestAction addReaction(@Nonnull Emote emote) - { - throw new UnsupportedOperationException("Cannot add reactions to message of this Message Type. MessageType: " + getType()); - } - - @Nonnull - @Override - public RestAction addReaction(@Nonnull String unicode) - { - throw new UnsupportedOperationException("Cannot add reactions to message of this Message Type. MessageType: " + getType()); - } - - @Nonnull - @Override - public RestAction clearReactions() - { - throw new UnsupportedOperationException("Cannot clear reactions for message of this Message Type. MessageType: " + getType()); - } - @Nonnull @Override public MessageAction editMessage(@Nonnull CharSequence newContent) From 9ff4e51316e5e4b675305c1ed5970b6424ecc68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 11 Oct 2020 16:52:18 +0200 Subject: [PATCH 052/121] Use JSON body for prune request --- .../jda/internal/entities/GuildImpl.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index e5e639345c..b48a032cc4 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -60,7 +60,6 @@ import net.dv8tion.jda.internal.utils.cache.SnowflakeCacheViewImpl; import net.dv8tion.jda.internal.utils.cache.SortedSnowflakeCacheViewImpl; import net.dv8tion.jda.internal.utils.concurrent.task.GatewayTask; -import okhttp3.FormBody; import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; @@ -1052,17 +1051,20 @@ public AuditableRestAction prune(int days, boolean wait, @Nonnull Role. Checks.notNull(roles, "Roles"); Route.CompiledRoute route = Route.Guilds.PRUNE_MEMBERS.compile(getId()); - FormBody.Builder form = new FormBody.Builder(); - form.add("days", Integer.toString(days)); + DataObject body = DataObject.empty(); + body.put("days", days); if (!wait) - form.add("compute_prune_count", "false"); - for (Role role : roles) + body.put("compute_prune_count", false); + if (roles.length != 0) { - Checks.notNull(role, "Role"); - Checks.check(role.getGuild().equals(this), "Role is not from the same guild!"); - form.add("include_roles", role.getId()); + for (Role role : roles) + { + Checks.notNull(role, "Role"); + Checks.check(role.getGuild().equals(this), "Role is not from the same guild!"); + } + body.put("include_roles", Arrays.stream(roles).map(Role::getId).collect(Collectors.toList())); } - return new AuditableRestActionImpl<>(getJDA(), route, form.build(), (response, request) -> response.getObject().getInt("pruned", 0)); + return new AuditableRestActionImpl<>(getJDA(), route, body, (response, request) -> response.getObject().getInt("pruned", 0)); } @Nonnull From 26a2b11bb6ade17e07ad201a578b554fdd796f75 Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR <9496359+MrPowerGamerBR@users.noreply.github.com> Date: Tue, 13 Oct 2020 10:43:56 -0300 Subject: [PATCH 053/121] Fix 4007 Close Code typo Should be "seq", not "sent" --- src/main/java/net/dv8tion/jda/api/requests/CloseCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java b/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java index 91d7e94b12..d7d6bf4068 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java +++ b/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java @@ -35,7 +35,7 @@ public enum CloseCode NOT_AUTHENTICATED( 4003, "You sent a payload prior to identifying."), AUTHENTICATION_FAILED(4004, "The account token sent with your identify payload is incorrect.", false), ALREADY_AUTHENTICATED(4005, "You sent more than one identify payload. Don't do that!"), - INVALID_SEQ( 4007, "The sent sent when resuming the session was invalid. Reconnect and start a new session."), + INVALID_SEQ( 4007, "The seq sent when resuming the session was invalid. Reconnect and start a new session."), RATE_LIMITED( 4008, "Woah nelly! You're sending payloads to us too quickly. Slow it down!"), SESSION_TIMEOUT( 4009, "Your session timed out. Reconnect and start a new one."), INVALID_SHARD( 4010, "You sent an invalid shard when identifying.", false), From 4f81b76a2bc2a715c9c3af1391ec1708e30dfb36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebo=20Moln=C3=A1r?= Date: Sat, 24 Oct 2020 10:44:18 +0200 Subject: [PATCH 054/121] rename some userflags to match their new name (#1382) * rename "verified bot developer" to "early verified bot developer" * rename "discord partner" to "partnered server owner" --- src/main/java/net/dv8tion/jda/api/entities/User.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 8c327ce083..6b8f5a86b8 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/User.java +++ b/src/main/java/net/dv8tion/jda/api/entities/User.java @@ -332,7 +332,7 @@ default String getEffectiveAvatarUrl() enum UserFlag { STAFF( 0, "Discord Employee"), - PARTNER( 1, "Discord Partner"), + PARTNER( 1, "Partnered Server Owner"), HYPESQUAD( 2, "HypeSquad Events"), BUG_HUNTER_LEVEL_1(3, "Bug Hunter Level 1"), @@ -346,7 +346,7 @@ enum UserFlag SYSTEM( 12, "System User"), BUG_HUNTER_LEVEL_2(14, "Bug Hunter Level 2"), VERIFIED_BOT( 16, "Verified Bot"), - VERIFIED_DEVELOPER(17, "Verified Bot Developer"), + VERIFIED_DEVELOPER(17, "Early Verified Bot Developer"), UNKNOWN(-1, "Unknown"); From 76cf6937c50dfe36ab6a64d314a171ca27290c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 27 Oct 2020 19:54:21 +0100 Subject: [PATCH 055/121] Improve chunking without intents enabled You can no longer request multiple guilds in one request --- .../internal/handle/GuildSetupController.java | 39 +++---------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java index cd6a1e06a8..87906951c1 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java @@ -16,7 +16,6 @@ package net.dv8tion.jda.internal.handle; -import gnu.trove.iterator.TLongIterator; import gnu.trove.iterator.TLongLongIterator; import gnu.trove.iterator.TLongObjectIterator; import gnu.trove.map.TLongLongMap; @@ -382,39 +381,11 @@ void sendChunkRequest(Object obj) private void tryChunking() { - if (api.useIntents()) - { - // can only send a single guild id for this - chunkingGuilds.forEach((id) -> { - sendChunkRequest(id); - return true; - }); - chunkingGuilds.clear(); - return; - } - - if (chunkingGuilds.size() >= 50) - { - // request chunks - final DataArray subset = DataArray.empty(); - for (final TLongIterator it = chunkingGuilds.iterator(); subset.length() < 50; ) - { - subset.add(it.next()); - it.remove(); - } - sendChunkRequest(subset); - } - if (incompleteCount > 0 && chunkingGuilds.size() >= incompleteCount) - { - // request last chunks - final DataArray array = DataArray.empty(); - chunkingGuilds.forEach((guild) -> { - array.add(guild); - return true; - }); - chunkingGuilds.clear(); - sendChunkRequest(array); - } + chunkingGuilds.forEach((id) -> { + sendChunkRequest(id); + return true; + }); + chunkingGuilds.clear(); } private void startTimeout() From 8637866012084ed2d5f2da8ee2b064627e1d00b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 21 Oct 2020 09:06:24 +0200 Subject: [PATCH 056/121] Add watered-down GuildMemberUpdateEvent --- .../guild/member/GuildMemberRemoveEvent.java | 2 +- .../guild/member/GuildMemberUpdateEvent.java | 45 +++++++++++++++++++ .../handle/GuildMemberUpdateHandler.java | 2 + 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java index 1bc1b69593..30617891ba 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java @@ -26,7 +26,7 @@ import javax.annotation.Nullable; /** - * Indicates that a user left a {@link Guild}. + * Indicates that a user was removed from a {@link Guild}. This includes kicks, bans, and leaves respectively. *
This can be fired for uncached members and cached members alike. * If the member was not cached by JDA, due to the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * or disabled member chunking, then {@link #getMember()} will return {@code null}. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java new file mode 100644 index 0000000000..c033375f9a --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java @@ -0,0 +1,45 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.guild.member; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Member; + +import javax.annotation.Nonnull; + +/** + * Fired for every {@link Member} update, regardless of cache. + * + *

This is a watered-down version of the {@link net.dv8tion.jda.api.events.guild.member.update.GenericGuildMemberUpdateEvent GenericGuildMemberUpdateEvent} + * which only provides the updated member instance. This is useful when JDA cannot fire specific update events when the member is uncached. + * + *

You can use this to do stateless checks on member instances to update database entries or check for special roles. + * Note that the member might not be in cache when this event is fired due to the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy}. + * + *

Requirements

+ * + *

This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent to be enabled. + *
{@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and + * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! + */ +public class GuildMemberUpdateEvent extends GenericGuildMemberEvent +{ + public GuildMemberUpdateEvent(@Nonnull JDA api, long responseNumber, @Nonnull Member member) + { + super(api, responseNumber, member); + } +} diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java index d426241e26..288fa36a9b 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.internal.handle; import net.dv8tion.jda.api.entities.Role; +import net.dv8tion.jda.api.events.guild.member.GuildMemberUpdateEvent; import net.dv8tion.jda.api.utils.data.DataArray; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; @@ -63,6 +64,7 @@ protected Long handleInternally(DataObject content) } getJDA().getEntityBuilder().updateMemberCache(member); + getJDA().handleEvent(new GuildMemberUpdateEvent(getJDA(), responseNumber, member)); return null; } From cb8b8a016f0ead45c243980df1e9f91fcc113495 Mon Sep 17 00:00:00 2001 From: caneleex Date: Thu, 29 Oct 2020 18:14:44 +0100 Subject: [PATCH 057/121] add onGuildMemberUpdate method to ListenerAdapter --- src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index bb68cb3934..7ac1a7ba71 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -295,6 +295,7 @@ public void onGuildMemberRoleAdd(@Nonnull GuildMemberRoleAddEvent event) {} public void onGuildMemberRoleRemove(@Nonnull GuildMemberRoleRemoveEvent event) {} //Guild Member Update Events + public void onGuildMemberUpdate(@Nonnull GuildMemberUpdateEvent event) {} public void onGuildMemberUpdateNickname(@Nonnull GuildMemberUpdateNicknameEvent event) {} public void onGuildMemberUpdateBoostTime(@Nonnull GuildMemberUpdateBoostTimeEvent event) {} @@ -636,6 +637,8 @@ else if (event instanceof GuildMemberRoleRemoveEvent) onGuildMemberRoleRemove((GuildMemberRoleRemoveEvent) event); //Guild Member Update Events + else if (event instanceof GuildMemberUpdateEvent) + onGuildMemberUpdate((GuildMemberUpdateEvent) event); else if (event instanceof GuildMemberUpdateNicknameEvent) onGuildMemberUpdateNickname((GuildMemberUpdateNicknameEvent) event); else if (event instanceof GuildMemberUpdateBoostTimeEvent) From d6b5083f1ec09e21afecd28c3bf3e7800e650c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 12 Nov 2020 19:29:22 +0100 Subject: [PATCH 058/121] Improve handling of exceptions and interrupts during login/shutdown (#1430) * Improve handling of exceptions during login process * Improve handling of interrupts * Simplify JDAImpl#closeAudioConnections --- .../jda/api/sharding/DefaultShardManager.java | 48 +++++++++--------- .../sharding/DefaultShardManagerBuilder.java | 2 + .../api/utils/SessionControllerAdapter.java | 38 ++++++-------- .../net/dv8tion/jda/internal/JDAImpl.java | 49 ++++++------------- 4 files changed, 55 insertions(+), 82 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java index 8798e253cf..a47ded3535 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java @@ -274,11 +274,6 @@ public void login() throws LoginException this.queue.remove(shardId); } } - catch (final InterruptedException e) - { - LOG.error("Interrupted Startup", e); - throw new IllegalStateException(e); - } catch (final Exception e) { if (jda != null) @@ -348,13 +343,17 @@ public void shutdown() if (this.shards != null) { executor.execute(() -> { - this.shards.forEach(jda -> + synchronized (queue) // this makes sure we also get shards that were starting when shutdown is called { - if (shardingConfig.isUseShutdownNow()) - jda.shutdownNow(); - else - jda.shutdown(); - }); + this.shards.forEach(jda -> + { + if (shardingConfig.isUseShutdownNow()) + jda.shutdownNow(); + else + jda.shutdown(); + }); + queue.clear(); + } this.executor.shutdown(); }); } @@ -396,11 +395,13 @@ protected void enqueueShard(final int shardId) protected void runQueueWorker() { + if (shutdown.get()) + throw new RejectedExecutionException("ShardManager is already shutdown!"); if (worker != null) return; worker = executor.submit(() -> { - while (!queue.isEmpty()) + while (!queue.isEmpty() && !Thread.currentThread().isInterrupted()) processQueue(); this.gatewayURL = null; synchronized (queue) @@ -438,10 +439,12 @@ protected void processQueue() if (api == null) api = this.buildInstance(shardId); } - catch (InterruptedException e) + catch (CompletionException e) { - //caused by shutdown - LOG.debug("Queue has been interrupted", e); + if (e.getCause() instanceof InterruptedException) + LOG.debug("The worker thread was interrupted"); + else + LOG.error("Caught an exception in queue processing thread", e); return; } catch (LoginException e) @@ -468,7 +471,7 @@ protected void processQueue() } } - protected JDAImpl buildInstance(final int shardId) throws LoginException, InterruptedException + protected JDAImpl buildInstance(final int shardId) throws LoginException { OkHttpClient httpClient = sessionConfig.getHttpClient(); if (httpClient == null) @@ -561,16 +564,11 @@ protected JDAImpl buildInstance(final int shardId) throws LoginException, Interr } } } - catch (RuntimeException e) + catch (CompletionException e) { - if (e.getCause() instanceof InterruptedException) - throw (InterruptedException) e.getCause(); - //We check if the LoginException is masked inside of a ExecutionException which is masked inside of the RuntimeException - Throwable ex = e.getCause() instanceof ExecutionException ? e.getCause().getCause() : null; - if (ex instanceof LoginException) - throw new LoginException(ex.getMessage()); - else - throw e; + if (e.getCause() instanceof LoginException) + throw (LoginException) e.getCause(); // complete() can't throw this because its a checked-exception so we have to unwrap it first + throw e; } } diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index 1e123ebc2c..6ccc41b897 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -2268,6 +2268,8 @@ public DefaultShardManagerBuilder setMaxBufferSize(int bufferSize) * If the provided token is invalid. * @throws IllegalArgumentException * If the provided token is empty or null. Or the provided intents/cache configuration is not possible. + * @throws net.dv8tion.jda.api.exceptions.ErrorResponseException + * If some other HTTP error occurred. * * @return A {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} instance that has started the login process. It is unknown as * to whether or not loading has finished when this returns. diff --git a/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java b/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java index 469cbf9c21..084f01b585 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java @@ -96,32 +96,24 @@ public ShardedGateway getShardedGateway(@Nonnull JDA api) @Override public void handleResponse(Response response, Request request) { - try + if (response.isOk()) { - if (response.isOk()) - { - DataObject object = response.getObject(); - - String url = object.getString("url"); - int shards = object.getInt("shards"); - int concurrency = object.getObject("session_start_limit").getInt("max_concurrency", 1); - - request.onSuccess(new ShardedGateway(url, shards, concurrency)); - } - else if (response.code == 401) - { - api.shutdownNow(); - throw new LoginException("The provided token is invalid!"); - } - else - { - request.onFailure(new LoginException("When verifying the authenticity of the provided token, Discord returned an unknown response:\n" + - response.toString())); - } + DataObject object = response.getObject(); + + String url = object.getString("url"); + int shards = object.getInt("shards"); + int concurrency = object.getObject("session_start_limit").getInt("max_concurrency", 1); + + request.onSuccess(new ShardedGateway(url, shards, concurrency)); + } + else if (response.code == 401) + { + api.shutdownNow(); + request.onFailure(new LoginException("The provided token is invalid!")); } - catch (Exception e) + else { - request.onFailure(e); + request.onFailure(response); } } }.priority().complete(); diff --git a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java index 2600f581f3..cc9094eeb8 100644 --- a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java @@ -17,7 +17,6 @@ package net.dv8tion.jda.internal; import com.neovisionaries.ws.client.WebSocketFactory; -import gnu.trove.map.TLongObjectMap; import gnu.trove.set.TLongSet; import net.dv8tion.jda.api.AccountType; import net.dv8tion.jda.api.GatewayEncoding; @@ -73,7 +72,10 @@ import javax.annotation.Nonnull; import javax.security.auth.login.LoginException; import java.util.*; -import java.util.concurrent.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; import java.util.stream.Collectors; public class JDAImpl implements JDA @@ -345,32 +347,18 @@ else if (response.isRateLimit()) else if (response.code == 401) request.onSuccess(null); else - request.onFailure(new LoginException("When verifying the authenticity of the provided token, Discord returned an unknown response:\n" + - response.toString())); + request.onFailure(response); } }.priority(); - try - { - DataObject userResponse = login.complete(); - if (userResponse != null) - { - getEntityBuilder().createSelfUser(userResponse); - return; - } - shutdownNow(); - throw new LoginException("The provided token is invalid!"); - } - catch (RuntimeException | Error e) + DataObject userResponse = login.complete(); + if (userResponse != null) { - shutdownNow(); - //We check if the LoginException is masked inside of a ExecutionException which is masked inside of the RuntimeException - Throwable ex = e.getCause() instanceof ExecutionException ? e.getCause().getCause() : null; - if (ex instanceof LoginException) - throw new LoginException(ex.getMessage()); - else - throw e; + getEntityBuilder().createSelfUser(userResponse); + return; } + shutdownNow(); + throw new LoginException("The provided token is invalid!"); } public AuthorizationConfig getAuthorizationConfig() @@ -735,17 +723,10 @@ public synchronized void shutdownRequester() private void closeAudioConnections() { - List managers; - AbstractCacheView view = getAudioManagersView(); - try (UnlockHook hook = view.writeLock()) - { - managers = view.stream() - .map(AudioManagerImpl.class::cast) - .collect(Collectors.toList()); - view.clear(); - } - - managers.forEach(m -> m.closeAudioConnection(ConnectionStatus.SHUTTING_DOWN)); + getAudioManagerCache() + .stream() + .map(AudioManagerImpl.class::cast) + .forEach(m -> m.closeAudioConnection(ConnectionStatus.SHUTTING_DOWN)); } @Override From 5696f0fa4eb913da6eb7f2c3523fe3f03d09ed53 Mon Sep 17 00:00:00 2001 From: Caramel Date: Sat, 14 Nov 2020 19:55:33 +0300 Subject: [PATCH 059/121] Uncomment GUILD_WEBHOOKS intent --- .../net/dv8tion/jda/api/requests/GatewayIntent.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java b/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java index a67b2a69fc..b23a41f4b6 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java +++ b/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java @@ -53,6 +53,7 @@ *

  • GUILD_MEMBERS - This is a privileged gateway intent that is used to update user information and join/leaves (including kicks). This is required to cache all members of a guild (including chunking)
  • *
  • GUILD_BANS - This will only track guild bans and unbans
  • *
  • GUILD_EMOJIS - This will only track guild emote create/modify/delete. Most bots don't need this since they just use the emote id anyway.
  • + *
  • GUILD_WEBHOOKS - This will only track guild webhook create/update/delete. Most bots don't need this since related events don't contain any useful information about webhook changes.
  • *
  • GUILD_INVITES - This will only track invite create/delete. Most bots don't make use of invites since they are added through OAuth2 authorization by administrators.
  • *
  • GUILD_VOICE_STATES - Required to properly get information of members in voice channels and cache them. You cannot connect to a voice channel without this intent.
  • *
  • GUILD_PRESENCES - This is a privileged gateway intent this is only used to track activity and online-status of a user.
  • @@ -98,10 +99,10 @@ public enum GatewayIntent // * Integration events. (unused) // */ // GUILD_INTEGRATIONS(4), -// /** -// * Webhook events. (unused) -// */ -// GUILD_WEBHOOKS(5), + /** + * Webhook events. + */ + GUILD_WEBHOOKS(5), /** * Invite events. */ @@ -157,6 +158,7 @@ public enum GatewayIntent *
      *
    • GUILD_MEMBERS (because its privileged)
    • *
    • GUILD_PRESENCES (because its privileged)
    • + *
    • GUILD_WEBHOOKS because its not useful for most bots
    • *
    • GUILD_MESSAGE_TYPING because its not useful for most bots
    • *
    • DIRECT_MESSAGE_TYPING because its not useful for most bots
    • *
    @@ -166,7 +168,7 @@ public enum GatewayIntent * You can further configure intents by using {@link net.dv8tion.jda.api.JDABuilder#enableIntents(GatewayIntent, GatewayIntent...) enableIntents(intents)} * and {@link net.dv8tion.jda.api.JDABuilder#disableIntents(GatewayIntent, GatewayIntent...) disableIntents(intents)}. */ - public static final int DEFAULT = ALL_INTENTS & ~getRaw(GUILD_MEMBERS, GUILD_PRESENCES, GUILD_MESSAGE_TYPING, DIRECT_MESSAGE_TYPING); + public static final int DEFAULT = ALL_INTENTS & ~getRaw(GUILD_MEMBERS, GUILD_PRESENCES, GUILD_WEBHOOKS, GUILD_MESSAGE_TYPING, DIRECT_MESSAGE_TYPING); private final int rawValue; private final int offset; From 59383fc5a7a3492fab8bb921a617c15739b906b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 15 Nov 2020 17:35:43 +0100 Subject: [PATCH 060/121] Fix catch in retrieveWebhooks --- .../java/net/dv8tion/jda/internal/entities/EntityBuilder.java | 4 ++-- .../java/net/dv8tion/jda/internal/entities/GuildImpl.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index e3ea42044d..3d3b839287 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -1401,8 +1401,8 @@ public PermissionOverride createPermissionOverride(DataObject override, Abstract public WebhookImpl createWebhook(DataObject object) { final long id = object.getLong("id"); - final long guildId = object.getLong("guild_id"); - final long channelId = object.getLong("channel_id"); + final long guildId = object.getUnsignedLong("guild_id"); + final long channelId = object.getUnsignedLong("channel_id"); final String token = object.getString("token", null); final WebhookType type = WebhookType.fromKey(object.getInt("type", -1)); diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index b48a032cc4..33f02107e6 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -64,7 +64,6 @@ import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.io.UncheckedIOException; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; import java.util.*; @@ -350,7 +349,7 @@ public RestAction> retrieveWebhooks() { webhooks.add(builder.createWebhook(array.getObject(i))); } - catch (UncheckedIOException | NullPointerException e) + catch (Exception e) { JDAImpl.LOG.error("Error creating webhook from json", e); } From 4b529024eed94c91a4f1bc5319a8ab7740555377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 18 Nov 2020 19:27:09 +0100 Subject: [PATCH 061/121] Implement Role#getTags and add CacheFlag#ROLE_TAGS (#1343) --- .../net/dv8tion/jda/api/entities/Guild.java | 114 ++++++++++++++++++ .../net/dv8tion/jda/api/entities/Role.java | 86 +++++++++++++ .../jda/api/utils/cache/CacheFlag.java | 5 + .../jda/internal/entities/EntityBuilder.java | 3 +- .../jda/internal/entities/RoleImpl.java | 97 +++++++++++++++ .../handle/GuildMemberRemoveHandler.java | 3 +- .../jda/internal/hooks/EventManagerProxy.java | 6 + 7 files changed, 311 insertions(+), 3 deletions(-) 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 2752ea6409..16e19fffa6 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -37,6 +37,7 @@ import net.dv8tion.jda.api.requests.restaction.pagination.AuditLogPaginationAction; import net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction; import net.dv8tion.jda.api.utils.MiscUtil; +import net.dv8tion.jda.api.utils.cache.CacheFlag; import net.dv8tion.jda.api.utils.cache.MemberCacheView; import net.dv8tion.jda.api.utils.cache.SnowflakeCacheView; import net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView; @@ -1578,6 +1579,119 @@ default List getRolesByName(@Nonnull String name, boolean ignoreCase) return getRoleCache().getElementsByName(name, ignoreCase); } + /** + * Looks up a role which is the integration role for a bot. + *
    These roles are created when the bot requested a list of permission in the authorization URL. + * + *

    To check whether a role is a bot role you can use {@code role.getTags().isBot()} and you can use + * {@link Role.RoleTags#getBotIdLong()} to check which bot it applies to. + * + *

    This requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ROLE_TAGS CacheFlag.ROLE_TAGS} to be enabled. + * See {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) JDABuilder.enableCache(...)}. + * + * @param userId + * The user id of the bot + * + * @return The bot role, or null if no role matches + */ + @Nullable + default Role getRoleByBot(long userId) + { + return getRoleCache().applyStream(stream -> + stream.filter(role -> role.getTags().getBotIdLong() == userId) + .findFirst() + .orElse(null) + ); + } + + /** + * Looks up a role which is the integration role for a bot. + *
    These roles are created when the bot requested a list of permission in the authorization URL. + * + *

    To check whether a role is a bot role you can use {@code role.getTags().isBot()} and you can use + * {@link Role.RoleTags#getBotIdLong()} to check which bot it applies to. + * + *

    This requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ROLE_TAGS CacheFlag.ROLE_TAGS} to be enabled. + * See {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) JDABuilder.enableCache(...)}. + * + * @param userId + * The user id of the bot + * + * @throws IllegalArgumentException + * If the userId is null or not a valid snowflake + * + * @return The bot role, or null if no role matches + */ + @Nullable + default Role getRoleByBot(@Nonnull String userId) + { + return getRoleByBot(MiscUtil.parseSnowflake(userId)); + } + + /** + * Looks up a role which is the integration role for a bot. + *
    These roles are created when the bot requested a list of permission in the authorization URL. + * + *

    To check whether a role is a bot role you can use {@code role.getTags().isBot()} and you can use + * {@link Role.RoleTags#getBotIdLong()} to check which bot it applies to. + * + *

    This requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ROLE_TAGS CacheFlag.ROLE_TAGS} to be enabled. + * See {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) JDABuilder.enableCache(...)}. + * + * @param user + * The bot user + * + * @throws IllegalArgumentException + * If null is provided + * + * @return The bot role, or null if no role matches + */ + @Nullable + default Role getRoleByBot(@Nonnull User user) + { + Checks.notNull(user, "User"); + return getRoleByBot(user.getIdLong()); + } + + /** + * Looks up the role which is the integration role for the currently connected bot (self-user). + *
    These roles are created when the bot requested a list of permission in the authorization URL. + * + *

    To check whether a role is a bot role you can use {@code role.getTags().isBot()} and you can use + * {@link Role.RoleTags#getBotIdLong()} to check which bot it applies to. + * + *

    This requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ROLE_TAGS CacheFlag.ROLE_TAGS} to be enabled. + * See {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) JDABuilder.enableCache(...)}. + * + * @return The bot role, or null if no role matches + */ + @Nullable + default Role getBotRole() + { + return getRoleByBot(getJDA().getSelfUser()); + } + + /** + * Looks up the role which is the booster role of this guild. + *
    These roles are created when the first user boosts this guild. + * + *

    To check whether a role is a booster role you can use {@code role.getTags().isBoost()}. + * + *

    This requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ROLE_TAGS CacheFlag.ROLE_TAGS} to be enabled. + * See {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) JDABuilder.enableCache(...)}. + * + * @return The boost role, or null if no role matches + */ + @Nullable + default Role getBoostRole() + { + return getRoleCache().applyStream(stream -> + stream.filter(role -> role.getTags().isBoost()) + .findFirst() + .orElse(null) + ); + } + /** * Sorted {@link net.dv8tion.jda.api.utils.cache.SnowflakeCacheView SnowflakeCacheView} of * all cached {@link net.dv8tion.jda.api.entities.Role Roles} of this Guild. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Role.java b/src/main/java/net/dv8tion/jda/api/entities/Role.java index 2a58e4ae70..4fbdb0935d 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Role.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Role.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.api.managers.RoleManager; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.RoleAction; +import net.dv8tion.jda.api.utils.cache.CacheFlag; import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; @@ -271,4 +272,89 @@ default RoleAction createCopy() */ @Nonnull JDA getJDA(); + + /** + * The tags of this role. + *
    This is useful to determine the purpose of a managed role. + * + *

    This requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ROLE_TAGS CacheFlag.ROLE_TAGS} + * to be enabled. + * See {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) JDABuilder.enableCache(...)}. + * + * @return {@link RoleTags} + */ + @Nonnull + RoleTags getTags(); + + /** + * Tags associated with this role. + */ + interface RoleTags + { + /** + * Whether this role is associated with a bot. + * + * @return True, if this role is for a bot + */ + boolean isBot(); + + /** + * The id for the bot associated with this role. + * + * @return The bot id, or 0 if this role is not for a bot + * + * @see #isBot() + */ + long getBotIdLong(); + + /** + * The id for the bot associated with this role. + * + * @return The bot id, or null if this role is not for a bot + * + * @see #isBot() + */ + @Nullable + default String getBotId() + { + return isBot() ? Long.toUnsignedString(getBotIdLong()) : null; + } + + /** + * Whether this role is the boost role of this guild. + * + * @return True, if this role is the boost role + */ + boolean isBoost(); + + /** + * Whether this role is managed by an integration. + *
    This is usually true for roles such as those created for twitch subscribers. + * + * @return True, if this role is managed by an integration + */ + boolean isIntegration(); + + /** + * The id for the integration associated with this role. + * + * @return The integration id, or 0 if this role is not for an integration + * + * @see #isIntegration() + */ + long getIntegrationIdLong(); + + /** + * The id for the integration associated with this role. + * + * @return The integration id, or null if this role is not for an integration + * + * @see #isIntegration() + */ + @Nullable + default String getIntegrationId() + { + return isIntegration() ? Long.toUnsignedString(getIntegrationIdLong()) : null; + } + } } diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java b/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java index 4953c1582d..7e2d7b3c7b 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java @@ -19,6 +19,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.GuildChannel; import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.requests.GatewayIntent; import javax.annotation.Nullable; @@ -58,6 +59,10 @@ public enum CacheFlag * Enables cache for {@link GuildChannel#getMemberPermissionOverrides()} */ MEMBER_OVERRIDES(null), + /** + * Enables cache for {@link Role#getTags()} + */ + ROLE_TAGS(null), ; private final GatewayIntent requiredIntent; diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index 3d3b839287..f35c0ba10c 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -1040,7 +1040,8 @@ public Role createRole(GuildImpl guild, DataObject roleJson, long guildId) .setManaged(roleJson.getBoolean("managed")) .setHoisted(roleJson.getBoolean("hoist")) .setColor(color == 0 ? Role.DEFAULT_COLOR_RAW : color) - .setMentionable(roleJson.getBoolean("mentionable")); + .setMentionable(roleJson.getBoolean("mentionable")) + .setTags(roleJson.optObject("tags").orElseGet(DataObject::empty)); if (playbackCache) getJDA().getEventCache().playbackCache(EventCache.Type.ROLE, id); return role; diff --git a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java index 2dfb7db255..f49b53fa8b 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java @@ -27,6 +27,8 @@ import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.RoleAction; import net.dv8tion.jda.api.utils.MiscUtil; +import net.dv8tion.jda.api.utils.cache.CacheFlag; +import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.managers.RoleManagerImpl; import net.dv8tion.jda.internal.requests.Route; @@ -40,6 +42,7 @@ import java.time.OffsetDateTime; import java.util.Collection; import java.util.EnumSet; +import java.util.Objects; import java.util.concurrent.locks.ReentrantLock; public class RoleImpl implements Role @@ -51,6 +54,7 @@ public class RoleImpl implements Role private final ReentrantLock mngLock = new ReentrantLock(); private volatile RoleManager manager; + private RoleTagsImpl tags; private String name; private boolean managed; private boolean hoisted; @@ -64,6 +68,7 @@ public RoleImpl(long id, Guild guild) this.id = id; this.api =(JDAImpl) guild.getJDA(); this.guild = guild; + this.tags = api.isCacheFlagSet(CacheFlag.ROLE_TAGS) ? new RoleTagsImpl() : null; } @Override @@ -278,6 +283,13 @@ public JDA getJDA() return api; } + @Nonnull + @Override + public RoleTags getTags() + { + return tags == null ? RoleTagsImpl.EMPTY : tags; + } + @Nonnull @Override public String getAsMention() @@ -383,4 +395,89 @@ public RoleImpl setRawPosition(int rawPosition) this.rawPosition = rawPosition; return this; } + + public RoleImpl setTags(DataObject tags) + { + if (this.tags == null) + return this; + this.tags = new RoleTagsImpl(tags); + return this; + } + + public static class RoleTagsImpl implements RoleTags + { + public static final RoleTags EMPTY = new RoleTagsImpl(); + private final long botId; + private final long integrationId; + private final boolean premiumSubscriber; + + public RoleTagsImpl() + { + this.botId = 0L; + this.integrationId = 0L; + this.premiumSubscriber = false; + } + + public RoleTagsImpl(DataObject tags) + { + this.botId = tags.hasKey("bot_id") ? tags.getUnsignedLong("bot_id") : 0L; + this.integrationId = tags.hasKey("integration_id") ? tags.getUnsignedLong("integration_id") : 0L; + this.premiumSubscriber = tags.hasKey("premium_subscriber"); + } + + @Override + public boolean isBot() + { + return botId != 0; + } + + @Override + public long getBotIdLong() + { + return botId; + } + + @Override + public boolean isBoost() + { + return premiumSubscriber; + } + + @Override + public boolean isIntegration() + { + return integrationId != 0; + } + + @Override + public long getIntegrationIdLong() + { + return integrationId; + } + + @Override + public int hashCode() + { + return Objects.hash(botId, integrationId, premiumSubscriber); + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + return true; + if (!(obj instanceof RoleTagsImpl)) + return false; + RoleTagsImpl other = (RoleTagsImpl) obj; + return botId == other.botId + && integrationId == other.integrationId + && premiumSubscriber == other.premiumSubscriber; + } + + @Override + public String toString() + { + return "RoleTags(bot=" + getBotId() + ",integration=" + getIntegrationId() + ",boost=" + isBoost() + ")"; + } + } } diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java index 67f6356fd2..0aedd7a892 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java @@ -27,7 +27,6 @@ import net.dv8tion.jda.internal.entities.GuildVoiceStateImpl; import net.dv8tion.jda.internal.entities.MemberImpl; import net.dv8tion.jda.internal.entities.VoiceChannelImpl; -import net.dv8tion.jda.internal.requests.WebSocketClient; import net.dv8tion.jda.internal.utils.UnlockHook; import net.dv8tion.jda.internal.utils.cache.SnowflakeCacheViewImpl; @@ -70,7 +69,7 @@ protected Long handleInternally(DataObject content) if (member == null) { - WebSocketClient.LOG.debug("Received GUILD_MEMBER_REMOVE for a Member that does not exist in the specified Guild. UserId: {} GuildId: {}", userId, id); +// WebSocketClient.LOG.debug("Received GUILD_MEMBER_REMOVE for a Member that does not exist in the specified Guild. UserId: {} GuildId: {}", userId, id); // Remove user from voice channel if applicable guild.getVoiceChannelsView().forEachUnordered((channel) -> { VoiceChannelImpl impl = (VoiceChannelImpl) channel; diff --git a/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java b/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java index 7833f4fac5..684ae5d1a4 100644 --- a/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java +++ b/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java @@ -24,6 +24,7 @@ import javax.annotation.Nonnull; import java.util.List; import java.util.concurrent.ExecutorService; +import java.util.concurrent.RejectedExecutionException; public class EventManagerProxy implements IEventManager { @@ -68,6 +69,11 @@ public void handle(@Nonnull GenericEvent event) else handleInternally(event); } + catch (RejectedExecutionException ex) + { + JDAImpl.LOG.warn("Event-Pool rejected event execution! Running on handling thread instead..."); + handleInternally(event); + } catch (Exception ex) { JDAImpl.LOG.error("Encountered exception trying to schedule event", ex); From cc3d1067cbf29c1432b364333d82e18780e7ea52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 19 Nov 2020 18:35:51 +0100 Subject: [PATCH 062/121] Improve reconnect logic for voice sessions after invalidate --- .../dv8tion/jda/internal/audio/AudioWebSocket.java | 7 ++++++- .../jda/internal/requests/WebSocketClient.java | 12 ++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) 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 60a8b36627..9ebe117411 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java @@ -162,7 +162,12 @@ protected void close(final ConnectionStatus closeStatus) //Verify that it is actually a lost of connection and not due the connected channel being deleted. JDAImpl api = getJDA(); - if (status == ConnectionStatus.ERROR_LOST_CONNECTION || status == ConnectionStatus.DISCONNECTED_KICKED_FROM_CHANNEL) + if (status == ConnectionStatus.DISCONNECTED_KICKED_FROM_CHANNEL && (!api.getClient().isSession() || !api.getClient().isConnected())) + { + LOG.debug("Connection was closed due to session invalidate!"); + status = ConnectionStatus.ERROR_CANNOT_RESUME; + } + else if (status == ConnectionStatus.ERROR_LOST_CONNECTION || status == ConnectionStatus.DISCONNECTED_KICKED_FROM_CHANNEL) { //Get guild from JDA, don't use [guild] field to make sure that we don't have // a problem of an out of date guild stored in [guild] during a possible mWS invalidate. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index 0915686f9a..5b66cd829a 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -87,7 +87,7 @@ public class WebSocketClient extends WebSocketAdapter implements WebSocketListen protected final GatewayEncoding encoding; public WebSocket socket; - protected String sessionId = null; + protected volatile String sessionId = null; protected final Object readLock = new Object(); protected Decompressor decompressor; @@ -220,6 +220,11 @@ public boolean isReady() return !initiating; } + public boolean isSession() + { + return sessionId != null; + } + public void handle(List events) { events.forEach(this::onDispatch); @@ -411,6 +416,8 @@ public void onConnected(WebSocket websocket, Map> headers) @Override public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) { + sentAuthInfo = false; + connected = false; // Use a new thread to avoid issues with sleep interruption if (Thread.currentThread().isInterrupted()) { @@ -427,10 +434,7 @@ public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, private void handleDisconnect(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) { - sentAuthInfo = false; - connected = false; api.setStatus(JDA.Status.DISCONNECTED); - CloseCode closeCode = null; int rawCloseCode = 1005; //When we get 1000 from remote close we will try to resume From 2ccd6b90a7a4144f739fe80a7865e6a1dc9281fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 21 Nov 2020 01:16:46 +0100 Subject: [PATCH 063/121] Implement inline replies feature (#1408) * Message#reply and replyFormat * MessageAction#reference and referenceById * MessageAction#mentionRepliedUser and setDefaultMentionRepliedUser isDefaultMentionRepliedUser * New MessageType INLINE_REPLY * Improve handling of mentions in messages --- .../net/dv8tion/jda/api/entities/Message.java | 181 ++++++++++++++++++ .../dv8tion/jda/api/entities/MessageType.java | 5 + .../requests/restaction/MessageAction.java | 108 +++++++++++ .../internal/entities/AbstractMessage.java | 6 + .../jda/internal/entities/EntityBuilder.java | 33 ++-- .../internal/entities/ReceivedMessage.java | 10 +- .../jda/internal/entities/SystemMessage.java | 2 +- .../jda/internal/requests/RestActionImpl.java | 8 +- .../restaction/MessageActionImpl.java | 41 +++- 9 files changed, 371 insertions(+), 23 deletions(-) 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 a8af468060..b1f530d0f9 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -23,6 +23,7 @@ import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.MessageAction; import net.dv8tion.jda.api.requests.restaction.pagination.ReactionPaginationAction; +import net.dv8tion.jda.api.utils.AttachmentOption; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.requests.FunctionalCallback; import net.dv8tion.jda.internal.requests.Requester; @@ -199,6 +200,18 @@ public interface Message extends ISnowflake, Formattable "(?:\\?\\S*)?(?:#\\S*)?", // Useless query or URN appendix Pattern.CASE_INSENSITIVE); + /** + * Referenced message. + * + *

    This will have different meaning depending on the {@link #getType() type} of message. + * Usually, this is a {@link MessageType#INLINE_REPLY INLINE_REPLY} reference. + * This can be null even if the type is {@link MessageType#INLINE_REPLY INLINE_REPLY}, when the message it references doesn't exist or discord wasn't able to resolve it in time. + * + * @return The referenced message, or null + */ + @Nullable + Message getReferencedMessage(); + /** * An immutable list of all mentioned {@link net.dv8tion.jda.api.entities.User Users}. *
    If no user was mentioned, this list is empty. Elements are sorted in order of appearance. This only @@ -948,6 +961,174 @@ default boolean isFromGuild() @CheckReturnValue MessageAction editMessage(@Nonnull Message newContent); + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendMessage(content).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendMessage(CharSequence)} and {@link MessageAction#reference(Message)}. + * + * @param content + * The content of the reply message + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction reply(@Nonnull CharSequence content) + { + return getChannel().sendMessage(content).reference(this); + } + + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendMessage(content).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendMessage(MessageEmbed)} and {@link MessageAction#reference(Message)}. + * + * @param content + * The content of the reply message + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction reply(@Nonnull MessageEmbed content) + { + return getChannel().sendMessage(content).reference(this); + } + + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendMessage(content).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendMessage(Message)} and {@link MessageAction#reference(Message)}. + * + * @param content + * The content of the reply message + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction reply(@Nonnull Message content) + { + return getChannel().sendMessage(content).reference(this); + } + + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendMessageFormat(content, args).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendMessageFormat(String, Object...)} and {@link MessageAction#reference(Message)}. + * + * @param format + * The string that should be formatted, if this is null or empty the content of the Message would be empty and cause a builder exception. + * @param args + * The arguments for your format + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction replyFormat(@Nonnull String format, @Nonnull Object... args) + { + return getChannel().sendMessageFormat(format, args).reference(this); + } + + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendFile(file, options).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendFile(File, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. + * + * @param file + * The file to upload to the channel in the reply + * @param options + * Possible options to apply to this attachment, such as marking it as spoiler image + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction reply(@Nonnull File file, @Nonnull AttachmentOption... options) + { + return getChannel().sendFile(file, options).reference(this); + } + + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendFile(data, name, options).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendFile(File, String, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. + * + * @param data + * The data to upload to the channel in the reply + * @param name + * The name that should be sent to discord + * @param options + * Possible options to apply to this attachment, such as marking it as spoiler image + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction reply(@Nonnull File data, @Nonnull String name, @Nonnull AttachmentOption... options) + { + return getChannel().sendFile(data, name, options).reference(this); + } + + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendFile(data, name, options).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendFile(InputStream, String, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. + * + * @param data + * The data to upload to the channel in the reply + * @param name + * The name that should be sent to discord + * @param options + * Possible options to apply to this attachment, such as marking it as spoiler image + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction reply(@Nonnull InputStream data, @Nonnull String name, @Nonnull AttachmentOption... options) + { + return getChannel().sendFile(data, name, options).reference(this); + } + + /** + * Replies and references this message. + *
    This is identical to {@code message.getChannel().sendFile(data, name, options).reference(message)}. + * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + * + *

    For further info, see {@link MessageChannel#sendFile(byte[], String, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. + * + * @param data + * The data to upload to the channel in the reply + * @param name + * The name that should be sent to discord + * @param options + * Possible options to apply to this attachment, such as marking it as spoiler image + * + * @return {@link MessageAction} Providing the {@link Message} created from this upload. + */ + @Nonnull + @CheckReturnValue + default MessageAction reply(@Nonnull byte[] data, @Nonnull String name, @Nonnull AttachmentOption... options) + { + return getChannel().sendFile(data, name, options).reference(this); + } + /** * Deletes this Message from Discord. *
    If this Message was not sent by the currently logged in account, then this will fail unless the Message is from diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageType.java b/src/main/java/net/dv8tion/jda/api/entities/MessageType.java index ca94ba98ee..6030574ddf 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageType.java @@ -88,6 +88,11 @@ public enum MessageType */ CHANNEL_FOLLOW_ADD(12), + /** + * Reply to another message. This usually comes with a {@link Message#getReferencedMessage() referenced message}. + */ + INLINE_REPLY(19), + /** * Unknown MessageType. */ diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java index f533bc916c..db38314a6c 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java @@ -16,12 +16,14 @@ package net.dv8tion.jda.api.requests.restaction; +import net.dv8tion.jda.api.MessageBuilder; import net.dv8tion.jda.api.entities.IMentionable; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.utils.AttachmentOption; +import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.requests.restaction.MessageActionImpl; import net.dv8tion.jda.internal.utils.Checks; @@ -123,6 +125,33 @@ static EnumSet getDefaultMentions() return MessageActionImpl.getDefaultMentions(); } + /** + * Sets the default value for {@link #mentionRepliedUser(boolean)} + * + *

    Default: true + * + * @param mention + * True, if replies should mention by default + */ + static void setDefaultMentionRepliedUser(boolean mention) + { + MessageActionImpl.setDefaultMentionRepliedUser(mention); + } + + /** + * Returns the default mention behavior for replies. + *
    If this is {@code true} then all replies will mention the author of the target message by default. + * You can specify this individually with {@link #mentionRepliedUser(boolean)} for each message. + * + *

    Default: true + * + * @return True, if replies mention by default + */ + static boolean isDefaultMentionRepliedUser() + { + return MessageActionImpl.isDefaultMentionRepliedUser(); + } + @Nonnull @Override MessageAction setCheck(@Nullable BooleanSupplier checks); @@ -181,6 +210,85 @@ static EnumSet getDefaultMentions() @CheckReturnValue MessageAction apply(@Nullable final Message message); + /** + * Make the message a reply to the referenced message. + *
    You can only reply to messages from the same channel! + *
    This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. + * + *

    This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! + * + * @param messageId + * The target message + * + * @return Updated MessageAction for chaining convenience + */ + @Nonnull + @CheckReturnValue + MessageAction referenceById(long messageId); + + /** + * Make the message a reply to the referenced message. + *
    You can only reply to messages from the same channel! + *
    This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. + * + *

    This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! + * You cannot reply to system messages (such as {@link net.dv8tion.jda.api.entities.MessageType#CHANNEL_PINNED_ADD CHANNEL_PINNED_ADD} and similar). + * + * @param messageId + * The target message + * + * @throws IllegalArgumentException + * If the provided ID is null or not a valid snowflake + * + * @return Updated MessageAction for chaining convenience + */ + @Nonnull + @CheckReturnValue + default MessageAction referenceById(@Nonnull String messageId) + { + return referenceById(MiscUtil.parseSnowflake(messageId)); + } + + /** + * Make the message a reply to the referenced message. + *
    You can only reply to messages from the same channel! + *
    This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. + * + *

    This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! + * + * @param message + * The target message + * + * @throws IllegalArgumentException + * If the provided message is null + * @throws UnsupportedOperationException + * If the provided message is from a {@link MessageBuilder} + * + * @return Updated MessageAction for chaining convenience + */ + @Nonnull + @CheckReturnValue + default MessageAction reference(@Nonnull Message message) + { + Checks.notNull(message, "Message"); + return referenceById(message.getIdLong()); + } + + /** + * Whether to mention the used, when replying to a message. + *
    This only matters in combination with {@link #reference(Message)} and {@link #referenceById(long)}! + * + *

    This is true by default but can be configured using {@link #setDefaultMentionRepliedUser(boolean)}! + * + * @param mention + * True, to mention the author if the referenced message + * + * @return Updated MessageAction for chaining convenience + */ + @Nonnull + @CheckReturnValue + MessageAction mentionRepliedUser(boolean mention); + /** * Enable/Disable Text-To-Speech for the resulting message. *
    This is only relevant to MessageActions that are not {@code isEdit() == true}! diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java index 0db4a965ee..b8ae9466f7 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java @@ -106,6 +106,12 @@ protected void appendFormat(Formatter formatter, int width, int precision, boole } } + @Override + public Message getReferencedMessage() + { + return null; + } + @Nonnull @Override public Bag getMentionedUsersBag() diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index f35c0ba10c..a631481921 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -1140,10 +1140,18 @@ public Message createMessage(DataObject jsonObject, MessageChannel chan, boolean MessageType type = MessageType.fromId(jsonObject.getInt("type")); ReceivedMessage message; + Message referencedMessage = null; + if (!jsonObject.isNull("referenced_message")) + { + referencedMessage = createMessage(jsonObject.getObject("referenced_message"), chan, false); + if (type == MessageType.DEFAULT) + type = MessageType.INLINE_REPLY; + } switch (type) { + case INLINE_REPLY: case DEFAULT: - message = new ReceivedMessage(id, chan, type, fromWebhook, + message = new ReceivedMessage(id, chan, type, referencedMessage, fromWebhook, mentionsEveryone, mentionedUsers, mentionedRoles, tts, pinned, content, nonce, user, member, activity, editTime, reactions, attachments, embeds, flags); break; @@ -1156,14 +1164,7 @@ public Message createMessage(DataObject jsonObject, MessageChannel chan, boolean break; } - if (!message.isFromGuild()) - return message; - - GuildImpl guild = (GuildImpl) message.getGuild(); - - // Don't do more computations when members are loaded already - if (guild.isLoaded()) - return message; + GuildImpl guild = message.isFromGuild() ? (GuildImpl) message.getGuild() : null; // Load users/members from message object through mentions List mentionedUsersList = new ArrayList<>(); @@ -1173,14 +1174,17 @@ public Message createMessage(DataObject jsonObject, MessageChannel chan, boolean for (int i = 0; i < userMentions.length(); i++) { DataObject mentionJson = userMentions.getObject(i); - if (mentionJson.isNull("member")) + if (guild == null || mentionJson.isNull("member")) { // Can't load user without member context so fake them if possible User mentionedUser = createUser(mentionJson); mentionedUsersList.add(mentionedUser); - Member mentionedMember = guild.getMember(mentionedUser); - if (mentionedMember != null) - mentionedMembersList.add(mentionedMember); + if (guild != null) + { + Member mentionedMember = guild.getMember(mentionedUser); + if (mentionedMember != null) + mentionedMembersList.add(mentionedMember); + } continue; } @@ -1193,8 +1197,7 @@ public Message createMessage(DataObject jsonObject, MessageChannel chan, boolean mentionedUsersList.add(mentionedMember.getUser()); } - if (!mentionedUsersList.isEmpty()) - message.setMentions(mentionedUsersList, mentionedMembersList); + message.setMentions(mentionedUsersList, mentionedMembersList); return message; } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java index d67e56e1c6..8ffb3ffc6f 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java @@ -55,6 +55,7 @@ public class ReceivedMessage extends AbstractMessage protected final long id; protected final MessageType type; protected final MessageChannel channel; + protected final Message referencedMessage; protected final boolean fromWebhook; protected final boolean mentionsEveryone; protected final boolean pinned; @@ -81,7 +82,7 @@ public class ReceivedMessage extends AbstractMessage protected List invites = null; public ReceivedMessage( - long id, MessageChannel channel, MessageType type, + long id, MessageChannel channel, MessageType type, Message referencedMessage, boolean fromWebhook, boolean mentionsEveryone, TLongSet mentionedUsers, TLongSet mentionedRoles, boolean tts, boolean pinned, String content, String nonce, User author, Member member, MessageActivity activity, OffsetDateTime editTime, List reactions, List attachments, List embeds, int flags) @@ -89,6 +90,7 @@ public ReceivedMessage( super(content, nonce, tts); this.id = id; this.channel = channel; + this.referencedMessage = referencedMessage; this.type = type; this.api = (channel != null) ? (JDAImpl) channel.getJDA() : null; this.fromWebhook = fromWebhook; @@ -113,6 +115,12 @@ public JDA getJDA() return api; } + @Override + public Message getReferencedMessage() + { + return referencedMessage; + } + @Override public boolean isPinned() { diff --git a/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java index ddf475f5d6..a628ad67ab 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java @@ -34,7 +34,7 @@ public SystemMessage( String content, String nonce, User author, Member member, MessageActivity activity, OffsetDateTime editTime, List reactions, List attachments, List embeds, int flags) { - super(id, channel, type, fromWebhook, mentionsEveryone, mentionedUsers, mentionedRoles, + super(id, channel, type, null, fromWebhook, mentionsEveryone, mentionedUsers, mentionedRoles, tts, pinned, content, nonce, author, member, activity, editTime, reactions, attachments, embeds, flags); } diff --git a/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java index 11e206df40..0b6a070cf1 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java @@ -223,12 +223,14 @@ public T complete(boolean shouldQueue) throws RateLimitedException if (e.getCause() != null) { Throwable cause = e.getCause(); + if (cause instanceof ErrorResponseException) + throw (ErrorResponseException) cause.fillInStackTrace(); // this method will update the stacktrace to the current thread stack + if (cause instanceof RateLimitedException) + throw (RateLimitedException) cause.fillInStackTrace(); if (cause instanceof RuntimeException) throw (RuntimeException) cause; - else if (cause instanceof Error) + if (cause instanceof Error) throw (Error) cause; - else if (cause instanceof RateLimitedException) - throw (RateLimitedException) cause; } throw e; } diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java index a0ac3df566..42e97f968c 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java @@ -52,6 +52,7 @@ public class MessageActionImpl extends RestActionImpl implements Messag { private static final String CONTENT_TOO_BIG = String.format("A message may not exceed %d characters. Please limit your input!", Message.MAX_CONTENT_LENGTH); protected static EnumSet defaultMentions = EnumSet.allOf(Message.MentionType.class); + protected static boolean defaultMentionRepliedUser = true; protected final Map files = new HashMap<>(); protected final Set ownedResources = new HashSet<>(); protected final StringBuilder content; @@ -59,9 +60,11 @@ public class MessageActionImpl extends RestActionImpl implements Messag protected MessageEmbed embed = null; protected String nonce = null; protected boolean tts = false, override = false; + protected boolean mentionRepliedUser = defaultMentionRepliedUser; protected EnumSet allowedMentions; protected Set mentionableUsers = new HashSet<>(); protected Set mentionableRoles = new HashSet<>(); + protected long messageReference; public static void setDefaultMentions(@Nullable Collection allowedMentions) { @@ -76,6 +79,16 @@ public static EnumSet getDefaultMentions() return defaultMentions.clone(); } + public static void setDefaultMentionRepliedUser(boolean mention) + { + defaultMentionRepliedUser = mention; + } + + public static boolean isDefaultMentionRepliedUser() + { + return defaultMentionRepliedUser; + } + public MessageActionImpl(JDA api, Route.CompiledRoute route, MessageChannel channel) { super(api, route); @@ -185,6 +198,22 @@ public MessageActionImpl apply(final Message message) return content(content).tts(message.isTTS()); } + @Nonnull + @Override + public MessageActionImpl referenceById(long messageId) + { + messageReference = messageId; + return this; + } + + @Nonnull + @Override + public MessageAction mentionRepliedUser(boolean mention) + { + mentionRepliedUser = mention; + return this; + } + @Nonnull @Override @CheckReturnValue @@ -480,11 +509,15 @@ protected DataObject getJSON() if (nonce != null) obj.put("nonce", nonce); } - obj.put("tts", tts); - if (allowedMentions != null || !mentionableUsers.isEmpty() || !mentionableRoles.isEmpty()) + if (messageReference != 0) { - obj.put("allowed_mentions", getAllowedMentionsObj()); + obj.put("message_reference", DataObject.empty() + .put("message_id", messageReference) + .put("channel_id", channel.getId())); } + obj.put("tts", tts); + if ((messageReference != 0L && !mentionRepliedUser) || allowedMentions != null || !mentionableUsers.isEmpty() || !mentionableRoles.isEmpty()) + obj.put("allowed_mentions", getAllowedMentionsObj()); return obj; } @@ -513,6 +546,8 @@ protected DataObject getAllowedMentionsObj() parsable.remove(Message.MentionType.ROLE.getParseKey()); allowedMentionsObj.put("roles", DataArray.fromCollection(mentionableRoles)); } + if (messageReference != 0L) + allowedMentionsObj.put("replied_user", mentionRepliedUser); return allowedMentionsObj.put("parse", parsable); } From 8cffb0a24efc14e01b46df096cd35c38360d3063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 21 Nov 2020 15:17:28 +0100 Subject: [PATCH 064/121] Fix replies with only a file --- .../jda/internal/requests/restaction/MessageActionImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java index 42e97f968c..3a84ec9373 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java @@ -469,7 +469,7 @@ protected RequestBody asMultipart() final RequestBody body = IOUtil.createRequestBody(Requester.MEDIA_TYPE_OCTET, entry.getValue()); builder.addFormDataPart("file" + index++, entry.getKey(), body); } - if (!isEmpty()) + if (messageReference != 0L || !isEmpty()) builder.addFormDataPart("payload_json", getJSON().toString()); // clear remaining resources, they will be closed after being sent files.clear(); From ea9b459497ccae67c4204f8a4bd1489dd57f7a60 Mon Sep 17 00:00:00 2001 From: Andre_601 <11576465+Andre601@users.noreply.github.com> Date: Mon, 23 Nov 2020 17:55:16 +0100 Subject: [PATCH 065/121] Add GuildChannel#isSynced() method (#1409) --- .../net/dv8tion/jda/api/entities/GuildChannel.java | 9 ++++++++- .../jda/internal/entities/AbstractChannelImpl.java | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java index 6d2a189dd4..f6bc9573b8 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java @@ -66,7 +66,7 @@ public interface GuildChannel extends ISnowflake, Comparable /** * Parent {@link net.dv8tion.jda.api.entities.Category Category} of this - * GuildChannel. Channels need not have a parent Category. + * GuildChannel. Channels don't need to have a parent Category. *
    Note that an {@link net.dv8tion.jda.api.entities.Category Category} will * always return {@code null} for this method as nested categories are not supported. * @@ -179,6 +179,13 @@ public interface GuildChannel extends ISnowflake, Comparable @Nonnull List getRolePermissionOverrides(); + /** + * Whether or not this GuildChannel's {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} match + * those of {@link #getParent() its parent category}. If the channel doesn't have a parent category this will return true. + * + * @return True, if this channel is synced with its parent category + */ + boolean isSynced(); /** * Creates a copy of the specified {@link GuildChannel GuildChannel} * in the specified {@link net.dv8tion.jda.api.entities.Guild Guild}. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java index c58d06c17b..5d5fdb514f 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java @@ -38,6 +38,7 @@ import net.dv8tion.jda.internal.requests.restaction.InviteActionImpl; import net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl; import net.dv8tion.jda.internal.utils.Checks; +import net.dv8tion.jda.internal.utils.Helpers; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -160,6 +161,15 @@ public List getRolePermissionOverrides() .collect(Collectors.toList())); } + @Override + public boolean isSynced() + { + if (getParent() == null) + return true; // Channels without a parent category are always considered synced. Also the case for categories. + + return Helpers.deepEqualsUnordered(getParent().getPermissionOverrides(), getPermissionOverrides()); + } + @Nonnull @Override public ChannelManager getManager() From f2391d931943f329a4f0b6afb7928b3a198a4eac Mon Sep 17 00:00:00 2001 From: Andre_601 <11576465+Andre601@users.noreply.github.com> Date: Sat, 19 Dec 2020 10:38:29 +0100 Subject: [PATCH 066/121] Add ActivityType.COMPETING (#1471) --- .../dv8tion/jda/api/entities/Activity.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/Activity.java b/src/main/java/net/dv8tion/jda/api/entities/Activity.java index 06813721e4..f670a1aa44 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Activity.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Activity.java @@ -204,6 +204,27 @@ static Activity watching(@Nonnull String name) return EntityBuilder.createActivity(name, null, ActivityType.WATCHING); } + /** + * Creates a new Activity instance with the specified name. + *
    This will display as {@code Competing in name} in the official client + * + * @param name + * The not-null name of the newly created game + * + * @throws IllegalArgumentException + * If the specified name is null, empty, blank or longer than 128 characters + * + * @return A valid Activity instance with the provided name with {@link net.dv8tion.jda.api.entities.Activity.ActivityType#COMPETING} + */ + @Nonnull + static Activity competing(@Nonnull String name) + { + Checks.notBlank(name, "Name"); + name = name.trim(); + Checks.check(name.length() <= 128, "Name must not be greater than 128 characters in length"); + return EntityBuilder.createActivity(name, null, ActivityType.COMPETING); + } + /** * Creates a new Activity instance with the specified name and url. * @@ -256,6 +277,8 @@ static Activity of(@Nonnull ActivityType type, @Nonnull String name, @Nullable S return listening(name); case WATCHING: return watching(name); + case COMPETING: + return competing(name); default: throw new IllegalArgumentException("ActivityType " + type + " is not supported!"); } @@ -308,7 +331,13 @@ enum ActivityType * @incubating This feature is currently not officially documented and might change */ @Incubating - CUSTOM_STATUS(4); + CUSTOM_STATUS(4), + + /** + * Used to indicate that the {@link Activity Activity} should display + * as {@code Competing in...} in the official client. + */ + COMPETING(5); private final int key; @@ -352,6 +381,8 @@ public static ActivityType fromKey(int key) return WATCHING; case 4: return CUSTOM_STATUS; + case 5: + return COMPETING; } } } From ffa9d9a71e49d9757be73c0a748724b0f0e7406c Mon Sep 17 00:00:00 2001 From: caneleex Date: Thu, 24 Dec 2020 13:11:09 +0100 Subject: [PATCH 067/121] fix generic reaction event for GatewayIntent.fromEvents --- src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java b/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java index b23a41f4b6..243a150333 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java +++ b/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java @@ -31,6 +31,7 @@ import net.dv8tion.jda.api.events.message.guild.react.GenericGuildMessageReactionEvent; import net.dv8tion.jda.api.events.message.priv.GenericPrivateMessageEvent; import net.dv8tion.jda.api.events.message.priv.react.GenericPrivateMessageReactionEvent; +import net.dv8tion.jda.api.events.message.react.GenericMessageReactionEvent; import net.dv8tion.jda.api.events.user.UserTypingEvent; import net.dv8tion.jda.api.events.user.update.GenericUserPresenceEvent; import net.dv8tion.jda.api.events.user.update.GenericUserUpdateEvent; @@ -370,6 +371,9 @@ else if (GenericPrivateMessageReactionEvent.class.isAssignableFrom(event)) else if (GenericPrivateMessageEvent.class.isAssignableFrom(event)) intents.add(DIRECT_MESSAGES); + else if (GenericMessageReactionEvent.class.isAssignableFrom(event)) + Collections.addAll(intents, GUILD_MESSAGE_REACTIONS, DIRECT_MESSAGE_REACTIONS); + else if (GenericMessageEvent.class.isAssignableFrom(event)) Collections.addAll(intents, GUILD_MESSAGES, DIRECT_MESSAGES); From a52eae41a6c17dc45050ee018623a430ab6366e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 26 Dec 2020 20:02:54 +0100 Subject: [PATCH 068/121] Implement new event hierarchy handling with ClassWalker (#1463) This changes the implementation of onEvent in ListenerAdapter to be more maintainable --- .../voice/GenericGuildVoiceUpdateEvent.java | 2 +- .../jda/api/hooks/AnnotatedEventManager.java | 8 +- .../jda/api/hooks/ListenerAdapter.java | 437 ++---------------- .../jda/internal/utils/ClassWalker.java | 86 ++++ 4 files changed, 130 insertions(+), 403 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java index fc28701cf8..376b76b63a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java @@ -23,7 +23,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -class GenericGuildVoiceUpdateEvent extends GenericGuildVoiceEvent implements GuildVoiceUpdateEvent +public class GenericGuildVoiceUpdateEvent extends GenericGuildVoiceEvent implements GuildVoiceUpdateEvent { protected final VoiceChannel joined, left; diff --git a/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java b/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java index 948e0d117f..2ef282fb9c 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java @@ -15,9 +15,9 @@ */ package net.dv8tion.jda.api.hooks; -import net.dv8tion.jda.api.events.Event; import net.dv8tion.jda.api.events.GenericEvent; import net.dv8tion.jda.internal.JDAImpl; +import net.dv8tion.jda.internal.utils.ClassWalker; import javax.annotation.Nonnull; import java.lang.reflect.InvocationTargetException; @@ -80,11 +80,9 @@ public List getRegisteredListeners() } @Override - @SuppressWarnings("unchecked") public void handle(@Nonnull GenericEvent event) { - Class eventClass = event.getClass(); - do + for (Class eventClass : ClassWalker.walk(event.getClass())) { Map> listeners = methods.get(eventClass); if (listeners != null) @@ -108,9 +106,7 @@ public void handle(@Nonnull GenericEvent event) } })); } - eventClass = eventClass == Event.class ? null : (Class) eventClass.getSuperclass(); } - while (eventClass != null); } private void updateMethods() diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 7ac1a7ba71..56dbc8470c 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -82,8 +82,11 @@ import net.dv8tion.jda.api.events.user.UserActivityStartEvent; import net.dv8tion.jda.api.events.user.UserTypingEvent; import net.dv8tion.jda.api.events.user.update.*; +import net.dv8tion.jda.internal.utils.ClassWalker; import javax.annotation.Nonnull; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; /** * An abstract implementation of {@link net.dv8tion.jda.api.hooks.EventListener EventListener} which divides {@link net.dv8tion.jda.api.events.Event Events} @@ -148,6 +151,18 @@ public void onGuildMemberLeave(@Nonnull GuildMemberLeaveEvent event) {} @DeprecatedSince("4.2.0") public void onSelfUpdateEmail(@Nonnull SelfUpdateEmailEvent event) {} + @Deprecated + @ForRemoval + @DeprecatedSince("4.2.1") + @ReplaceWith("onResumed(ResumedEvent)") + public void onResume(@Nonnull ResumedEvent event) {} + + @Deprecated + @ForRemoval + @DeprecatedSince("4.2.1") + @ReplaceWith("onReconnected(ReconnectedEvent)") + public void onReconnect(@Nonnull ReconnectedEvent event) {} + public void onGenericEvent(@Nonnull GenericEvent event) {} public void onGenericUpdate(@Nonnull UpdateEvent event) {} public void onRawGateway(@Nonnull RawGatewayEvent event) {} @@ -155,8 +170,8 @@ public void onGatewayPing(@Nonnull GatewayPingEvent event) {} //JDA Events public void onReady(@Nonnull ReadyEvent event) {} - public void onResume(@Nonnull ResumedEvent event) {} - public void onReconnect(@Nonnull ReconnectedEvent event) {} + public void onResumed(@Nonnull ResumedEvent event) {} + public void onReconnected(@Nonnull ReconnectedEvent event) {} public void onDisconnect(@Nonnull DisconnectEvent event) {} public void onShutdown(@Nonnull ShutdownEvent event) {} public void onStatusChange(@Nonnull StatusChangeEvent event) {} @@ -372,403 +387,33 @@ public final void onEvent(@Nonnull GenericEvent event) onGenericEvent(event); if (event instanceof UpdateEvent) onGenericUpdate((UpdateEvent) event); - else if (event instanceof RawGatewayEvent) - onRawGateway((RawGatewayEvent) event); - //JDA Events - if (event instanceof ReadyEvent) - onReady((ReadyEvent) event); - else if (event instanceof ResumedEvent) + //TODO: Remove once deprecated methods are removed + if (event instanceof ResumedEvent) onResume((ResumedEvent) event); else if (event instanceof ReconnectedEvent) onReconnect((ReconnectedEvent) event); - else if (event instanceof DisconnectEvent) - onDisconnect((DisconnectEvent) event); - else if (event instanceof ShutdownEvent) - onShutdown((ShutdownEvent) event); - else if (event instanceof StatusChangeEvent) - onStatusChange((StatusChangeEvent) event); - else if (event instanceof ExceptionEvent) - onException((ExceptionEvent) event); - else if (event instanceof GatewayPingEvent) - onGatewayPing((GatewayPingEvent) event); - - //Message Events - //Guild (TextChannel) Message Events - else if (event instanceof GuildMessageReceivedEvent) - onGuildMessageReceived((GuildMessageReceivedEvent) event); - else if (event instanceof GuildMessageUpdateEvent) - onGuildMessageUpdate((GuildMessageUpdateEvent) event); - else if (event instanceof GuildMessageDeleteEvent) - onGuildMessageDelete((GuildMessageDeleteEvent) event); - else if (event instanceof GuildMessageEmbedEvent) - onGuildMessageEmbed((GuildMessageEmbedEvent) event); - else if (event instanceof GuildMessageReactionAddEvent) - onGuildMessageReactionAdd((GuildMessageReactionAddEvent) event); - else if (event instanceof GuildMessageReactionRemoveEvent) - onGuildMessageReactionRemove((GuildMessageReactionRemoveEvent) event); - else if (event instanceof GuildMessageReactionRemoveAllEvent) - onGuildMessageReactionRemoveAll((GuildMessageReactionRemoveAllEvent) event); - else if (event instanceof GuildMessageReactionRemoveEmoteEvent) - onGuildMessageReactionRemoveEmote((GuildMessageReactionRemoveEmoteEvent) event); - - //Private Message Events - else if (event instanceof PrivateMessageReceivedEvent) - onPrivateMessageReceived((PrivateMessageReceivedEvent) event); - else if (event instanceof PrivateMessageUpdateEvent) - onPrivateMessageUpdate((PrivateMessageUpdateEvent) event); - else if (event instanceof PrivateMessageDeleteEvent) - onPrivateMessageDelete((PrivateMessageDeleteEvent) event); - else if (event instanceof PrivateMessageEmbedEvent) - onPrivateMessageEmbed((PrivateMessageEmbedEvent) event); - else if (event instanceof PrivateMessageReactionAddEvent) - onPrivateMessageReactionAdd((PrivateMessageReactionAddEvent) event); - else if (event instanceof PrivateMessageReactionRemoveEvent) - onPrivateMessageReactionRemove((PrivateMessageReactionRemoveEvent) event); - - //Combined Message Events (Combines Guild and Private message into 1 event) - else if (event instanceof MessageReceivedEvent) - onMessageReceived((MessageReceivedEvent) event); - else if (event instanceof MessageUpdateEvent) - onMessageUpdate((MessageUpdateEvent) event); - else if (event instanceof MessageDeleteEvent) - onMessageDelete((MessageDeleteEvent) event); - else if (event instanceof MessageBulkDeleteEvent) - onMessageBulkDelete((MessageBulkDeleteEvent) event); - else if (event instanceof MessageEmbedEvent) - onMessageEmbed((MessageEmbedEvent) event); - else if (event instanceof MessageReactionAddEvent) - onMessageReactionAdd((MessageReactionAddEvent) event); - else if (event instanceof MessageReactionRemoveEvent) - onMessageReactionRemove((MessageReactionRemoveEvent) event); - else if (event instanceof MessageReactionRemoveAllEvent) - onMessageReactionRemoveAll((MessageReactionRemoveAllEvent) event); - else if (event instanceof MessageReactionRemoveEmoteEvent) - onMessageReactionRemoveEmote((MessageReactionRemoveEmoteEvent) event); - - //User Events - else if (event instanceof UserUpdateNameEvent) - onUserUpdateName((UserUpdateNameEvent) event); - else if (event instanceof UserUpdateDiscriminatorEvent) - onUserUpdateDiscriminator((UserUpdateDiscriminatorEvent) event); - else if (event instanceof UserUpdateAvatarEvent) - onUserUpdateAvatar((UserUpdateAvatarEvent) event); - else if (event instanceof UserUpdateActivityOrderEvent) - onUserUpdateActivityOrder((UserUpdateActivityOrderEvent) event); - else if (event instanceof UserUpdateOnlineStatusEvent) - onUserUpdateOnlineStatus((UserUpdateOnlineStatusEvent) event); - else if (event instanceof UserTypingEvent) - onUserTyping((UserTypingEvent) event); - else if (event instanceof UserActivityStartEvent) - onUserActivityStart((UserActivityStartEvent) event); - else if (event instanceof UserActivityEndEvent) - onUserActivityEnd((UserActivityEndEvent) event); - else if (event instanceof UserUpdateFlagsEvent) - onUserUpdateFlags((UserUpdateFlagsEvent) event); - - //Self Events - else if (event instanceof SelfUpdateAvatarEvent) - onSelfUpdateAvatar((SelfUpdateAvatarEvent) event); - else if (event instanceof SelfUpdateMFAEvent) - onSelfUpdateMFA((SelfUpdateMFAEvent) event); - else if (event instanceof SelfUpdateNameEvent) - onSelfUpdateName((SelfUpdateNameEvent) event); - else if (event instanceof SelfUpdateVerifiedEvent) - onSelfUpdateVerified((SelfUpdateVerifiedEvent) event); - - //PermissionOverride Events - else if (event instanceof PermissionOverrideDeleteEvent) - onPermissionOverrideDelete((PermissionOverrideDeleteEvent) event); - else if (event instanceof PermissionOverrideUpdateEvent) - onPermissionOverrideUpdate((PermissionOverrideUpdateEvent) event); - else if (event instanceof PermissionOverrideCreateEvent) - onPermissionOverrideCreate((PermissionOverrideCreateEvent) event); - - //StoreChannel Events - else if (event instanceof StoreChannelCreateEvent) - onStoreChannelCreate((StoreChannelCreateEvent) event); - else if (event instanceof StoreChannelDeleteEvent) - onStoreChannelDelete((StoreChannelDeleteEvent) event); - else if (event instanceof StoreChannelUpdateNameEvent) - onStoreChannelUpdateName((StoreChannelUpdateNameEvent) event); - else if (event instanceof StoreChannelUpdatePositionEvent) - onStoreChannelUpdatePosition((StoreChannelUpdatePositionEvent) event); - else if (event instanceof StoreChannelUpdatePermissionsEvent) - onStoreChannelUpdatePermissions((StoreChannelUpdatePermissionsEvent) event); - - //TextChannel Events - else if (event instanceof TextChannelCreateEvent) - onTextChannelCreate((TextChannelCreateEvent) event); - else if (event instanceof TextChannelUpdateNameEvent) - onTextChannelUpdateName((TextChannelUpdateNameEvent) event); - else if (event instanceof TextChannelUpdateTopicEvent) - onTextChannelUpdateTopic((TextChannelUpdateTopicEvent) event); - else if (event instanceof TextChannelUpdatePositionEvent) - onTextChannelUpdatePosition((TextChannelUpdatePositionEvent) event); - else if (event instanceof TextChannelUpdateNSFWEvent) - onTextChannelUpdateNSFW((TextChannelUpdateNSFWEvent) event); - else if (event instanceof TextChannelUpdateParentEvent) - onTextChannelUpdateParent((TextChannelUpdateParentEvent) event); - else if (event instanceof TextChannelUpdateSlowmodeEvent) - onTextChannelUpdateSlowmode((TextChannelUpdateSlowmodeEvent) event); - else if (event instanceof TextChannelDeleteEvent) - onTextChannelDelete((TextChannelDeleteEvent) event); - else if (event instanceof TextChannelUpdatePermissionsEvent) - onTextChannelUpdatePermissions((TextChannelUpdatePermissionsEvent) event); - else if (event instanceof TextChannelUpdateNewsEvent) - onTextChannelUpdateNews((TextChannelUpdateNewsEvent) event); - - //VoiceChannel Events - else if (event instanceof VoiceChannelCreateEvent) - onVoiceChannelCreate((VoiceChannelCreateEvent) event); - else if (event instanceof VoiceChannelUpdateNameEvent) - onVoiceChannelUpdateName((VoiceChannelUpdateNameEvent) event); - else if (event instanceof VoiceChannelUpdatePositionEvent) - onVoiceChannelUpdatePosition((VoiceChannelUpdatePositionEvent) event); - else if (event instanceof VoiceChannelUpdateUserLimitEvent) - onVoiceChannelUpdateUserLimit((VoiceChannelUpdateUserLimitEvent) event); - else if (event instanceof VoiceChannelUpdateBitrateEvent) - onVoiceChannelUpdateBitrate((VoiceChannelUpdateBitrateEvent) event); - else if (event instanceof VoiceChannelUpdateParentEvent) - onVoiceChannelUpdateParent((VoiceChannelUpdateParentEvent) event); - else if (event instanceof VoiceChannelDeleteEvent) - onVoiceChannelDelete((VoiceChannelDeleteEvent) event); - else if (event instanceof VoiceChannelUpdatePermissionsEvent) - onVoiceChannelUpdatePermissions((VoiceChannelUpdatePermissionsEvent) event); - - //Category Events - else if (event instanceof CategoryCreateEvent) - onCategoryCreate((CategoryCreateEvent) event); - else if (event instanceof CategoryUpdateNameEvent) - onCategoryUpdateName((CategoryUpdateNameEvent) event); - else if (event instanceof CategoryUpdatePositionEvent) - onCategoryUpdatePosition((CategoryUpdatePositionEvent) event); - else if (event instanceof CategoryDeleteEvent) - onCategoryDelete((CategoryDeleteEvent) event); - else if (event instanceof CategoryUpdatePermissionsEvent) - onCategoryUpdatePermissions((CategoryUpdatePermissionsEvent) event); - - //PrivateChannel Events - else if (event instanceof PrivateChannelCreateEvent) - onPrivateChannelCreate((PrivateChannelCreateEvent) event); - else if (event instanceof PrivateChannelDeleteEvent) - onPrivateChannelDelete((PrivateChannelDeleteEvent) event); - - //Guild Events - else if (event instanceof GuildReadyEvent) - onGuildReady((GuildReadyEvent) event); - else if (event instanceof GuildJoinEvent) - onGuildJoin((GuildJoinEvent) event); - else if (event instanceof GuildLeaveEvent) - onGuildLeave((GuildLeaveEvent) event); - else if (event instanceof GuildAvailableEvent) - onGuildAvailable((GuildAvailableEvent) event); - else if (event instanceof GuildUnavailableEvent) - onGuildUnavailable((GuildUnavailableEvent) event); - else if (event instanceof UnavailableGuildJoinedEvent) - onUnavailableGuildJoined((UnavailableGuildJoinedEvent) event); - else if (event instanceof UnavailableGuildLeaveEvent) - onUnavailableGuildLeave((UnavailableGuildLeaveEvent) event); - else if (event instanceof GuildBanEvent) - onGuildBan((GuildBanEvent) event); - else if (event instanceof GuildUnbanEvent) - onGuildUnban((GuildUnbanEvent) event); - else if (event instanceof GuildMemberRemoveEvent) - onGuildMemberRemove((GuildMemberRemoveEvent) event); - - //Guild Update Events - else if (event instanceof GuildUpdateAfkChannelEvent) - onGuildUpdateAfkChannel((GuildUpdateAfkChannelEvent) event); - else if (event instanceof GuildUpdateSystemChannelEvent) - onGuildUpdateSystemChannel((GuildUpdateSystemChannelEvent) event); - else if (event instanceof GuildUpdateAfkTimeoutEvent) - onGuildUpdateAfkTimeout((GuildUpdateAfkTimeoutEvent) event); - else if (event instanceof GuildUpdateExplicitContentLevelEvent) - onGuildUpdateExplicitContentLevel((GuildUpdateExplicitContentLevelEvent) event); - else if (event instanceof GuildUpdateIconEvent) - onGuildUpdateIcon((GuildUpdateIconEvent) event); - else if (event instanceof GuildUpdateMFALevelEvent) - onGuildUpdateMFALevel((GuildUpdateMFALevelEvent) event); - else if (event instanceof GuildUpdateNameEvent) - onGuildUpdateName((GuildUpdateNameEvent) event); - else if (event instanceof GuildUpdateNotificationLevelEvent) - onGuildUpdateNotificationLevel((GuildUpdateNotificationLevelEvent) event); - else if (event instanceof GuildUpdateOwnerEvent) - onGuildUpdateOwner((GuildUpdateOwnerEvent) event); - else if (event instanceof GuildUpdateRegionEvent) - onGuildUpdateRegion((GuildUpdateRegionEvent) event); - else if (event instanceof GuildUpdateSplashEvent) - onGuildUpdateSplash((GuildUpdateSplashEvent) event); - else if (event instanceof GuildUpdateVerificationLevelEvent) - onGuildUpdateVerificationLevel((GuildUpdateVerificationLevelEvent) event); - else if (event instanceof GuildUpdateLocaleEvent) - onGuildUpdateLocale((GuildUpdateLocaleEvent) event); - else if (event instanceof GuildUpdateFeaturesEvent) - onGuildUpdateFeatures((GuildUpdateFeaturesEvent) event); - else if (event instanceof GuildUpdateVanityCodeEvent) - onGuildUpdateVanityCode((GuildUpdateVanityCodeEvent) event); - else if (event instanceof GuildUpdateBannerEvent) - onGuildUpdateBanner((GuildUpdateBannerEvent) event); - else if (event instanceof GuildUpdateDescriptionEvent) - onGuildUpdateDescription((GuildUpdateDescriptionEvent) event); - else if (event instanceof GuildUpdateBoostTierEvent) - onGuildUpdateBoostTier((GuildUpdateBoostTierEvent) event); - else if (event instanceof GuildUpdateBoostCountEvent) - onGuildUpdateBoostCount((GuildUpdateBoostCountEvent) event); - else if (event instanceof GuildUpdateMaxMembersEvent) - onGuildUpdateMaxMembers((GuildUpdateMaxMembersEvent) event); - else if (event instanceof GuildUpdateMaxPresencesEvent) - onGuildUpdateMaxPresences((GuildUpdateMaxPresencesEvent) event); - - //Guild Invite Events - else if (event instanceof GuildInviteCreateEvent) - onGuildInviteCreate((GuildInviteCreateEvent) event); - else if (event instanceof GuildInviteDeleteEvent) - onGuildInviteDelete((GuildInviteDeleteEvent) event); - - //Guild Member Events - else if (event instanceof GuildMemberJoinEvent) - onGuildMemberJoin((GuildMemberJoinEvent) event); - else if (event instanceof GuildMemberLeaveEvent) - onGuildMemberLeave((GuildMemberLeaveEvent) event); - else if (event instanceof GuildMemberRoleAddEvent) - onGuildMemberRoleAdd((GuildMemberRoleAddEvent) event); - else if (event instanceof GuildMemberRoleRemoveEvent) - onGuildMemberRoleRemove((GuildMemberRoleRemoveEvent) event); - - //Guild Member Update Events - else if (event instanceof GuildMemberUpdateEvent) - onGuildMemberUpdate((GuildMemberUpdateEvent) event); - else if (event instanceof GuildMemberUpdateNicknameEvent) - onGuildMemberUpdateNickname((GuildMemberUpdateNicknameEvent) event); - else if (event instanceof GuildMemberUpdateBoostTimeEvent) - onGuildMemberUpdateBoostTime((GuildMemberUpdateBoostTimeEvent) event); - - //Guild Voice Events - else if (event instanceof GuildVoiceJoinEvent) - onGuildVoiceJoin((GuildVoiceJoinEvent) event); - else if (event instanceof GuildVoiceMoveEvent) - onGuildVoiceMove((GuildVoiceMoveEvent) event); - else if (event instanceof GuildVoiceLeaveEvent) - onGuildVoiceLeave((GuildVoiceLeaveEvent) event); - else if (event instanceof GuildVoiceMuteEvent) - onGuildVoiceMute((GuildVoiceMuteEvent) event); - else if (event instanceof GuildVoiceDeafenEvent) - onGuildVoiceDeafen((GuildVoiceDeafenEvent) event); - else if (event instanceof GuildVoiceGuildMuteEvent) - onGuildVoiceGuildMute((GuildVoiceGuildMuteEvent) event); - else if (event instanceof GuildVoiceGuildDeafenEvent) - onGuildVoiceGuildDeafen((GuildVoiceGuildDeafenEvent) event); - else if (event instanceof GuildVoiceSelfMuteEvent) - onGuildVoiceSelfMute((GuildVoiceSelfMuteEvent) event); - else if (event instanceof GuildVoiceSelfDeafenEvent) - onGuildVoiceSelfDeafen((GuildVoiceSelfDeafenEvent) event); - else if (event instanceof GuildVoiceSuppressEvent) - onGuildVoiceSuppress((GuildVoiceSuppressEvent) event); - else if (event instanceof GuildVoiceStreamEvent) - onGuildVoiceStream((GuildVoiceStreamEvent) event); - - //Role Events - else if (event instanceof RoleCreateEvent) - onRoleCreate((RoleCreateEvent) event); - else if (event instanceof RoleDeleteEvent) - onRoleDelete((RoleDeleteEvent) event); - - //Role Update Events - else if (event instanceof RoleUpdateColorEvent) - onRoleUpdateColor(((RoleUpdateColorEvent) event)); - else if (event instanceof RoleUpdateHoistedEvent) - onRoleUpdateHoisted(((RoleUpdateHoistedEvent) event)); - else if (event instanceof RoleUpdateMentionableEvent) - onRoleUpdateMentionable((RoleUpdateMentionableEvent) event); - else if (event instanceof RoleUpdateNameEvent) - onRoleUpdateName(((RoleUpdateNameEvent) event)); - else if (event instanceof RoleUpdatePermissionsEvent) - onRoleUpdatePermissions(((RoleUpdatePermissionsEvent) event)); - else if (event instanceof RoleUpdatePositionEvent) - onRoleUpdatePosition(((RoleUpdatePositionEvent) event)); - - //Emote Events - else if (event instanceof EmoteAddedEvent) - onEmoteAdded((EmoteAddedEvent) event); - else if (event instanceof EmoteRemovedEvent) - onEmoteRemoved((EmoteRemovedEvent) event); - - //Emote Update Events - else if (event instanceof EmoteUpdateNameEvent) - onEmoteUpdateName((EmoteUpdateNameEvent) event); - else if (event instanceof EmoteUpdateRolesEvent) - onEmoteUpdateRoles((EmoteUpdateRolesEvent) event); - - // Debug Events - else if (event instanceof HttpRequestEvent) - onHttpRequest((HttpRequestEvent) event); - - //Generic subclasses - combining multiple events - if (event instanceof GuildVoiceUpdateEvent) - onGuildVoiceUpdate((GuildVoiceUpdateEvent) event); - - //Generic Events - //Start a new if statement so that these are no overridden by the above events. - if (event instanceof GenericMessageReactionEvent) - onGenericMessageReaction((GenericMessageReactionEvent) event); - else if (event instanceof GenericPrivateMessageReactionEvent) - onGenericPrivateMessageReaction((GenericPrivateMessageReactionEvent) event); - else if (event instanceof GenericStoreChannelUpdateEvent) - onGenericStoreChannelUpdate((GenericStoreChannelUpdateEvent) event); - else if (event instanceof GenericTextChannelUpdateEvent) - onGenericTextChannelUpdate((GenericTextChannelUpdateEvent) event); - else if (event instanceof GenericCategoryUpdateEvent) - onGenericCategoryUpdate((GenericCategoryUpdateEvent) event); - else if (event instanceof GenericGuildMessageReactionEvent) - onGenericGuildMessageReaction((GenericGuildMessageReactionEvent) event); - else if (event instanceof GenericVoiceChannelUpdateEvent) - onGenericVoiceChannelUpdate((GenericVoiceChannelUpdateEvent) event); - else if (event instanceof GenericGuildUpdateEvent) - onGenericGuildUpdate((GenericGuildUpdateEvent) event); - else if (event instanceof GenericGuildMemberUpdateEvent) - onGenericGuildMemberUpdate((GenericGuildMemberUpdateEvent) event); - else if (event instanceof GenericGuildVoiceEvent) - onGenericGuildVoice((GenericGuildVoiceEvent) event); - else if (event instanceof GenericRoleUpdateEvent) - onGenericRoleUpdate(((GenericRoleUpdateEvent) event)); - else if (event instanceof GenericEmoteUpdateEvent) - onGenericEmoteUpdate((GenericEmoteUpdateEvent) event); - else if (event instanceof GenericUserPresenceEvent) - onGenericUserPresence((GenericUserPresenceEvent) event); - else if (event instanceof GenericPermissionOverrideEvent) - onGenericPermissionOverride((GenericPermissionOverrideEvent) event); - - //Generic events that have generic subclasses (the subclasses as above). - if (event instanceof GenericMessageEvent) - onGenericMessage((GenericMessageEvent) event); - else if (event instanceof GenericPrivateMessageEvent) - onGenericPrivateMessage((GenericPrivateMessageEvent) event); - else if (event instanceof GenericGuildMessageEvent) - onGenericGuildMessage((GenericGuildMessageEvent) event); - else if (event instanceof GenericGuildInviteEvent) - onGenericGuildInvite((GenericGuildInviteEvent) event); - else if (event instanceof GenericGuildMemberEvent) - onGenericGuildMember((GenericGuildMemberEvent) event); - else if (event instanceof GenericUserEvent) - onGenericUser((GenericUserEvent) event); - else if (event instanceof GenericSelfUpdateEvent) - onGenericSelfUpdate((GenericSelfUpdateEvent) event); - else if (event instanceof GenericStoreChannelEvent) - onGenericStoreChannel((GenericStoreChannelEvent) event); - else if (event instanceof GenericTextChannelEvent) - onGenericTextChannel((GenericTextChannelEvent) event); - else if (event instanceof GenericVoiceChannelEvent) - onGenericVoiceChannel((GenericVoiceChannelEvent) event); - else if (event instanceof GenericCategoryEvent) - onGenericCategory((GenericCategoryEvent) event); - else if (event instanceof GenericRoleEvent) - onGenericRole((GenericRoleEvent) event); - else if (event instanceof GenericEmoteEvent) - onGenericEmote((GenericEmoteEvent) event); - - //Generic events that have 2 levels of generic subclasses - if (event instanceof GenericGuildEvent) - onGenericGuild((GenericGuildEvent) event); + + Class handle = ListenerAdapter.class; + for (Class clazz : ClassWalker.range(event.getClass(), GenericEvent.class)) + { + String name = clazz.getSimpleName(); + try + { + name = "on" + name.substring(0, name.length() - "Event".length()); + Method method = handle.getDeclaredMethod(name, clazz); + method.invoke(this, event); + } + catch (NoSuchMethodException | IllegalAccessException ignored) {} // this means this is probably a custom event! + catch (InvocationTargetException e) + { + Throwable cause = e.getCause(); + if (cause instanceof RuntimeException) + throw (RuntimeException) cause; + if (cause instanceof Error) + throw (Error) cause; + throw new RuntimeException(cause); + } + } } } diff --git a/src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java b/src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java new file mode 100644 index 0000000000..aa065a0954 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java @@ -0,0 +1,86 @@ +/* + * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.internal.utils; + +import javax.annotation.Nonnull; +import java.util.*; + +public class ClassWalker implements Iterable> +{ + private final Class clazz; + private final Class end; + + private ClassWalker(Class clazz) + { + this(clazz, Object.class); + } + + private ClassWalker(Class clazz, Class end) + { + this.clazz = clazz; + this.end = end; + } + + public static ClassWalker range(Class start, Class end) + { + return new ClassWalker(start, end); + } + + public static ClassWalker walk(Class start) + { + return new ClassWalker(start); + } + + @Nonnull + @Override + public Iterator> iterator() + { + return new Iterator>() + { + private final Set> done = new HashSet<>(); + private final Deque> work = new LinkedList<>(); + + { + work.addLast(clazz); + done.add(end); + } + + @Override + public boolean hasNext() + { + return !work.isEmpty(); + } + + @Override + public Class next() + { + Class current = work.removeFirst(); + done.add(current); + for (Class parent : current.getInterfaces()) + { + if (!done.contains(parent)) + work.addLast(parent); + } + + Class parent = current.getSuperclass(); + if (parent != null && !done.contains(parent)) + work.addLast(parent); + return current; + } + }; + } +} From 68d6104e956c5d317b7524122147f2739f58e61b Mon Sep 17 00:00:00 2001 From: caneleex Date: Mon, 28 Dec 2020 21:20:52 +0100 Subject: [PATCH 069/121] Fix IllegalArgumentException in retrievePast/retrieveFuture --- .../java/net/dv8tion/jda/api/entities/MessageHistory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java b/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java index fd6ea4f536..fc71d479ab 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java @@ -196,7 +196,7 @@ public RestAction> retrievePast(int amount) DataArray historyJson = response.getArray(); for (int i = 0; i < historyJson.length(); i++) - messages.add(builder.createMessage(historyJson.getObject(i))); + messages.add(builder.createMessage(historyJson.getObject(i), channel, false)); messages.forEach(msg -> history.put(msg.getIdLong(), msg)); return messages; @@ -265,7 +265,7 @@ public RestAction> retrieveFuture(int amount) DataArray historyJson = response.getArray(); for (int i = 0; i < historyJson.length(); i++) - messages.add(builder.createMessage(historyJson.getObject(i))); + messages.add(builder.createMessage(historyJson.getObject(i), channel, false)); for (Iterator it = messages.descendingIterator(); it.hasNext();) { From 2522411f1acb0103222e66eb37d43499dc1c8d63 Mon Sep 17 00:00:00 2001 From: caneleex Date: Fri, 8 Jan 2021 09:40:00 +0100 Subject: [PATCH 070/121] Add ChannelManager#setNews and ChannelAction#setNews (#1462) also remove invalid throws from setNSFW and setNews docs --- .../jda/api/managers/ChannelManager.java | 27 +++++++++++++++++-- .../requests/restaction/ChannelAction.java | 20 ++++++++++++++ .../internal/managers/ChannelManagerImpl.java | 20 ++++++++++++++ .../restaction/ChannelActionImpl.java | 16 +++++++++++ 4 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java index d673063bc9..df123e2f91 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java @@ -62,6 +62,8 @@ public interface ChannelManager extends Manager long PERMISSION = 0x80; /** Used to reset the rate-limit per user field */ long SLOWMODE = 0x100; + /** Used to reset the channel type field */ + long NEWS = 0x200; /** * Resets the fields specified by the provided bit-flag pattern. @@ -79,6 +81,7 @@ public interface ChannelManager extends Manager *
  • {@link #USERLIMIT}
  • *
  • {@link #BITRATE}
  • *
  • {@link #PERMISSION}
  • + *
  • {@link #NEWS}
  • * * * @param fields @@ -104,6 +107,7 @@ public interface ChannelManager extends Manager *
  • {@link #USERLIMIT}
  • *
  • {@link #BITRATE}
  • *
  • {@link #PERMISSION}
  • + *
  • {@link #NEWS}
  • * * * @param fields @@ -387,8 +391,6 @@ default ChannelManager sync() * @param nsfw * The new nsfw flag for the selected {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}, * - * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException - * If the currently logged in account does not have the Permission {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} * @throws IllegalStateException * If the selected {@link net.dv8tion.jda.api.entities.GuildChannel GuildChannel}'s type is not {@link net.dv8tion.jda.api.entities.ChannelType#TEXT TEXT} * @@ -467,4 +469,25 @@ default ChannelManager sync() @Nonnull @CheckReturnValue ChannelManager setBitrate(int bitrate); + + /** + * Sets the news flag of the selected {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}. + * Announcement-/News-Channels can be used to crosspost messages to other guilds. + * + * @param news + * The new news flag for the selected {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}, + * + * @throws IllegalStateException + * If the selected {@link net.dv8tion.jda.api.entities.GuildChannel GuildChannel}'s type is not {@link net.dv8tion.jda.api.entities.ChannelType#TEXT TEXT} + * @throws IllegalStateException + * If {@code news} is {@code true} and the guild doesn't have the NEWS feature + * + * @return ChannelManager for chaining convenience + * + * @see net.dv8tion.jda.api.entities.Guild#getFeatures() + * @see net.dv8tion.jda.api.entities.TextChannel#isNews() + */ + @Nonnull + @CheckReturnValue + ChannelManager setNews(boolean news); } diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java index de9704059b..01634fb837 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java @@ -185,6 +185,26 @@ public interface ChannelAction extends AuditableRestActi @CheckReturnValue ChannelAction setSlowmode(int slowmode); + /** + * Sets the news flag for the new TextChannel. + * Announcement-/News-Channels can be used to crosspost messages to other guilds. + * + * @param news + * The news flag for the new GuildChannel + * + * @throws UnsupportedOperationException + * If this ChannelAction is not for a TextChannel + * @throws java.lang.IllegalStateException + * If {@code news} is {@code true} and the guild doesn't have the NEWS feature + * + * @return The current ChannelAction, for chaining convenience + * + * @see net.dv8tion.jda.api.entities.TextChannel#isNews() + */ + @Nonnull + @CheckReturnValue + ChannelAction setNews(boolean news); + /** * Adds a new Role or Member {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} * for the new GuildChannel. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java index 4b7c1bef14..00d7b11230 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java @@ -48,6 +48,7 @@ public class ChannelManagerImpl extends ManagerBase implements C protected int slowmode; protected int userlimit; protected int bitrate; + protected boolean news; protected final Object lock = new Object(); protected final TLongObjectHashMap overridesAdd; @@ -95,6 +96,8 @@ public ChannelManagerImpl reset(long fields) this.parent = null; if ((fields & TOPIC) == TOPIC) this.topic = null; + if ((fields & NEWS) == NEWS) + this.news = false; if ((fields & PERMISSION) == PERMISSION) { withLock(lock, (lock) -> @@ -124,6 +127,7 @@ public ChannelManagerImpl reset() this.name = null; this.parent = null; this.topic = null; + this.news = false; withLock(lock, (lock) -> { this.overridesRem.clear(); @@ -345,6 +349,20 @@ public ChannelManagerImpl setBitrate(int bitrate) return this; } + @Nonnull + @Override + @CheckReturnValue + public ChannelManagerImpl setNews(boolean news) + { + if (getType() != ChannelType.TEXT) + throw new IllegalStateException("Can only set channel as news on text channels"); + if (news && !getGuild().getFeatures().contains("NEWS")) + throw new IllegalStateException("Can only set channel as news for guilds with NEWS feature"); + this.news = news; + set |= NEWS; + return this; + } + @Override protected RequestBody finalizeData() { @@ -365,6 +383,8 @@ protected RequestBody finalizeData() frame.put("bitrate", bitrate); if (shouldUpdate(PARENT)) frame.put("parent_id", parent); + if (shouldUpdate(NEWS)) + frame.put("type", news ? 5 : 0); withLock(lock, (lock) -> { if (shouldUpdate(PERMISSION)) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java index 869b0c852f..22470cbb7d 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java @@ -49,6 +49,7 @@ public class ChannelActionImpl extends AuditableRestActi protected String topic = null; protected Boolean nsfw = null; protected Integer slowmode = null; + protected Boolean news = null; // --voice only-- protected Integer bitrate = null; @@ -167,6 +168,19 @@ public ChannelActionImpl setSlowmode(int slowmode) return this; } + @Nonnull + @Override + @CheckReturnValue + public ChannelActionImpl setNews(boolean news) + { + if (type != ChannelType.TEXT) + throw new UnsupportedOperationException("Can only set news for a TextChannel!"); + if (news && !getGuild().getFeatures().contains("NEWS")) + throw new IllegalStateException("Can only set channel as news for guilds with NEWS feature"); + this.news = news; + return this; + } + @Nonnull @Override @CheckReturnValue @@ -252,6 +266,8 @@ protected RequestBody finalizeData() object.put("nsfw", nsfw); if (slowmode != null) object.put("rate_limit_per_user", slowmode); + if (news != null) + object.put("type", news ? 5 : 0); } if (type != ChannelType.CATEGORY && parent != null) object.put("parent_id", parent.getId()); From 519840a682a8cb988e0c02a32b21192d5bc2c9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 9 Feb 2021 18:22:54 +0100 Subject: [PATCH 071/121] Fix permission sync with manage roles/permissions (#1500) See also: - https://github.com/discord/discord-api-docs/issues/2522 - https://github.com/discord/discord-api-docs/pull/2521 --- .../dv8tion/jda/api/entities/Category.java | 4 + .../jda/api/entities/IPermissionHolder.java | 35 ++++++ .../jda/api/managers/ChannelManager.java | 8 +- .../requests/restaction/ChannelAction.java | 115 +++++++++++++++++- .../restaction/PermissionOverrideAction.java | 54 ++++++++ .../jda/internal/entities/CategoryImpl.java | 36 +++--- .../jda/internal/entities/MemberImpl.java | 50 ++++++++ .../jda/internal/entities/RoleImpl.java | 51 ++++++++ .../internal/managers/ChannelManagerImpl.java | 40 +++++- .../restaction/ChannelActionImpl.java | 82 +++++++++++++ .../PermissionOverrideActionImpl.java | 21 ++++ .../jda/internal/utils/PermissionUtil.java | 66 +++++++++- 12 files changed, 533 insertions(+), 29 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/Category.java b/src/main/java/net/dv8tion/jda/api/entities/Category.java index f97597bcad..116c34b868 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Category.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Category.java @@ -91,6 +91,8 @@ public interface Category extends GuildChannel * {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} Permission in the {@link net.dv8tion.jda.api.entities.Guild Guild}. * *

    This will copy all {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} of this Category! + * Unless the bot is unable to sync it with this category due to permission escalation. + * See {@link IPermissionHolder#canSync(GuildChannel, GuildChannel)} for details. * *

    Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: @@ -126,6 +128,8 @@ public interface Category extends GuildChannel * {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} Permission in the {@link net.dv8tion.jda.api.entities.Guild Guild}. * *

    This will copy all {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} of this Category! + * Unless the bot is unable to sync it with this category due to permission escalation. + * See {@link IPermissionHolder#canSync(GuildChannel, GuildChannel)} for details. * *

    Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: diff --git a/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java b/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java index c7838194a6..5c4069701f 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java +++ b/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java @@ -177,4 +177,39 @@ default boolean hasAccess(@Nonnull GuildChannel channel) ? hasPermission(channel, Permission.VOICE_CONNECT, Permission.VIEW_CHANNEL) : hasPermission(channel, Permission.VIEW_CHANNEL); } + + /** + * Whether the permissions of this PermissionHolder are good enough to sync the target channel with the sync source. + *
    This checks what permissions would be changed by the overrides of the sync source and whether the permission holder is able to set them on the target channel. + * + *

    If the permission holder had {@link Permission#MANAGE_PERMISSIONS} in an override on the target channel or {@link Permission#ADMINISTRATOR} on one of its roles, then it can set any permission on the target channel. + * Otherwise, the permission holder can only set permissions it also has in the channel. + * + * @param targetChannel + * The target channel to check + * @param syncSource + * The sync source, for example the parent category (see {@link GuildChannel#getParent()}) + * + * @throws IllegalArgumentException + * If either of the channels is null or not from the same guild as this permission holder + * + * @return True, if the channels can be synced + */ + boolean canSync(@Nonnull GuildChannel targetChannel, @Nonnull GuildChannel syncSource); + + /** + * Whether the permissions of this PermissionHolder are good enough to sync the target channel with any other channel. + *
    This checks whether the permission holder has local administrator. + * + *

    If the permission holder had {@link Permission#MANAGE_PERMISSIONS} in an override on the target channel or {@link Permission#ADMINISTRATOR} on one of its roles, then it can set any permission on the target channel. + * + * @param channel + * The target channel to check + * + * @throws IllegalArgumentException + * If the channel is null or not from the same guild as this permission holder + * + * @return True, if the channel can be synced + */ + boolean canSync(@Nonnull GuildChannel channel); } diff --git a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java index df123e2f91..ecd2f00602 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java @@ -186,7 +186,7 @@ default Guild getGuild() * If the provided permission holder is {@code null} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} - * in this channel + * in this channel, or tries to set permissions it does not have without having {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} explicitly for this channel through an override. * * @return ChannelManager for chaining convenience * @@ -214,7 +214,7 @@ default Guild getGuild() * If the provided permission holder is {@code null} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} - * in this channel + * in this channel, or tries to set permissions it does not have without having {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} explicitly for this channel through an override. * * @return ChannelManager for chaining convenience * @@ -264,7 +264,7 @@ default ChannelManager putPermissionOverride(@Nonnull IPermissionHolder permHold * If this GuildChannel has no parent * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} - * in this channel + * in this channel or {@link IPermissionHolder#canSync(GuildChannel, GuildChannel)} is false for the self member. * * @return ChannelManager for chaining convenience * @@ -296,7 +296,7 @@ default ChannelManager sync() * If the given snySource is {@code null}, this GuildChannel or from a different Guild. * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} - * in this channel + * in this channel or {@link IPermissionHolder#canSync(GuildChannel, GuildChannel)} is false for the self member. * * @return ChannelManager for chaining convenience * diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java index 01634fb837..118d3558fd 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java @@ -18,6 +18,7 @@ import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.utils.Checks; import javax.annotation.CheckReturnValue; @@ -90,7 +91,9 @@ public interface ChannelAction extends AuditableRestActi ChannelAction setName(@Nonnull String name); /** - * Sets the {@link net.dv8tion.jda.api.entities.Category Category} for the new GuildChannel + * Sets the {@link net.dv8tion.jda.api.entities.Category Category} for the new GuildChannel. + * + * You can use {@link #syncPermissionOverrides()} to sync the channel with the category. * * @param category * The parent for the new GuildChannel @@ -102,6 +105,8 @@ public interface ChannelAction extends AuditableRestActi * or not from this Guild * * @return The current ChannelAction, for chaining convenience + * + * @see #syncPermissionOverrides() */ @Nonnull @CheckReturnValue @@ -209,6 +214,8 @@ public interface ChannelAction extends AuditableRestActi * Adds a new Role or Member {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} * for the new GuildChannel. * + *

    If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. + * *

    Example: *

    {@code
          * Role role = guild.getPublicRole();
    @@ -224,6 +231,9 @@ public interface ChannelAction extends AuditableRestActi
          * @param  deny
          *         The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override or null
          *
    +     * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
    +     *         If any permission is set in allow/deny that the currently logged in account is missing,
    +     *         unless {@link Permission#MANAGE_PERMISSIONS} or {@link Permission#MANAGE_ROLES} is granted to it within the context of the parent category.
          * @throws java.lang.IllegalArgumentException
          *         If the specified target is null or not within the same guild.
          *
    @@ -245,6 +255,8 @@ default ChannelAction addPermissionOverride(@Nonnull IPermissionHolder target
          * Adds a new Role or Member {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride}
          * for the new GuildChannel.
          *
    +     * 

    If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. + * *

    Example: *

    {@code
          * Role role = guild.getPublicRole();
    @@ -262,6 +274,9 @@ default ChannelAction addPermissionOverride(@Nonnull IPermissionHolder target
          *         The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override.
          *         Use {@link net.dv8tion.jda.api.Permission#getRawValue()} to retrieve these Permissions.
          *
    +     * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
    +     *         If any permission is set in allow/deny that the currently logged in account is missing,
    +     *         unless {@link Permission#MANAGE_PERMISSIONS} or {@link Permission#MANAGE_ROLES} is granted to it within the context of the parent category.
          * @throws java.lang.IllegalArgumentException
          *         
      *
    • If the specified target is null @@ -291,6 +306,8 @@ else if (target instanceof Member) * Adds a new Member {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} * for the new GuildChannel. * + *

      If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. + * *

      Example: *

      {@code
            * long userId = user.getIdLong();
      @@ -306,6 +323,10 @@ else if (target instanceof Member)
            * @param  deny
            *         The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override or null
            *
      +     * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
      +     *         If any permission is set in allow/deny that the currently logged in account is missing,
      +     *         unless {@link Permission#MANAGE_PERMISSIONS} or {@link Permission#MANAGE_ROLES} is granted to it within the context of the parent category.
      +     *
            * @return The current ChannelAction, for chaining convenience
            *
            * @see    java.util.EnumSet
      @@ -324,6 +345,8 @@ default ChannelAction addMemberPermissionOverride(long memberId, @Nullable Co
            * Adds a new Role {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride}
            * for the new GuildChannel.
            *
      +     * 

      If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. + * *

      Example: *

      {@code
            * long roleId = role.getIdLong();
      @@ -339,6 +362,10 @@ default ChannelAction addMemberPermissionOverride(long memberId, @Nullable Co
            * @param  deny
            *         The denied {@link net.dv8tion.jda.api.Permission Permissions} for the override or null
            *
      +     * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
      +     *         If any permission is set in allow/deny that the currently logged in account is missing,
      +     *         unless {@link Permission#MANAGE_PERMISSIONS} or {@link Permission#MANAGE_ROLES} is granted to it within the context of the parent category.
      +     *
            * @return The current ChannelAction, for chaining convenience
            *
            * @see    java.util.EnumSet
      @@ -356,6 +383,8 @@ default ChannelAction addRolePermissionOverride(long roleId, @Nullable Collec
           /**
            * Adds a new Member {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} for the new GuildChannel.
            *
      +     * 

      If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. + * *

      Example: *

      {@code
            * long userId = user.getIdLong();
      @@ -375,6 +404,9 @@ default ChannelAction addRolePermissionOverride(long roleId, @Nullable Collec
            *
            * @throws java.lang.IllegalArgumentException
            *         If one of the provided Permission values is invalid
      +     * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
      +     *         If any permission is set in allow/deny that the currently logged in account is missing,
      +     *         unless {@link Permission#MANAGE_PERMISSIONS} or {@link Permission#MANAGE_ROLES} is granted to it within the context of the parent category.
            *
            * @return The current ChannelAction, for chaining convenience
            *
      @@ -389,6 +421,8 @@ default ChannelAction addRolePermissionOverride(long roleId, @Nullable Collec
           /**
            * Adds a new Role {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} for the new GuildChannel.
            *
      +     * 

      If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. + * *

      Example: *

      {@code
            * long roleId = role.getIdLong();
      @@ -408,6 +442,9 @@ default ChannelAction addRolePermissionOverride(long roleId, @Nullable Collec
            *
            * @throws java.lang.IllegalArgumentException
            *         If one of the provided Permission values is invalid
      +     * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException
      +     *         If any permission is set in allow/deny that the currently logged in account is missing,
      +     *         unless {@link Permission#MANAGE_PERMISSIONS} or {@link Permission#MANAGE_ROLES} is granted to it within the context of the parent category.
            *
            * @return The current ChannelAction, for chaining convenience
            *
      @@ -419,6 +456,82 @@ default ChannelAction addRolePermissionOverride(long roleId, @Nullable Collec
           @CheckReturnValue
           ChannelAction addRolePermissionOverride(long roleId, long allow, long deny);
       
      +    /**
      +     * Removes any existing override with the provided id.
      +     * 
      If no override with the provided id exists, this method does nothing. + * + * @param id + * The member or role id of the override + * + * @return The current ChannelAction, for chaining convenience + */ + @Nonnull + @CheckReturnValue + ChannelAction removePermissionOverride(long id); + + /** + * Removes any existing override with the provided id. + *
      If no override with the provided id exists, this method does nothing. + * + * @param id + * The member or role id of the override + * + * @throws IllegalArgumentException + * If the provided string is not a valid snowflake or null + * + * @return The current ChannelAction, for chaining convenience + */ + @Nonnull + @CheckReturnValue + default ChannelAction removePermissionOverride(@Nonnull String id) + { + return removePermissionOverride(MiscUtil.parseSnowflake(id)); + } + + /** + * Removes any existing override with the provided role/member. + *
      If no override for the provided role/member exists, this method does nothing. + * + * @param holder + * The member or role of the override + * + * @throws IllegalArgumentException + * If the provided permission holder is null + * + * @return The current ChannelAction, for chaining convenience + */ + @Nonnull + @CheckReturnValue + default ChannelAction removePermissionOverride(@Nonnull IPermissionHolder holder) + { + Checks.notNull(holder, "PermissionHolder"); + return removePermissionOverride(holder.getIdLong()); + } + + /** + * Removes all currently configured permission overrides + * + * @return The current ChannelAction, for chaining convenience + */ + @Nonnull + @CheckReturnValue + ChannelAction clearPermissionOverrides(); + + /** + * Syncs the permission overrides of the channel with the category. + * + *

      If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. + * In order to properly sync permissions the currently logged in account must have all allowed/denied permissions or {@link Permission#MANAGE_ROLES} in the parent category. + * + * @throws IllegalArgumentException + * If no parent has been configured. You have to use {@link #setParent(Category)} before calling this method. + * + * @return The current ChannelAction, for chaining convenience + */ + @Nonnull + @CheckReturnValue + ChannelAction syncPermissionOverrides(); + /** * Sets the bitrate for the new VoiceChannel * diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java index 034a1580f9..9034434aeb 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java @@ -236,6 +236,9 @@ default EnumSet getInheritedPermissions() * @throws java.lang.IllegalArgumentException * If the provided bits are negative * or higher than {@link net.dv8tion.jda.api.Permission#ALL_PERMISSIONS Permission.ALL_PERMISSIONS} + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * * @return The current PermissionOverrideAction - for chaining convenience * @@ -260,6 +263,9 @@ default EnumSet getInheritedPermissions() * * @throws java.lang.IllegalArgumentException * If the any of the specified Permissions is {@code null} + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * * @return The current PermissionOverrideAction - for chaining convenience * @@ -288,6 +294,9 @@ default PermissionOverrideAction setAllow(@Nullable Collection permi * * @throws java.lang.IllegalArgumentException * If the any of the specified Permissions is {@code null} + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * * @return The current PermissionOverrideAction - for chaining convenience */ @@ -308,6 +317,10 @@ default PermissionOverrideAction setAllow(@Nullable Permission... permissions) * @param allowBits * The permissions to grant, in addition to already allowed permissions * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel + * * @return The current PermissionOverrideAction - for chaining convenience */ @Nonnull @@ -324,6 +337,9 @@ default PermissionOverrideAction grant(long allowBits) * @param permissions * The permissions to grant, in addition to already allowed permissions * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws IllegalArgumentException * If any provided argument is null * @@ -343,6 +359,9 @@ default PermissionOverrideAction grant(@Nonnull Collection permissio * @param permissions * The permissions to grant, in addition to already allowed permissions * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws IllegalArgumentException * If any provided argument is null * @@ -369,6 +388,9 @@ default PermissionOverrideAction grant(@Nonnull Permission... permissions) * The positive bits representing the denied * permissions for the new PermissionOverride * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws java.lang.IllegalArgumentException * If the provided bits are negative * or higher than {@link net.dv8tion.jda.api.Permission#ALL_PERMISSIONS Permission.ALL_PERMISSIONS} @@ -396,6 +418,9 @@ default PermissionOverrideAction grant(@Nonnull Permission... permissions) * * @throws java.lang.IllegalArgumentException * If the any of the specified Permissions is {@code null} + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * * @return The current PermissionOverrideAction - for chaining convenience * @@ -422,6 +447,9 @@ default PermissionOverrideAction setDeny(@Nullable Collection permis * permissions for the new PermissionOverride. *
      If the provided value is {@code null} the permissions are reset to the default of none * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws java.lang.IllegalArgumentException * If the any of the specified Permissions is {@code null} * @@ -444,6 +472,10 @@ default PermissionOverrideAction setDeny(@Nullable Permission... permissions) * @param denyBits * The permissions to deny, in addition to already denied permissions * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel + * * @return The current PermissionOverrideAction - for chaining convenience */ @Nonnull @@ -460,6 +492,9 @@ default PermissionOverrideAction deny(long denyBits) * @param permissions * The permissions to deny, in addition to already denied permissions * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws IllegalArgumentException * If any provided argument is null * @@ -479,6 +514,9 @@ default PermissionOverrideAction deny(@Nonnull Collection permission * @param permissions * The permissions to deny, in addition to already denied permissions * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws IllegalArgumentException * If any provided argument is null * @@ -499,6 +537,10 @@ default PermissionOverrideAction deny(@Nonnull Permission... permissions) * @param inheritedBits * The permissions to clear from the {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel + * * @return The current PermissionOverrideAction - for chaining convenience */ @Nonnull @@ -516,6 +558,9 @@ default PermissionOverrideAction clear(long inheritedBits) * @param permissions * The permissions to clear from the {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws IllegalArgumentException * If any provided argument is null * @@ -536,6 +581,9 @@ default PermissionOverrideAction clear(@Nonnull Collection permissio * @param permissions * The permissions to clear from the {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverride} * + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * @throws IllegalArgumentException * If any provided argument is null * @@ -563,6 +611,9 @@ default PermissionOverrideAction clear(@Nonnull Permission... permissions) * @throws java.lang.IllegalArgumentException * If any of the provided bits are negative * or higher than {@link net.dv8tion.jda.api.Permission#ALL_PERMISSIONS Permission.ALL_PERMISSIONS} + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * * @return The current PermissionOverrideAction - for chaining convenience * @@ -590,6 +641,9 @@ default PermissionOverrideAction clear(@Nonnull Permission... permissions) * * @throws java.lang.IllegalArgumentException * If the any of the specified Permissions is {@code null} + * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} + * on the channel and tries to set permissions it does not have in the channel * * @return The current PermissionOverrideAction - for chaining convenience * diff --git a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java index 9cafe8cf1e..2615edffd3 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java @@ -23,6 +23,7 @@ import net.dv8tion.jda.api.requests.restaction.order.CategoryOrderAction; import net.dv8tion.jda.internal.requests.CompletedRestAction; import net.dv8tion.jda.internal.utils.Checks; +import net.dv8tion.jda.internal.utils.PermissionUtil; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -159,8 +160,7 @@ public List getVoiceChannels() public ChannelAction createTextChannel(@Nonnull String name) { ChannelAction action = getGuild().createTextChannel(name, this); - applyPermission(action); - return action; + return trySync(action); } @Nonnull @@ -168,8 +168,23 @@ public ChannelAction createTextChannel(@Nonnull String name) public ChannelAction createVoiceChannel(@Nonnull String name) { ChannelAction action = getGuild().createVoiceChannel(name, this); - applyPermission(action); - return action; + return trySync(action); + } + + private ChannelAction trySync(ChannelAction action) + { + Member selfMember = getGuild().getSelfMember(); + if (!selfMember.canSync(this)) + { + long botPerms = PermissionUtil.getEffectivePermission(this, selfMember); + for (PermissionOverride override : getPermissionOverrides()) + { + long perms = override.getDeniedRaw() | override.getAllowedRaw(); + if ((perms & ~botPerms) != 0) + return action; + } + } + return action.syncPermissionOverrides(); } @Nonnull @@ -191,17 +206,4 @@ public String toString() { return "GC:" + getName() + '(' + id + ')'; } - - @SuppressWarnings("ResultOfMethodCallIgnored") - private void applyPermission(ChannelAction a) - { - overrides.forEachValue(override -> - { - if (override.isMemberOverride()) - a.addMemberPermissionOverride(override.getIdLong(), override.getAllowedRaw(), override.getDeniedRaw()); - else - a.addRolePermissionOverride(override.getIdLong(), override.getAllowedRaw(), override.getDeniedRaw()); - return true; - }); - } } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java index d046a61e49..6c98b0ab7b 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.internal.entities; +import gnu.trove.map.TLongObjectMap; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.Permission; @@ -254,6 +255,55 @@ public boolean hasPermission(@Nonnull GuildChannel channel, @Nonnull Collection< return hasPermission(channel, permissions.toArray(Permission.EMPTY_PERMISSIONS)); } + @Override + public boolean canSync(@Nonnull GuildChannel targetChannel, @Nonnull GuildChannel syncSource) + { + Checks.notNull(targetChannel, "Channel"); + Checks.notNull(syncSource, "Channel"); + Checks.check(targetChannel.getGuild().equals(getGuild()), "Channels must be from the same guild!"); + Checks.check(syncSource.getGuild().equals(getGuild()), "Channels must be from the same guild!"); + long userPerms = PermissionUtil.getEffectivePermission(targetChannel, this); + if ((userPerms & Permission.MANAGE_PERMISSIONS.getRawValue()) == 0) + return false; // We can't manage permissions at all! + + long channelPermissions = PermissionUtil.getExplicitPermission(targetChannel, this, false); + // If the user has ADMINISTRATOR or MANAGE_PERMISSIONS then it can also set any other permission on the channel + boolean hasLocalAdmin = ((userPerms & Permission.ADMINISTRATOR.getRawValue()) | (channelPermissions & Permission.MANAGE_PERMISSIONS.getRawValue())) != 0; + if (hasLocalAdmin) + return true; + + TLongObjectMap existingOverrides = ((AbstractChannelImpl) targetChannel).getOverrideMap(); + for (PermissionOverride override : syncSource.getPermissionOverrides()) + { + PermissionOverride existing = existingOverrides.get(override.getIdLong()); + long allow = override.getAllowedRaw(); + long deny = override.getDeniedRaw(); + if (existing != null) + { + allow ^= existing.getAllowedRaw(); + deny ^= existing.getDeniedRaw(); + } + // If any permissions changed that the user doesn't have in the channel, they can't sync it :( + if (((allow | deny) & ~userPerms) != 0) + return false; + } + return true; + } + + @Override + public boolean canSync(@Nonnull GuildChannel channel) + { + Checks.notNull(channel, "Channel"); + Checks.check(channel.getGuild().equals(getGuild()), "Channels must be from the same guild!"); + long userPerms = PermissionUtil.getEffectivePermission(channel, this); + if ((userPerms & Permission.MANAGE_PERMISSIONS.getRawValue()) == 0) + return false; // We can't manage permissions at all! + + long channelPermissions = PermissionUtil.getExplicitPermission(channel, this, false); + // If the user has ADMINISTRATOR or MANAGE_PERMISSIONS then it can also set any other permission on the channel + return ((userPerms & Permission.ADMINISTRATOR.getRawValue()) | (channelPermissions & Permission.MANAGE_PERMISSIONS.getRawValue())) != 0; + } + @Override public boolean canInteract(@Nonnull Member member) { diff --git a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java index f49b53fa8b..c1b8161f02 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java @@ -16,10 +16,12 @@ package net.dv8tion.jda.internal.entities; +import gnu.trove.map.TLongObjectMap; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.GuildChannel; +import net.dv8tion.jda.api.entities.PermissionOverride; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.exceptions.HierarchyException; import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; @@ -214,6 +216,55 @@ public boolean hasPermission(@Nonnull GuildChannel channel, @Nonnull Collection< return hasPermission(channel, permissions.toArray(Permission.EMPTY_PERMISSIONS)); } + @Override + public boolean canSync(@Nonnull GuildChannel targetChannel, @Nonnull GuildChannel syncSource) + { + Checks.notNull(targetChannel, "Channel"); + Checks.notNull(syncSource, "Channel"); + Checks.check(targetChannel.getGuild().equals(getGuild()), "Channels must be from the same guild!"); + Checks.check(syncSource.getGuild().equals(getGuild()), "Channels must be from the same guild!"); + long rolePerms = PermissionUtil.getEffectivePermission(targetChannel, this); + if ((rolePerms & Permission.MANAGE_PERMISSIONS.getRawValue()) == 0) + return false; // Role can't manage permissions at all! + + long channelPermissions = PermissionUtil.getExplicitPermission(targetChannel, this, false); + // If the role has ADMINISTRATOR or MANAGE_PERMISSIONS then it can also set any other permission on the channel + boolean hasLocalAdmin = ((rolePerms & Permission.ADMINISTRATOR.getRawValue()) | (channelPermissions & Permission.MANAGE_PERMISSIONS.getRawValue())) != 0; + if (hasLocalAdmin) + return true; + + TLongObjectMap existingOverrides = ((AbstractChannelImpl) targetChannel).getOverrideMap(); + for (PermissionOverride override : syncSource.getPermissionOverrides()) + { + PermissionOverride existing = existingOverrides.get(override.getIdLong()); + long allow = override.getAllowedRaw(); + long deny = override.getDeniedRaw(); + if (existing != null) + { + allow ^= existing.getAllowedRaw(); + deny ^= existing.getDeniedRaw(); + } + // If any permissions changed that the role doesn't have in the channel, the role can't sync it :( + if (((allow | deny) & ~rolePerms) != 0) + return false; + } + return true; + } + + @Override + public boolean canSync(@Nonnull GuildChannel channel) + { + Checks.notNull(channel, "Channel"); + Checks.check(channel.getGuild().equals(getGuild()), "Channels must be from the same guild!"); + long rolePerms = PermissionUtil.getEffectivePermission(channel, this); + if ((rolePerms & Permission.MANAGE_PERMISSIONS.getRawValue()) == 0) + return false; // Role can't manage permissions at all! + + long channelPermissions = PermissionUtil.getExplicitPermission(channel, this, false); + // If the role has ADMINISTRATOR or MANAGE_PERMISSIONS then it can also set any other permission on the channel + return ((rolePerms & Permission.ADMINISTRATOR.getRawValue()) | (channelPermissions & Permission.MANAGE_PERMISSIONS.getRawValue())) != 0; + } + @Override public boolean canInteract(@Nonnull Role role) { diff --git a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java index 00d7b11230..a6d23c886a 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java @@ -30,11 +30,13 @@ import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.requests.restaction.PermOverrideData; import net.dv8tion.jda.internal.utils.Checks; +import net.dv8tion.jda.internal.utils.PermissionUtil; import okhttp3.RequestBody; import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; import java.util.Collection; +import java.util.EnumSet; public class ChannelManagerImpl extends ManagerBase implements ChannelManager { @@ -171,8 +173,25 @@ public ChannelManagerImpl putPermissionOverride(@Nonnull IPermissionHolder permH { Checks.notNull(permHolder, "PermissionHolder"); Checks.check(permHolder.getGuild().equals(getGuild()), "PermissionHolder is not from the same Guild!"); - if (isPermissionChecksEnabled() && !getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) - throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS); + Member selfMember = getGuild().getSelfMember(); + if (isPermissionChecksEnabled() && !selfMember.hasPermission(Permission.ADMINISTRATOR)) + { + if (!selfMember.hasPermission(channel, Permission.MANAGE_ROLES)) + throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS); // We can't manage permissions at all! + + // Check on channel level to make sure we are actually able to set all the permissions! + long channelPermissions = PermissionUtil.getExplicitPermission(channel, selfMember, false); + if ((channelPermissions & Permission.MANAGE_PERMISSIONS.getRawValue()) == 0) // This implies we can only set permissions the bot also has in the channel! + { + //You can only set MANAGE_ROLES if you have ADMINISTRATOR or MANAGE_PERMISSIONS as an override on the channel + // That is why we explicitly exclude it here! + // This is by far the most complex and weird permission logic in the entire API... + long botPerms = PermissionUtil.getEffectivePermission(channel, selfMember) & ~Permission.MANAGE_ROLES.getRawValue(); + EnumSet missing = Permission.getPermissions((allow | deny) & ~botPerms); + if (!missing.isEmpty()) + throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS, "You must have Permission.MANAGE_PERMISSIONS on the channel explicitly in order to set permissions you don't already have!"); + } + } final long id = getId(permHolder); final int type = permHolder instanceof Role ? PermOverrideData.ROLE_TYPE : PermOverrideData.MEMBER_TYPE; withLock(lock, (lock) -> @@ -211,11 +230,22 @@ public ChannelManagerImpl sync(@Nonnull GuildChannel syncSource) Checks.notNull(syncSource, "SyncSource"); Checks.check(getGuild().equals(syncSource.getGuild()), "Sync only works for channels of same guild"); - if(syncSource.equals(getChannel())) + if (syncSource.equals(getChannel())) return this; - if (isPermissionChecksEnabled() && !getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) - throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS); + if (isPermissionChecksEnabled()) + { + Member selfMember = getGuild().getSelfMember(); + if (!selfMember.hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) + throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS); + + if (!selfMember.canSync(channel, syncSource)) + throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS, + "Cannot sync channel with parent due to permission escalation issues. " + + "One of the overrides would set MANAGE_PERMISSIONS or a permission that the bot does not have. " + + "This is not possible without explicitly having MANAGE_PERMISSIONS on this channel or ADMINISTRATOR on a role."); + } + withLock(lock, (lock) -> { diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java index 22470cbb7d..c9295c6a8a 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java @@ -20,6 +20,7 @@ import gnu.trove.map.hash.TLongObjectHashMap; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; import net.dv8tion.jda.api.requests.Request; import net.dv8tion.jda.api.requests.Response; import net.dv8tion.jda.api.requests.restaction.ChannelAction; @@ -32,6 +33,7 @@ import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; +import java.util.EnumSet; import java.util.concurrent.TimeUnit; import java.util.function.BooleanSupplier; @@ -197,12 +199,92 @@ public ChannelActionImpl addRolePermissionOverride(long roleId, long allow, l return addOverride(roleId, PermOverrideData.ROLE_TYPE, allow, deny); } + @Nonnull + @Override + public ChannelAction removePermissionOverride(long id) + { + overrides.remove(id); + return this; + } + + @Nonnull + @Override + public ChannelAction clearPermissionOverrides() + { + overrides.clear(); + return this; + } + + @Nonnull + @Override + @SuppressWarnings("ResultOfMethodCallIgnored") + public ChannelAction syncPermissionOverrides() + { + if (parent == null) + throw new IllegalStateException("Cannot sync overrides without parent category! Use setParent(category) first!"); + clearPermissionOverrides(); + Member selfMember = getGuild().getSelfMember(); + boolean canSetRoles = selfMember.hasPermission(parent, Permission.MANAGE_ROLES); + //You can only set MANAGE_ROLES if you have ADMINISTRATOR or MANAGE_PERMISSIONS as an override on the channel + // That is why we explicitly exclude it here! + // This is by far the most complex and weird permission logic in the entire API... + long botPerms; + if (parent != null) + botPerms = Permission.getRaw(selfMember.getPermissions(parent)) & ~Permission.MANAGE_PERMISSIONS.getRawValue(); + else + botPerms = Permission.getRaw(selfMember.getPermissions()) & ~Permission.MANAGE_PERMISSIONS.getRawValue(); + + parent.getRolePermissionOverrides().forEach(override -> { + long allow = override.getAllowedRaw(); + long deny = override.getDeniedRaw(); + if (!canSetRoles) + { + allow &= botPerms; + deny &= botPerms; + } + addRolePermissionOverride(override.getIdLong(), allow, deny); + }); + + parent.getMemberPermissionOverrides().forEach(override -> { + long allow = override.getAllowedRaw(); + long deny = override.getDeniedRaw(); + if (!canSetRoles) + { + allow &= botPerms; + deny &= botPerms; + } + addMemberPermissionOverride(override.getIdLong(), allow, deny); + }); + return this; + } + private ChannelActionImpl addOverride(long targetId, int type, long allow, long deny) { Checks.notNegative(allow, "Granted permissions value"); Checks.notNegative(deny, "Denied permissions value"); Checks.check(allow <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set"); Checks.check(deny <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set"); + Member selfMember = getGuild().getSelfMember(); + boolean canSetRoles = selfMember.hasPermission(Permission.ADMINISTRATOR); + if (!canSetRoles && parent != null) // You can also set MANAGE_ROLES if you have it on the category (apparently?) + canSetRoles = selfMember.hasPermission(parent, Permission.MANAGE_ROLES); + if (!canSetRoles) + { + // Prevent permission escalation + long botPerms; + if (parent != null) + botPerms = Permission.getRaw(selfMember.getPermissions(parent)); + else + botPerms = Permission.getRaw(selfMember.getPermissions()); + //You can only set MANAGE_ROLES if you have ADMINISTRATOR or MANAGE_PERMISSIONS as an override on the channel + // That is why we explicitly exclude it here! + // This is by far the most complex and weird permission logic in the entire API... + botPerms &= ~Permission.MANAGE_PERMISSIONS.getRawValue(); + + EnumSet missingPerms = Permission.getPermissions((allow | deny) & ~botPerms); + if (!missingPerms.isEmpty()) + throw new InsufficientPermissionException(guild, Permission.MANAGE_PERMISSIONS, "You must have Permission.MANAGE_PERMISSIONS on the channel explicitly in order to set permissions you don't already have!"); + } overrides.put(targetId, new PermOverrideData(type, targetId, allow, deny)); return this; diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java index 8619141d06..745e2530a4 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java @@ -29,10 +29,12 @@ import net.dv8tion.jda.internal.entities.PermissionOverrideImpl; import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.utils.Checks; +import net.dv8tion.jda.internal.utils.PermissionUtil; import okhttp3.RequestBody; import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; +import java.util.EnumSet; import java.util.concurrent.TimeUnit; import java.util.function.BooleanSupplier; @@ -187,6 +189,7 @@ public PermissionOverrideActionImpl setAllow(long allowBits) { Checks.notNegative(allowBits, "Granted permissions value"); Checks.check(allowBits <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set"); + checkPermissions(getCurrentAllow() ^ allowBits); this.allow = allowBits; this.deny &= ~allowBits; allowSet = denySet = true; @@ -200,12 +203,30 @@ public PermissionOverrideActionImpl setDeny(long denyBits) { Checks.notNegative(denyBits, "Denied permissions value"); Checks.check(denyBits <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set"); + checkPermissions(getCurrentDeny() ^ denyBits); this.deny = denyBits; this.allow &= ~denyBits; allowSet = denySet = true; return this; } + protected void checkPermissions(long changed) + { + Member selfMember = getGuild().getSelfMember(); + if (changed != 0 && !selfMember.hasPermission(Permission.ADMINISTRATOR)) + { + long channelPermissions = PermissionUtil.getExplicitPermission(channel, selfMember, false); + if ((channelPermissions & Permission.MANAGE_PERMISSIONS.getRawValue()) == 0) + { + // This implies we can only set permissions the bot also has in the channel + long botPerms = PermissionUtil.getEffectivePermission(channel, selfMember); + EnumSet missing = Permission.getPermissions(changed & ~botPerms); + if (!missing.isEmpty()) + throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS, "You must have Permission.MANAGE_PERMISSIONS on the channel explicitly in order to set permissions you don't already have!"); + } + } + } + @Nonnull @Override @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java index b164bcb8fb..94740252a9 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java @@ -466,6 +466,38 @@ public static long getExplicitPermission(Member member) * @since 3.1 */ public static long getExplicitPermission(GuildChannel channel, Member member) + { + return getExplicitPermission(channel, member, true); + } + + /** + * Retrieves the explicit permissions of the specified {@link net.dv8tion.jda.api.entities.Member Member} + * in its hosting {@link net.dv8tion.jda.api.entities.Guild Guild} and specific {@link net.dv8tion.jda.api.entities.GuildChannel GuildChannel}. + *
      This method does not calculate the owner in. + * Allowed permissions override denied permissions of {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides}! + * + *

      All permissions returned are explicitly granted to this Member via its {@link net.dv8tion.jda.api.entities.Role Roles}. + *
      Permissions like {@link net.dv8tion.jda.api.Permission#ADMINISTRATOR Permission.ADMINISTRATOR} do not + * grant other permissions in this value. + *

      This factor in all {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} that affect this member + * and only grants the ones that are explicitly given. + * + * @param channel + * The target channel of which to check {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} + * @param member + * The non-null {@link net.dv8tion.jda.api.entities.Member Member} for which to get implicit permissions + * @param includeRoles + * Whether the base role permissions should be included + * + * @throws IllegalArgumentException + * If any of the arguments is {@code null} + * or the specified entities are not from the same {@link net.dv8tion.jda.api.entities.Guild Guild} + * + * @return Primitive (unsigned) long value with the implicit permissions of the specified member in the specified channel + * + * @since 3.1 + */ + public static long getExplicitPermission(GuildChannel channel, Member member, boolean includeRoles) { Checks.notNull(channel, "Channel"); Checks.notNull(member, "Member"); @@ -473,7 +505,7 @@ public static long getExplicitPermission(GuildChannel channel, Member member) final Guild guild = member.getGuild(); checkGuild(channel.getGuild(), guild, "Member"); - long permission = getExplicitPermission(member); + long permission = includeRoles ? getExplicitPermission(member) : 0L; AtomicLong allow = new AtomicLong(0); AtomicLong deny = new AtomicLong(0); @@ -508,6 +540,36 @@ public static long getExplicitPermission(GuildChannel channel, Member member) * @since 3.1 */ public static long getExplicitPermission(GuildChannel channel, Role role) + { + return getExplicitPermission(channel, role, true); + } + + /** + * Retrieves the explicit permissions of the specified {@link net.dv8tion.jda.api.entities.Role Role} + * in its hosting {@link net.dv8tion.jda.api.entities.Guild Guild} and specific {@link net.dv8tion.jda.api.entities.GuildChannel GuildChannel}. + *
      Allowed permissions override denied permissions of {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides}! + * + *

      All permissions returned are explicitly granted to this Role. + *
      Permissions like {@link net.dv8tion.jda.api.Permission#ADMINISTRATOR Permission.ADMINISTRATOR} do not + * grant other permissions in this value. + *

      This factor in existing {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} if possible. + * + * @param channel + * The target channel of which to check {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} + * @param role + * The non-null {@link net.dv8tion.jda.api.entities.Role Role} for which to get implicit permissions + * @param includeRoles + * Whether the base role permissions should be included + * + * @throws IllegalArgumentException + * If any of the arguments is {@code null} + * or the specified entities are not from the same {@link net.dv8tion.jda.api.entities.Guild Guild} + * + * @return Primitive (unsigned) long value with the implicit permissions of the specified role in the specified channel + * + * @since 3.1 + */ + public static long getExplicitPermission(GuildChannel channel, Role role, boolean includeRoles) { Checks.notNull(channel, "Channel"); Checks.notNull(role, "Role"); @@ -515,7 +577,7 @@ public static long getExplicitPermission(GuildChannel channel, Role role) final Guild guild = role.getGuild(); checkGuild(channel.getGuild(), guild, "Role"); - long permission = role.getPermissionsRaw() | guild.getPublicRole().getPermissionsRaw(); + long permission = includeRoles ? role.getPermissionsRaw() | guild.getPublicRole().getPermissionsRaw() : 0; PermissionOverride override = channel.getPermissionOverride(guild.getPublicRole()); if (override != null) permission = apply(permission, override.getAllowedRaw(), override.getDeniedRaw()); From 8e4e81f8aed31e108bf6724d1312444b16442f77 Mon Sep 17 00:00:00 2001 From: caneleex Date: Sat, 5 Sep 2020 20:00:32 +0200 Subject: [PATCH 072/121] fix 'weather' typos --- src/main/java/net/dv8tion/jda/api/MessageBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java index 6c3b3f2b41..eb27b7e2db 100644 --- a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java @@ -392,7 +392,7 @@ public int length() /** * Checks if the message contains any contend. This includes text as well as embeds. * - * @return weather the message contains content + * @return whether the message contains content */ public boolean isEmpty() { return builder.length() == 0 && embed == null; @@ -1288,7 +1288,7 @@ public interface SplitPolicy * @param chars * the chars to split on * @param remove - * weather to remove the chars when splitting on them + * whether to remove the chars when splitting on them * * @return a new {@link SplitPolicy} */ From 129c09970121a89f33d9163fdaa4e7bcdcdbde62 Mon Sep 17 00:00:00 2001 From: caneleex Date: Wed, 9 Sep 2020 11:36:51 +0200 Subject: [PATCH 073/121] change throws wording for retrieveMembers --- src/main/java/net/dv8tion/jda/api/entities/Guild.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 16e19fffa6..97f473223b 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -2894,7 +2894,7 @@ default Task> retrieveMembersByIds(@Nonnull long... ids) *

        *
      • If includePresence is {@code true} and the GUILD_PRESENCES intent is disabled
      • *
      • If the input contains null
      • - *
      • If the input is more than 100 IDs
      • + *
      • If the input is more than 100 users
      • *
      * * @return {@link Task} handle for the request From 7d04625b46c94381e5db5d46681b8cc5c227008c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 9 Sep 2020 12:43:52 +0200 Subject: [PATCH 074/121] Improve documentation for reaction events --- .../react/GenericGuildMessageReactionEvent.java | 10 +++++----- .../message/react/GenericMessageReactionEvent.java | 13 ++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java index 81cf0229aa..a02f406022 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java @@ -46,7 +46,7 @@ public GenericGuildMessageReactionEvent(@Nonnull JDA api, long responseNumber, @ } /** - * The id for the user who added/removed their reaction. + * The id for the user who owns the reaction. * * @return The user id */ @@ -57,7 +57,7 @@ public String getUserId() } /** - * The id for the user who added/removed their reaction. + * The id for the user who owns the reaction. * * @return The user id */ @@ -116,7 +116,7 @@ public MessageReaction.ReactionEmote getReactionEmote() } /** - * Retrieves the {@link User} who added or removed the reaction. + * Retrieves the {@link User} who owns the reaction. *
      If a user is known, this will return {@link #getUser()}. * * @return {@link RestAction} - Type: {@link User} @@ -131,7 +131,7 @@ public RestAction retrieveUser() } /** - * Retrieves the {@link Member} who added or removed the reaction. + * Retrieves the {@link Member} who owns the reaction. *
      If a member is known, this will return {@link #getMember()}. * *

      Note that banning a member will also fire {@link GuildMessageReactionRemoveEvent} and no member will be available @@ -154,7 +154,7 @@ public RestAction retrieveMember() *
      Simple shortcut for {@code getChannel().retrieveMessageById(getMessageId())}. * *

      The {@link Message#getMember() Message.getMember()} method will always return null for the resulting message. - * You can, instead, retrieve the member via {@link #getMember()} or {@link #retrieveMember()}. + * To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}. * * @return {@link RestAction} - Type: {@link Message} */ diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java index 775e46c2ce..f47a0572ef 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java @@ -50,7 +50,7 @@ public GenericMessageReactionEvent(@Nonnull JDA api, long responseNumber, @Nulla } /** - * The id for the user who added/removed their reaction. + * The id for the user who owns the reaction. * * @return The user id */ @@ -61,7 +61,7 @@ public String getUserId() } /** - * The id for the user who added/removed their reaction. + * The id for the user who owns reaction. * * @return The user id */ @@ -126,7 +126,7 @@ public MessageReaction.ReactionEmote getReactionEmote() } /** - * Retrieves the {@link User} who added or removed the reaction. + * Retrieves the {@link User} who owns the reaction. *
      If a user is known, this will return {@link #getUser()}. * * @return {@link RestAction} - Type: {@link User} @@ -142,13 +142,16 @@ public RestAction retrieveUser() } /** - * Retrieves the {@link Member} who added or removed the reaction. + * Retrieves the {@link Member} who owns the reaction. *
      If a member is known, this will return {@link #getMember()}. * *

      Note that banning a member will also fire {@link MessageReactionRemoveEvent} and no member will be available * in those cases. An {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MEMBER UNKNOWN_MEMBER} error response * should be the failure result. * + * @throws IllegalStateException + * If this event is not from a guild + * * @return {@link RestAction} - Type: {@link Member} */ @Nonnull @@ -165,7 +168,7 @@ public RestAction retrieveMember() *
      Simple shortcut for {@code getChannel().retrieveMessageById(getMessageId())}. * *

      The {@link Message#getMember() Message.getMember()} method will always return null for the resulting message. - * You can, instead, retrieve the member via {@link #getMember()} or {@link #retrieveMember()}. + * To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}. * * @return {@link RestAction} - Type: {@link Message} */ From 8306875bd578b07f99287741466603242b54dc4a Mon Sep 17 00:00:00 2001 From: caneleex Date: Wed, 23 Sep 2020 11:59:35 +0200 Subject: [PATCH 075/121] add a dot --- src/main/java/net/dv8tion/jda/api/entities/User.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6b8f5a86b8..3cfa885ffd 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/User.java +++ b/src/main/java/net/dv8tion/jda/api/entities/User.java @@ -197,7 +197,7 @@ default String getDefaultAvatarUrl() } /** - * The URL for the user's avatar image + * The URL for the user's avatar image. * If they do not have an avatar set, this will return the URL of their * default avatar * From 0c02790f75d1f4d198bb0f8d59e1415db310c8a4 Mon Sep 17 00:00:00 2001 From: caneleex Date: Thu, 8 Oct 2020 22:32:58 +0200 Subject: [PATCH 076/121] fix "a activity" typos --- src/main/java/net/dv8tion/jda/api/JDABuilder.java | 2 +- .../dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index eebdf7bed3..563b3ac524 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -1319,7 +1319,7 @@ public JDABuilder setIdle(boolean idle) * Sets the {@link net.dv8tion.jda.api.entities.Activity Activity} for our session. *
      This value can be changed at any time in the {@link net.dv8tion.jda.api.managers.Presence Presence} from a JDA instance. * - *

      Hint: You can create a {@link net.dv8tion.jda.api.entities.Activity Activity} object using + *

      Hint: You can create an {@link net.dv8tion.jda.api.entities.Activity Activity} object using * {@link net.dv8tion.jda.api.entities.Activity#playing(String)} or {@link net.dv8tion.jda.api.entities.Activity#streaming(String, String)}. * * @param activity diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index 6ccc41b897..bdd3c859c9 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -1168,7 +1168,7 @@ public DefaultShardManagerBuilder setEventManagerProvider(@Nonnull final IntFunc * Sets the {@link net.dv8tion.jda.api.entities.Activity Activity} for our session. *
      This value can be changed at any time in the {@link net.dv8tion.jda.api.managers.Presence Presence} from a JDA instance. * - *

      Hint: You can create a {@link net.dv8tion.jda.api.entities.Activity Activity} object using + *

      Hint: You can create an {@link net.dv8tion.jda.api.entities.Activity Activity} object using * {@link net.dv8tion.jda.api.entities.Activity#playing(String) Activity.playing(String)} or * {@link net.dv8tion.jda.api.entities.Activity#streaming(String, String)} Activity.streaming(String, String)}. * @@ -1189,7 +1189,7 @@ public DefaultShardManagerBuilder setActivity(@Nullable final Activity activity) * Sets the {@link net.dv8tion.jda.api.entities.Activity Activity} for our session. *
      This value can be changed at any time in the {@link net.dv8tion.jda.api.managers.Presence Presence} from a JDA instance. * - *

      Hint: You can create a {@link net.dv8tion.jda.api.entities.Activity Activity} object using + *

      Hint: You can create an {@link net.dv8tion.jda.api.entities.Activity Activity} object using * {@link net.dv8tion.jda.api.entities.Activity#playing(String) Activity.playing(String)} or * {@link net.dv8tion.jda.api.entities.Activity#streaming(String, String) Activity.streaming(String, String)}. * From e5eda715a9fd31d25daa3204456704766f661bca Mon Sep 17 00:00:00 2001 From: Noe <31541490+HydroPage90@users.noreply.github.com> Date: Thu, 5 Nov 2020 15:18:30 -0800 Subject: [PATCH 077/121] Document all non-privileged intents needed by events (#1277) --- .../jda/api/events/emote/EmoteAddedEvent.java | 7 +++++++ .../jda/api/events/emote/EmoteRemovedEvent.java | 7 +++++++ .../jda/api/events/emote/GenericEmoteEvent.java | 7 +++++++ .../dv8tion/jda/api/events/emote/package-info.java | 7 +++++++ .../events/emote/update/EmoteUpdateNameEvent.java | 7 +++++++ .../events/emote/update/EmoteUpdateRolesEvent.java | 7 +++++++ .../emote/update/GenericEmoteUpdateEvent.java | 7 +++++++ .../jda/api/events/emote/update/package-info.java | 6 ++++++ .../dv8tion/jda/api/events/guild/GuildBanEvent.java | 4 ++++ .../jda/api/events/guild/GuildUnbanEvent.java | 4 ++++ .../guild/invite/GenericGuildInviteEvent.java | 5 +++++ .../events/guild/invite/GuildInviteCreateEvent.java | 5 +++++ .../events/guild/invite/GuildInviteDeleteEvent.java | 5 +++++ .../guild/member/GuildMemberRoleAddEvent.java | 2 +- .../guild/member/GuildMemberRoleRemoveEvent.java | 2 +- .../update/GenericGuildMemberUpdateEvent.java | 4 ++-- .../update/GuildMemberUpdateBoostTimeEvent.java | 2 +- .../update/GuildMemberUpdateNicknameEvent.java | 2 +- .../events/guild/voice/GenericGuildVoiceEvent.java | 12 ++++++++++++ .../guild/voice/GenericGuildVoiceUpdateEvent.java | 13 +++++++++++++ .../events/guild/voice/GuildVoiceDeafenEvent.java | 12 ++++++++++++ .../guild/voice/GuildVoiceGuildDeafenEvent.java | 12 ++++++++++++ .../guild/voice/GuildVoiceGuildMuteEvent.java | 12 ++++++++++++ .../api/events/guild/voice/GuildVoiceJoinEvent.java | 12 ++++++++++++ .../events/guild/voice/GuildVoiceLeaveEvent.java | 12 ++++++++++++ .../api/events/guild/voice/GuildVoiceMoveEvent.java | 12 ++++++++++++ .../api/events/guild/voice/GuildVoiceMuteEvent.java | 12 ++++++++++++ .../guild/voice/GuildVoiceSelfDeafenEvent.java | 12 ++++++++++++ .../events/guild/voice/GuildVoiceSelfMuteEvent.java | 12 ++++++++++++ .../events/guild/voice/GuildVoiceStreamEvent.java | 12 ++++++++++++ .../events/guild/voice/GuildVoiceSuppressEvent.java | 12 ++++++++++++ .../events/guild/voice/GuildVoiceUpdateEvent.java | 12 ++++++++++++ .../jda/api/events/guild/voice/package-info.java | 12 ++++++++++++ .../jda/api/events/message/GenericMessageEvent.java | 8 ++++++++ .../api/events/message/MessageBulkDeleteEvent.java | 8 ++++++++ .../jda/api/events/message/MessageDeleteEvent.java | 8 ++++++++ .../jda/api/events/message/MessageEmbedEvent.java | 8 ++++++++ .../api/events/message/MessageReceivedEvent.java | 9 +++++++++ .../jda/api/events/message/MessageUpdateEvent.java | 8 ++++++++ .../message/guild/GenericGuildMessageEvent.java | 4 ++++ .../message/guild/GuildMessageDeleteEvent.java | 4 ++++ .../message/guild/GuildMessageEmbedEvent.java | 4 ++++ .../message/guild/GuildMessageReceivedEvent.java | 4 ++++ .../message/guild/GuildMessageUpdateEvent.java | 4 ++++ .../jda/api/events/message/guild/package-info.java | 4 ++++ .../react/GenericGuildMessageReactionEvent.java | 4 ++++ .../guild/react/GuildMessageReactionAddEvent.java | 4 ++++ .../react/GuildMessageReactionRemoveAllEvent.java | 4 ++++ .../react/GuildMessageReactionRemoveEmoteEvent.java | 4 ++++ .../react/GuildMessageReactionRemoveEvent.java | 4 ++++ .../events/message/guild/react/package-info.java | 5 +++++ .../jda/api/events/message/package-info.java | 8 ++++++++ .../message/priv/GenericPrivateMessageEvent.java | 4 ++++ .../message/priv/PrivateMessageDeleteEvent.java | 4 ++++ .../message/priv/PrivateMessageEmbedEvent.java | 4 ++++ .../message/priv/PrivateMessageReceivedEvent.java | 4 ++++ .../message/priv/PrivateMessageUpdateEvent.java | 4 ++++ .../jda/api/events/message/priv/package-info.java | 4 ++++ .../react/GenericPrivateMessageReactionEvent.java | 4 ++++ .../priv/react/PrivateMessageReactionAddEvent.java | 4 ++++ .../react/PrivateMessageReactionRemoveEvent.java | 4 ++++ .../api/events/message/priv/react/package-info.java | 4 ++++ .../message/react/GenericMessageReactionEvent.java | 8 ++++++++ .../message/react/MessageReactionAddEvent.java | 8 ++++++++ .../react/MessageReactionRemoveAllEvent.java | 8 ++++++++ .../react/MessageReactionRemoveEmoteEvent.java | 8 ++++++++ .../message/react/MessageReactionRemoveEvent.java | 8 ++++++++ .../jda/api/events/message/react/package-info.java | 8 ++++++++ .../jda/api/events/user/UserActivityEndEvent.java | 2 +- .../jda/api/events/user/UserActivityStartEvent.java | 2 +- .../jda/api/events/user/UserTypingEvent.java | 5 +++-- .../user/update/GenericUserPresenceEvent.java | 4 ++-- .../events/user/update/GenericUserUpdateEvent.java | 4 ++-- .../user/update/UserUpdateActivityOrderEvent.java | 2 +- .../events/user/update/UserUpdateAvatarEvent.java | 2 +- .../user/update/UserUpdateDiscriminatorEvent.java | 2 +- .../api/events/user/update/UserUpdateNameEvent.java | 2 +- .../user/update/UserUpdateOnlineStatusEvent.java | 2 +- 78 files changed, 473 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java index 990480cda5..8602a707d4 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java @@ -23,6 +23,13 @@ /** * Indicates that a new {@link net.dv8tion.jda.api.entities.Emote Emote} was added to a {@link net.dv8tion.jda.api.entities.Guild Guild}. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! */ public class EmoteAddedEvent extends GenericEmoteEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java index 82d3a982dc..afce2b8362 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java @@ -23,6 +23,13 @@ /** * Indicates that an {@link net.dv8tion.jda.api.entities.Emote Emote} was removed from a Guild. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! */ public class EmoteRemovedEvent extends GenericEmoteEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java index fff176045e..b5d4c10bcd 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java @@ -25,6 +25,13 @@ /** * Indicates that an {@link net.dv8tion.jda.api.entities.Emote Emote} was created/removed/updated. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! */ public abstract class GenericEmoteEvent extends Event { diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java b/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java index b702695e26..307d9543a7 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java @@ -19,6 +19,13 @@ * and {@link net.dv8tion.jda.api.events.emote.EmoteRemovedEvent removed emotes}. *
      Important to remember that {@link net.dv8tion.jda.api.entities.Emote Emotes} are not the same as unicode emoji! * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * * @since 3.1 */ package net.dv8tion.jda.api.events.emote; diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java index 75e08653cb..e2a5d2b560 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java @@ -26,6 +26,13 @@ * *

      Can be used to retrieve the old name * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * *

      Identifier: {@code name} */ public class EmoteUpdateNameEvent extends GenericEmoteUpdateEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java index 22aaea594e..1fd17ec9f3 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java @@ -28,6 +28,13 @@ * *

      Can be used to retrieve the old role whitelist * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * *

      Identifier: {@code roles} */ public class EmoteUpdateRolesEvent extends GenericEmoteUpdateEvent> diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java index d8d148b1a4..36b43c734d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java @@ -26,6 +26,13 @@ /** * Indicates that an {@link net.dv8tion.jda.api.entities.Emote Emote} was updated. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! */ public abstract class GenericEmoteUpdateEvent extends GenericEmoteEvent implements UpdateEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java index 4bcd9636e1..67bb11a37a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java @@ -17,5 +17,11 @@ /** * Events that track updates for existing {@link net.dv8tion.jda.api.entities.Emote Emotes} * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#EMOTE EMOTE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_EMOJIS GUILD_EMOJIS} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! */ package net.dv8tion.jda.api.events.emote.update; diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java index 7938068e72..f43e10a555 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java @@ -28,6 +28,10 @@ *
      Note: This does not directly indicate that a Member is removed from the Guild! * * @see net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent GuildMemberRemoveEvent + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_BANS GUILD_BANS} intent to be enabled. */ public class GuildBanEvent extends GenericGuildEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java index 4dcdfd2fb9..f5c588c9f2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java @@ -25,6 +25,10 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.User User} was unbanned from a {@link net.dv8tion.jda.api.entities.Guild Guild}. * *

      Can be used to retrieve the user who was unbanned (if available) and the guild which they were unbanned from. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_BANS GUILD_BANS} intent to be enabled. */ public class GuildUnbanEvent extends GenericGuildEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java index 7798f1f528..5036d15c14 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java @@ -27,6 +27,11 @@ *
      Every GuildInviteEvent is derived from this event and can be casted. * *

      Can be used to detect any GuildInviteEvent. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_INVITES GUILD_INVITES} intent to be enabled. + *
      These events will only fire for invite events that occur in channels where you can {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL}. */ public class GenericGuildInviteEvent extends GenericGuildEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java index 4bd5efdff0..84f0b36300 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java @@ -26,6 +26,11 @@ * Indicates that an {@link Invite Invite} was created in a {@link net.dv8tion.jda.api.entities.Invite.Guild Guild}. * *

      Can be used to track invites for moderation purposes. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_INVITES GUILD_INVITES} intent to be enabled. + *
      This event will only fire for invites created in channels where you can {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL}. */ public class GuildInviteCreateEvent extends GenericGuildInviteEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java index 514d9ae3f7..09f479a945 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java @@ -27,6 +27,11 @@ * Indicates than an {@link Invite} was deleted from a {@link Guild}. * *

      Can be used to track invite deletion for moderation purposes. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_INVITES GUILD_INVITES} intent to be enabled. + *
      This event will only fire for invites deleted in channels where you can {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL MANAGE_CHANNEL}. */ public class GuildInviteDeleteEvent extends GenericGuildInviteEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java index 8c09161ece..841ee0d8ed 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java @@ -34,7 +34,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the role updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java index 3920d9b960..f88b84fbba 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java @@ -34,7 +34,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the role updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java index 8c99b9f03a..ded2e170f3 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java @@ -31,11 +31,11 @@ * *

      Requirements

      * - *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent to be enabled. + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent to be enabled. *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, these events require the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java index 7fb83614b8..9f08a732b7 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java @@ -37,7 +37,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java index 98b4c15e58..95ee076c14 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java @@ -35,7 +35,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java index 5966735e14..79b5951d0a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java @@ -28,6 +28,18 @@ *
      Every GuildVoiceEvent is an instance of this event and can be casted. * *

      Can be used to detect any GuildVoiceEvent. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, these events require the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire specific events like these we + * need to have the old member cached to compare against. */ public abstract class GenericGuildVoiceEvent extends GenericGuildEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java index 376b76b63a..c69b3731a2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java @@ -23,6 +23,19 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +/** + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, these events require the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire specific events like these we + * need to have the old member cached to compare against. + */ public class GenericGuildVoiceUpdateEvent extends GenericGuildVoiceEvent implements GuildVoiceUpdateEvent { protected final VoiceChannel joined, left; diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java index e08da29f78..7c29a4aff8 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java @@ -27,6 +27,18 @@ * and {@link net.dv8tion.jda.api.events.guild.voice.GuildVoiceSelfDeafenEvent GuildVoiceSelfDeafenEvent}! * *

      Can be used to detect when a member is deafened or un-deafened. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceDeafenEvent extends GenericGuildVoiceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java index 8324cb8de9..f6dbe73a56 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java @@ -25,6 +25,18 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.Member Member} was (un-)deafened by a moderator. * *

      Can be used to detect when a member is deafened or un-deafened by a moderator. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceGuildDeafenEvent extends GenericGuildVoiceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java index 579247a33e..cf70691814 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java @@ -25,6 +25,18 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.Member Member} was (un-)muted by a moderator. * *

      Can be used to detect when a member is muted or un-muted by a moderator. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceGuildMuteEvent extends GenericGuildVoiceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java index 1d4746c114..597a8fde48 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java @@ -28,6 +28,18 @@ *

      When the {@link net.dv8tion.jda.api.entities.Member Member} is moved a {@link net.dv8tion.jda.api.events.guild.voice.GuildVoiceMoveEvent GuildVoiceMoveEvent} is fired instead * *

      Can be used to detect when a member joins a voice channel for the first time. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceJoinEvent extends GenericGuildVoiceUpdateEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java index 6c10844f50..605550f8ce 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java @@ -29,6 +29,18 @@ * *

      Can be used to detect when a member leaves a voice channel completely. * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. + * * @see net.dv8tion.jda.api.events.guild.voice.GuildVoiceUpdateEvent GuildVoiceUpdateEvent */ public class GuildVoiceLeaveEvent extends GenericGuildVoiceUpdateEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java index f90c6b0170..1dd65980cd 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java @@ -29,6 +29,18 @@ * *

      Can be used to detect when a member moves from one voice channel to another in the same guild. * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. + * * @see net.dv8tion.jda.api.events.guild.voice.GuildVoiceUpdateEvent GuildVoiceUpdateEvent */ public class GuildVoiceMoveEvent extends GenericGuildVoiceUpdateEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java index 0d1da38918..57b1ddbb45 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java @@ -27,6 +27,18 @@ * and {@link net.dv8tion.jda.api.events.guild.voice.GuildVoiceSelfMuteEvent GuildVoiceSelfMuteEvent}! * *

      Can be used to detect when a member is muted or un-muted. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceMuteEvent extends GenericGuildVoiceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java index 472fab9e0d..56118b48cb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java @@ -25,6 +25,18 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.Member Member} (un-)deafened itself. * *

      Can be used to detect when a member deafens or un-deafens itself. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceSelfDeafenEvent extends GenericGuildVoiceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java index afd6f22415..41aff40f1e 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java @@ -25,6 +25,18 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.Member Member} (un-)muted itself. * *

      Can be used to detect when a member deafens or un-mutes itself. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceSelfMuteEvent extends GenericGuildVoiceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java index cb2cf304bc..dc6eaee980 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java @@ -25,6 +25,18 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.Member Member} started or ended a stream. * *

      Can be used to detect when a user goes live or stops streaming. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. */ public class GuildVoiceStreamEvent extends GenericGuildVoiceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java index a0353af440..856f098176 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java @@ -26,6 +26,18 @@ * *

      Can be used to detect when a member is suppressed or un-suppressed. * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. + * * @see net.dv8tion.jda.api.entities.GuildVoiceState#isSuppressed() GuildVoiceState.isSuppressed() */ public class GuildVoiceSuppressEvent extends GenericGuildVoiceEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java index bcc2882463..14f9c723e4 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java @@ -31,6 +31,18 @@ * *

      Can be used to detect when a Member leaves/joins a channel * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. + * *

      Identifier: {@code voice-channel} */ public interface GuildVoiceUpdateEvent extends UpdateEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java index 938973940d..5db6f302fe 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java @@ -19,5 +19,17 @@ * for one of the {@link net.dv8tion.jda.api.entities.Guild Guild}'s {@link net.dv8tion.jda.api.entities.Member Members}. *
      Every update is an extensions of the {@link net.dv8tion.jda.api.events.guild.voice.GenericGuildVoiceEvent GenericGuildVoiceEvent} * and has specifications for explicit voice state features such as mute/deafen + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.utils.cache.CacheFlag#VOICE_STATE VOICE_STATE} CacheFlag to be enabled, which requires + * the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_VOICE_STATES GUILD_VOICE_STATES} intent. + * + *
      {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables that CacheFlag by default! + * + *

      Additionally, these events require the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire specific events like these we + * need to have the old member cached to compare against. */ package net.dv8tion.jda.api.events.guild.voice; diff --git a/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java index 86f1ea347a..e82a83bef5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java @@ -26,6 +26,14 @@ *
      Every MessageEvent is an instance of this event and can be casted. * *

      Can be used to detect any MessageEvent. + * + *

      Requirements

      + * + *

      These events require at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} to work in private channels
      • + *
      */ public abstract class GenericMessageEvent extends Event { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java index 25e865d2da..2e96b192fd 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java @@ -29,6 +29,14 @@ *
      Set {@link net.dv8tion.jda.api.JDABuilder#setBulkDeleteSplittingEnabled(boolean)} to false in order to enable this event. * *

      Can be used to detect that a large chunk of Messages is deleted in a TextChannel. Providing a list of Message IDs and the specific TextChannel. + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} to work in private channels
      • + *
      */ public class MessageBulkDeleteEvent extends Event { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java index fbe87ecd17..052ac12817 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java @@ -27,6 +27,14 @@ * *

      JDA does not have a cache for messages and is not able to provide previous information due to limitations by the * Discord API! + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} to work in private channels
      • + *
      */ public class MessageDeleteEvent extends GenericMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java index ffe2b7298d..8edb75e264 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java @@ -28,6 +28,14 @@ *
      Discord may need to do additional calculations and resizing tasks on messages that embed websites, thus they send the message only with content and link and use this update to add the missing embed later when the server finishes those calculations. * *

      Can be used to retrieve MessageEmbeds from any message. No matter if private or guild. + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} to work in private channels
      • + *
      */ public class MessageEmbedEvent extends GenericMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java index 971ad40800..db44e291fc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java @@ -29,6 +29,15 @@ *
      This includes {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} and {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}! * *

      Can be used to detect that a Message is received in either a guild- or private channel. Providing a MessageChannel and Message. + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} to work in private channels
      • + *
      + */ public class MessageReceivedEvent extends GenericMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java index 1ed597f0ea..38a167f9cb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java @@ -31,6 +31,14 @@ * *

      JDA does not have a cache for messages and is not able to provide previous information due to limitations by the * Discord API! + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} to work in private channels
      • + *
      */ public class MessageUpdateEvent extends GenericMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java index 4feaa16e4b..a2554b3cac 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java @@ -26,6 +26,10 @@ *
      Every GuildMessageEvent is derived from this event and can be casted. * *

      Can be used to detect any GuildMessageEvent. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} intent to be enabled. */ public abstract class GenericGuildMessageEvent extends GenericGuildEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java index b9f3556ffc..b890561d83 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java @@ -24,6 +24,10 @@ * Indicates that a Guild Message was deleted. * *

      Can be used retrieve affected TextChannel and the id of the deleted Message. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} intent to be enabled. */ public class GuildMessageDeleteEvent extends GenericGuildMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java index d62cf8c183..fef848b284 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java @@ -26,6 +26,10 @@ * Indicates that a Guild Message contains one or more {@link net.dv8tion.jda.api.entities.MessageEmbed Embeds}. * *

      Can be used to retrieve the affected TextChannel, the id of the affected Message and a list of MessageEmbeds. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} intent to be enabled. */ public class GuildMessageEmbedEvent extends GenericGuildMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java index 0c2f37db0e..d1424f045c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java @@ -28,6 +28,10 @@ * Indicates that a Message is received in a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}. * *

      Can be used to retrieve the affected TextChannel and Message. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} intent to be enabled. */ public class GuildMessageReceivedEvent extends GenericGuildMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java index 37d6600008..73765047db 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java @@ -27,6 +27,10 @@ * Indicates that a Message was edited in a {@link net.dv8tion.jda.api.entities.TextChannel TextChannel}. * *

      Can be used to retrieve affected TextChannel and Message. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} intent to be enabled. */ public class GuildMessageUpdateEvent extends GenericGuildMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java index 79ab89fb58..daff8c2385 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java @@ -18,5 +18,9 @@ * Events for {@link net.dv8tion.jda.api.entities.Message Messages} * in {@link net.dv8tion.jda.api.entities.TextChannel TextChannels} * of a {@link net.dv8tion.jda.api.entities.Guild Guild}! + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} intent to be enabled. */ package net.dv8tion.jda.api.events.message.guild; diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java index a02f406022..5a61b488e6 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java @@ -30,6 +30,10 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was added or removed in a TextChannel. * *

      Can be used to detect when a reaction is added or removed in a TextChannel. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} intent to be enabled. */ public abstract class GenericGuildMessageReactionEvent extends GenericGuildMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java index 7d43eeaaf3..2d5a319984 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java @@ -27,6 +27,10 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was added to a Message in a Guild * *

      Can be used to detect when a reaction is added in a guild + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} intent to be enabled. */ public class GuildMessageReactionAddEvent extends GenericGuildMessageReactionEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java index 8d03e9f67f..ec8385fcbb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java @@ -26,6 +26,10 @@ * Indicates that the reactions for a {@link net.dv8tion.jda.api.entities.Message Message} were cleared by a moderator in a guild. * *

      Can be used to detect when the reaction of a message are cleared by a moderator. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} intent to be enabled. */ public class GuildMessageReactionRemoveAllEvent extends GenericGuildMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java index c47908b1ae..e0d8864f93 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java @@ -28,6 +28,10 @@ * *

      Can be used to detect which emoji/emote was removed. * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} intent to be enabled. + * * @since 4.2.0 */ public class GuildMessageReactionRemoveEmoteEvent extends GenericGuildMessageEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java index 31618efb5e..fd26e38498 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java @@ -27,6 +27,10 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was removed from a Message in a Guild * *

      Can be used to detect when a reaction is removed in a guild + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} intent to be enabled. */ public class GuildMessageReactionRemoveEvent extends GenericGuildMessageReactionEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java index 2ba27a82c4..4df6881cda 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java @@ -20,6 +20,11 @@ * cannot provide a Message instance due to missing cache but instead provide the Message ID as * long representation. * + * + *

      Requirements

      + * + *
      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} intent to be enabled. + * * @since 3.1 */ package net.dv8tion.jda.api.events.message.guild.react; diff --git a/src/main/java/net/dv8tion/jda/api/events/message/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/package-info.java index 001aa96336..1df19e6c33 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/package-info.java @@ -21,5 +21,13 @@ * *

      These events combine all {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} * messages but specifications can be found in subpackages. + * + *

      Requirements

      + * + *

      These events require at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGES GUILD_MESSAGES} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} to work in private channels
      • + *
      */ package net.dv8tion.jda.api.events.message; diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java index 2fc0d1353e..68e88624cc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java @@ -26,6 +26,10 @@ *
      Every PrivateMessageEvent is an instance of this event and can be casted. * *

      Can be used to detect any PrivateMessageEvent. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} intent to be enabled. */ public abstract class GenericPrivateMessageEvent extends Event { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java index bda169c90f..94d0d85736 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java @@ -24,6 +24,10 @@ * Indicates that a Message was deleted in a {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. * *

      Can be used to retrieve affected PrivateChannel and the ID of the deleted Message. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} intent to be enabled. */ public class PrivateMessageDeleteEvent extends GenericPrivateMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java index 061f11c4fd..474875402f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java @@ -26,6 +26,10 @@ * Indicates that a Message contains {@link net.dv8tion.jda.api.entities.MessageEmbed Embeds} in a {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. * *

      Can be used to retrieve affected PrivateChannel, the ID of the deleted Message and a list of MessageEmbeds. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} intent to be enabled. */ public class PrivateMessageEmbedEvent extends GenericPrivateMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java index 0da1950f45..a9c66c2d28 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java @@ -25,6 +25,10 @@ * Indicates that a Message was sent in a {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. * *

      Can be used to retrieve affected PrivateChannel and Message. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} intent to be enabled. */ public class PrivateMessageReceivedEvent extends GenericPrivateMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java index 1dbd69fd51..cb65db1acb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java @@ -25,6 +25,10 @@ * Indicates that a Message was edited in a {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel}. * *

      Can be used retrieve affected PrivateChannel and edited Message. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} intent to be enabled. */ public class PrivateMessageUpdateEvent extends GenericPrivateMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java index 95e0d9ebfc..5f035e4cb1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java @@ -17,5 +17,9 @@ /** * Events for {@link net.dv8tion.jda.api.entities.Message Messages} * in {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannels} + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGES DIRECT_MESSAGES} intent to be enabled. */ package net.dv8tion.jda.api.events.message.priv; diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java index f476d26029..3cde9b028a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java @@ -29,6 +29,10 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was added or removed. * *

      Can be used to detect when a message reaction is added or removed from a message. + * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} intent to be enabled. */ public class GenericPrivateMessageReactionEvent extends GenericPrivateMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java index f1f3811893..de233e9ea5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java @@ -25,6 +25,10 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was added to a Message in a PrivateChannel. * *

      Can be used to detect when a reaction is added in a private channel. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} intent to be enabled. */ public class PrivateMessageReactionAddEvent extends GenericPrivateMessageReactionEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java index ff722a8586..18017b6361 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java @@ -25,6 +25,10 @@ * Indicates that a {@link net.dv8tion.jda.api.entities.MessageReaction MessageReaction} was removed from a Message in a PrivateChannel. * *

      Can be used to detect when a reaction is removed in a private channel. + * + *

      Requirements

      + * + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} intent to be enabled. */ public class PrivateMessageReactionRemoveEvent extends GenericPrivateMessageReactionEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java index ac8ccf3c00..4eb02e2a15 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java @@ -20,6 +20,10 @@ * cannot provide a Message instance due to missing cache but instead provide the Message ID as * long representation. * + *

      Requirements

      + * + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} intent to be enabled. + * * @since 3.1 */ package net.dv8tion.jda.api.events.message.priv.react; diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java index f47a0572ef..0a8b03258c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java @@ -31,6 +31,14 @@ *
      Every MessageReactionEvent is derived from this event and can be casted. * *

      Can be used to detect both remove and add events. + * + *

      Requirements

      + * + *

      These events require at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} to work in private channels
      • + *
      */ public class GenericMessageReactionEvent extends GenericMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java index eaa61336cf..71ffabcd32 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java @@ -29,6 +29,14 @@ *
      This includes unicode and custom emoji * *

      Can be used to track when a user adds a reaction to a message + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} to work in private channels
      • + *
      */ public class MessageReactionAddEvent extends GenericMessageReactionEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java index 680d48d6c5..688e335170 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java @@ -26,6 +26,14 @@ * Indicates the the reactions of a message have been cleared by a moderator * *

      Can be used to detect when the reactions of a message are removed by a moderator + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} to work in private channels
      • + *
      */ public class MessageReactionRemoveAllEvent extends GenericMessageEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java index 16a46dcbac..fa8882d997 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java @@ -28,6 +28,14 @@ * *

      Can be used to detect which emoji/emote was removed. * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} to work in private channels
      • + *
      + * * @since 4.2.0 */ public class MessageReactionRemoveEmoteEvent extends GenericMessageEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java index e83ce72a70..12f7eff7bf 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java @@ -28,6 +28,14 @@ * Indicates that a user removed the reaction on a message * *

      Can be used to detect when a reaction is removed from a message + * + *

      Requirements

      + * + *

      This event requires at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} to work in private channels
      • + *
      */ public class MessageReactionRemoveEvent extends GenericMessageReactionEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java index f68616ecdc..8b988e91a1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java @@ -19,5 +19,13 @@ *
      These events * cannot provide a Message instance due to missing cache but instead provide the Message ID as * long representation. + * + *

      Requirements

      + * + *

      The events in this package require at least one of the following intents (Will not fire at all if neither is enabled): + *

        + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_REACTIONS GUILD_MESSAGE_REACTIONS} to work in guild text channels
      • + *
      • {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_REACTIONS DIRECT_MESSAGE_REACTIONS} to work in private channels
      • + *
      */ package net.dv8tion.jda.api.events.message.react; diff --git a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java index c5270b7110..00dd928bd2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java @@ -47,7 +47,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java index ec85b8e85f..34c4ce0bf2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java @@ -42,7 +42,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java index 93cbf62dcf..9d40a62ebb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java @@ -25,9 +25,10 @@ /** * Indicates that a {@link net.dv8tion.jda.api.entities.User User} started typing. (Similar to the typing indicator in the Discord client) * - *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_TYPING GUILD_MESSAGE_TYPING} intent to be enabled. + *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_TYPING GUILD_MESSAGE_TYPING} intent to be enabled to fire + * for guild channels, and {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_TYPING DIRECT_MESSAGE_TYPING} to fire for private channels. *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and - * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! + * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable these by default! * *

      Can be used to retrieve the User who started typing and when and in which MessageChannel they started typing. */ diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java index 51be2fdfb2..cb4329e8b1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java @@ -31,11 +31,11 @@ * *

      Requirements

      * - *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_PRESENCES GUILD_PRESENCES} intent to be enabled. + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_PRESENCES GUILD_PRESENCES} intent to be enabled. *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, these events require the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java index 452669cece..5527b38ff8 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java @@ -30,11 +30,11 @@ * *

      Requirements

      * - *

      This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent to be enabled. + *

      These events require the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent to be enabled. *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, these events require the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java index befcbfd9d9..50b888dbe1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java @@ -37,7 +37,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java index 65f6874b37..fdf201d6b7 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java @@ -35,7 +35,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java index 26de476191..f8cf0bd82c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java @@ -34,7 +34,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java index 955d991786..7bd1c4933d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java @@ -34,7 +34,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java index 170955e066..1d1bdf4be0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java @@ -36,7 +36,7 @@ *
      {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! * - *

      Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + *

      Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the * member was updated and gives us the updated member object. In order to fire a specific event like this we * need to have the old member cached to compare against. From 2ef4995f50eea0fbe36b12db8bb8ad2b7bb1acdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebo=20Moln=C3=A1r?= Date: Sun, 15 Nov 2020 14:17:36 +0100 Subject: [PATCH 078/121] fix some typos (#1436) --- src/main/java/net/dv8tion/jda/api/entities/Guild.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Role.java | 2 +- src/main/java/net/dv8tion/jda/api/package-info.java | 2 +- .../net/dv8tion/jda/api/requests/restaction/MessageAction.java | 2 +- .../api/requests/restaction/pagination/PaginationAction.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) 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 97f473223b..55e0d6a4b0 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -897,7 +897,7 @@ default List getMembersByNickname(@Nullable String nickname, boolean ign /** * Gets a list of all {@link net.dv8tion.jda.api.entities.Member Members} who have the same effective name as the one provided. - *
      This compares against {@link net.dv8tion.jda.api.entities.Member#getEffectiveName()}}. + *
      This compares against {@link net.dv8tion.jda.api.entities.Member#getEffectiveName()}. *
      If there are no {@link net.dv8tion.jda.api.entities.Member Members} with the provided name, then this returns an empty list. * *

      This will only check cached members! diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java index f6bc9573b8..28ddee3a70 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java @@ -67,7 +67,7 @@ public interface GuildChannel extends ISnowflake, Comparable /** * Parent {@link net.dv8tion.jda.api.entities.Category Category} of this * GuildChannel. Channels don't need to have a parent Category. - *
      Note that an {@link net.dv8tion.jda.api.entities.Category Category} will + *
      Note that a {@link net.dv8tion.jda.api.entities.Category Category} will * always return {@code null} for this method as nested categories are not supported. * * @return Possibly-null {@link net.dv8tion.jda.api.entities.Category Category} for this GuildChannel diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java index 407f924074..91574fcd22 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java @@ -481,7 +481,7 @@ default MessageAction sendMessage(@Nonnull MessageEmbed embed) *

    * @throws java.lang.IllegalArgumentException * If the provided message is {@code null} or the provided {@link net.dv8tion.jda.api.entities.Message Message} - * contains an {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} + * contains a {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} * that is not {@link net.dv8tion.jda.api.entities.MessageEmbed#isSendable() sendable} * @throws java.lang.UnsupportedOperationException * If this is a {@link net.dv8tion.jda.api.entities.PrivateChannel PrivateChannel} diff --git a/src/main/java/net/dv8tion/jda/api/entities/Role.java b/src/main/java/net/dv8tion/jda/api/entities/Role.java index 4fbdb0935d..33ea8c8d73 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Role.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Role.java @@ -47,7 +47,7 @@ public interface Role extends IMentionable, IPermissionHolder, Comparable /** * The hierarchical position of this {@link net.dv8tion.jda.api.entities.Role Role} * in the {@link net.dv8tion.jda.api.entities.Guild Guild} hierarchy. (higher value means higher role). - *
    The {@link net.dv8tion.jda.api.entities.Guild#getPublicRole()}'s getPosition() always return -1. + *
    The {@link net.dv8tion.jda.api.entities.Guild#getPublicRole()}'s getPosition() always returns -1. * * @throws IllegalStateException * If this role is not in the guild cache diff --git a/src/main/java/net/dv8tion/jda/api/package-info.java b/src/main/java/net/dv8tion/jda/api/package-info.java index bd6f6003f7..d9ba316f6f 100644 --- a/src/main/java/net/dv8tion/jda/api/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/package-info.java @@ -29,7 +29,7 @@ *
  • {@link net.dv8tion.jda.api.MessageBuilder MessageBuilder} *
    Used to build a {@link net.dv8tion.jda.api.entities.Message Message} which can be used to * send a message to a {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} together with - * an {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} and Text-To-Speech!
  • + * a {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} and Text-To-Speech! * *
  • {@link net.dv8tion.jda.api.EmbedBuilder EmbedBuilder} *
    Used to build a {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java index db38314a6c..e51d954486 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java @@ -200,7 +200,7 @@ static boolean isDefaultMentionRepliedUser() * The nullable Message to apply settings from * * @throws java.lang.IllegalArgumentException - * If the message contains an {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} + * If the message contains a {@link net.dv8tion.jda.api.entities.MessageEmbed MessageEmbed} * that exceeds the sendable character limit, * see {@link net.dv8tion.jda.api.entities.MessageEmbed#isSendable() MessageEmbed.isSendable()} * diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java index 4815e0979a..3ddc25d821 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java @@ -45,7 +45,7 @@ * * Retrieves messages until the specified limit is reached. The messages will be limited after being filtered by the user. * * If the user hasn't sent enough messages this will go through all messages so it is recommended to add an additional end condition. * */ - * public static{@literal List} getMessagesByUser(MessageChannel channel, User user, int limit) + * public static {@literal List} getMessagesByUser(MessageChannel channel, User user, int limit) * { * MessagePaginationAction action = channel.getIterableHistory(); * Stream{@literal } messageStream = action.stream() From 1ffd2480b3ed9b562cb59dea914628bee51de571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 23 Nov 2020 18:03:02 +0100 Subject: [PATCH 079/121] Update some message reaction related documentation --- .../java/net/dv8tion/jda/api/entities/MessageChannel.java | 6 ++++-- .../guild/react/GenericGuildMessageReactionEvent.java | 2 ++ .../events/message/react/GenericMessageReactionEvent.java | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java index 91574fcd22..4706ee2647 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java @@ -781,7 +781,8 @@ default MessageAction sendFile(@Nonnull byte[] data, @Nonnull String fileName, @ * the same id as the id provided. *
    Note: when retrieving a Message, you must retrieve it from the channel it was sent in! * - *

    Only bots can use this endpoint! A similar behaviour can be simulated using {@link #getHistoryAround(long, int)}! + *

    The {@link Message#getMember() Message.getMember()} method will always return null for the resulting message. + * To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}. * *

    The following {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} are possible: *

      @@ -836,7 +837,8 @@ default RestAction retrieveMessageById(@Nonnull String messageId) * the same id as the id provided. *
      Note: when retrieving a Message, you must retrieve it from the channel it was sent in! * - *

      Only bots can use this endpoint! A similar behaviour can be simulated using {@link #getHistoryAround(long, int)}! + *

      The {@link Message#getMember() Message.getMember()} method will always return null for the resulting message. + * To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}. * *

      The following {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} are possible: *

        diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java index 5a61b488e6..fd4d3c3790 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java @@ -73,6 +73,7 @@ public long getUserIdLong() /** * The reacting {@link net.dv8tion.jda.api.entities.User User} *
        This might be missing if the user was not previously cached or the member was removed. + * Use {@link #retrieveUser()} to load the user. * * @return The reacting user or null if this information is missing * @@ -87,6 +88,7 @@ public User getUser() /** * The {@link net.dv8tion.jda.api.entities.Member Member} instance for the reacting user *
        This might be missing if the user was not previously cached or the member was removed. + * Use {@link #retrieveMember()} to load the member. * * @return The member instance for the reacting user or null if this information is missing */ diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java index 0a8b03258c..99e8113e21 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java @@ -81,6 +81,7 @@ public long getUserIdLong() /** * The reacting {@link net.dv8tion.jda.api.entities.User User} *
        This might be missing if the user was not cached. + * Use {@link #retrieveUser()} to load the user. * * @return The reacting user or null if this information is missing */ @@ -95,6 +96,8 @@ public User getUser() /** * The {@link net.dv8tion.jda.api.entities.Member Member} instance for the reacting user * or {@code null} if the reaction was from a user not in this guild. + *
        This will also be {@code null} if the member is not available in the cache. + * Use {@link #retrieveMember()} to load the member. * * @throws java.lang.IllegalStateException * If this was not sent in a {@link net.dv8tion.jda.api.entities.TextChannel}. From 21db5898982cde54b0c509a09623157aa04382a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 23 Nov 2020 18:07:14 +0100 Subject: [PATCH 080/121] Remove mentions of "default" state that are confusing --- src/main/java/net/dv8tion/jda/api/JDABuilder.java | 3 +-- src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index 563b3ac524..0188bc934b 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -1509,7 +1509,6 @@ public JDABuilder setVoiceDispatchInterceptor(@Nullable VoiceDispatchInterceptor /** * The {@link ChunkingFilter} to filter which guilds should use member chunking. - *
        By default this uses {@link ChunkingFilter#ALL}. * *

        If a guild is configured for chunking the {@link #setMemberCachePolicy(MemberCachePolicy)} will be ignored. * @@ -1549,7 +1548,7 @@ public JDABuilder setChunkingFilter(@Nullable ChunkingFilter filter) * * @since 4.1.0 * - * @deprecated This is now superceded by {@link #setDisabledIntents(Collection)} and {@link #setMemberCachePolicy(MemberCachePolicy)}. + * @deprecated This is now superseded by {@link #setDisabledIntents(Collection)} and {@link #setMemberCachePolicy(MemberCachePolicy)}. * To get identical behavior you can do {@code setMemberCachePolicy(VOICE).setDisabledIntents(GatewayIntent.GUILD_PRESENCES, GatewayIntent.GUILD_MESSAGE_TYPING, GatewayIntent.GUILD_MEMBERS)} */ @Nonnull diff --git a/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java b/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java index 7e8dcff6e8..5951163bb8 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java +++ b/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java @@ -39,7 +39,7 @@ @FunctionalInterface public interface ChunkingFilter { - /** Chunk all guilds (default) */ + /** Chunk all guilds */ ChunkingFilter ALL = (x) -> true; /** Do not chunk any guilds (lazy loading) */ ChunkingFilter NONE = (x) -> false; From 79b38ab9189f0edabe16fda419a7df7bdc97eb6a Mon Sep 17 00:00:00 2001 From: mTvare <57838468+mTvare6@users.noreply.github.com> Date: Sat, 19 Dec 2020 20:52:30 +0530 Subject: [PATCH 081/121] Fixed outdated documentation of an example of builder in EventListener. (#1475) --- src/main/java/net/dv8tion/jda/api/hooks/EventListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java b/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java index 8f8f3f623c..40abe42770 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java @@ -28,7 +28,7 @@ *

        Examples: *
        * - * JDA jda = new {@link net.dv8tion.jda.api.JDABuilder JDABuilder}("token").{@link net.dv8tion.jda.api.JDABuilder#addEventListeners(Object...) addEventListeners(listeners)}.{@link net.dv8tion.jda.api.JDABuilder#build() build()};
        + * JDA jda = {@link net.dv8tion.jda.api.JDABuilder JDABuilder}.createDefault("token").{@link net.dv8tion.jda.api.JDABuilder#addEventListeners(Object...) addEventListeners(listeners)}.{@link net.dv8tion.jda.api.JDABuilder#build() build()};
        * {@link net.dv8tion.jda.api.JDA#addEventListener(Object...) jda.addEventListener(listeners)}; *
        * From 0c8ae8444a1f29dac1c59a62517aaebbaaae7a84 Mon Sep 17 00:00:00 2001 From: Taucher2003 Date: Tue, 29 Dec 2020 01:29:23 +0100 Subject: [PATCH 082/121] Fixed documentation at retrieveVanityUrl --- src/main/java/net/dv8tion/jda/api/entities/Guild.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 55e0d6a4b0..022f92d61a 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -349,7 +349,7 @@ default String getSplashUrl() * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: *

          *
        • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} - *
          The ban list cannot be fetched due to a permission discrepancy
        • + *
          The vanity url cannot be fetched due to a permission discrepancy *
        * * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException From de720b4137d5093dd030167d11c08322f7d6c80f Mon Sep 17 00:00:00 2001 From: Andre_601 <11576465+Andre601@users.noreply.github.com> Date: Thu, 18 Feb 2021 16:15:46 +0100 Subject: [PATCH 083/121] Add competing to See also links --- src/main/java/net/dv8tion/jda/api/entities/Activity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/dv8tion/jda/api/entities/Activity.java b/src/main/java/net/dv8tion/jda/api/entities/Activity.java index f670a1aa44..6999e16f37 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Activity.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Activity.java @@ -41,6 +41,7 @@ * @see #watching(String) * @see #listening(String) * @see #streaming(String, String) + * @see #competing(String) */ public interface Activity { From 79aafb27ddb15ff7bcc61c6df7296b248fd5e971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 25 Feb 2021 15:47:21 +0100 Subject: [PATCH 084/121] Fix issue with permission checks for ChannelAction/Manager The parent permissions should not override the role permissions --- .../requests/restaction/ChannelActionImpl.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java index c9295c6a8a..052016933b 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java @@ -29,6 +29,7 @@ import net.dv8tion.jda.internal.entities.EntityBuilder; import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.utils.Checks; +import net.dv8tion.jda.internal.utils.PermissionUtil; import okhttp3.RequestBody; import javax.annotation.CheckReturnValue; @@ -228,11 +229,7 @@ public ChannelAction syncPermissionOverrides() //You can only set MANAGE_ROLES if you have ADMINISTRATOR or MANAGE_PERMISSIONS as an override on the channel // That is why we explicitly exclude it here! // This is by far the most complex and weird permission logic in the entire API... - long botPerms; - if (parent != null) - botPerms = Permission.getRaw(selfMember.getPermissions(parent)) & ~Permission.MANAGE_PERMISSIONS.getRawValue(); - else - botPerms = Permission.getRaw(selfMember.getPermissions()) & ~Permission.MANAGE_PERMISSIONS.getRawValue(); + long botPerms = PermissionUtil.getEffectivePermission(selfMember) & ~Permission.MANAGE_PERMISSIONS.getRawValue(); parent.getRolePermissionOverrides().forEach(override -> { long allow = override.getAllowedRaw(); @@ -271,15 +268,10 @@ private ChannelActionImpl addOverride(long targetId, int type, long allow, lo if (!canSetRoles) { // Prevent permission escalation - long botPerms; - if (parent != null) - botPerms = Permission.getRaw(selfMember.getPermissions(parent)); - else - botPerms = Permission.getRaw(selfMember.getPermissions()); //You can only set MANAGE_ROLES if you have ADMINISTRATOR or MANAGE_PERMISSIONS as an override on the channel // That is why we explicitly exclude it here! // This is by far the most complex and weird permission logic in the entire API... - botPerms &= ~Permission.MANAGE_PERMISSIONS.getRawValue(); + long botPerms = PermissionUtil.getEffectivePermission(selfMember) & ~Permission.MANAGE_PERMISSIONS.getRawValue(); EnumSet missingPerms = Permission.getPermissions((allow | deny) & ~botPerms); if (!missingPerms.isEmpty()) From 2fcd1b640db88f0ccbbcdb76e7ab578f7e416ef7 Mon Sep 17 00:00:00 2001 From: caneleex Date: Fri, 26 Feb 2021 14:39:49 +0100 Subject: [PATCH 085/121] fix docs for GuildVoiceState#isMuted --- src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java b/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java index 97e9e72486..b733c58ec3 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java @@ -53,7 +53,7 @@ public interface GuildVoiceState /** * Returns whether the {@link net.dv8tion.jda.api.entities.Member Member} is muted, either - * by choice {@link #isSelfMuted()} or deafened by an admin {@link #isGuildMuted()} + * by choice {@link #isSelfMuted()} or muted by an admin {@link #isGuildMuted()} * * @return the Member's mute status */ From 4b826c71d79382e8e9efc58be253342912233953 Mon Sep 17 00:00:00 2001 From: caneleex Date: Fri, 29 Jan 2021 11:25:56 +0100 Subject: [PATCH 086/121] update docs for SessionController --- .../java/net/dv8tion/jda/api/utils/SessionController.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 e94af5e83e..91b6793c44 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/SessionController.java +++ b/src/main/java/net/dv8tion/jda/api/utils/SessionController.java @@ -50,7 +50,7 @@ * Using {@link net.dv8tion.jda.api.JDABuilder JDABuilder} *
        *
        
        - * JDABuilder builder = new JDABuilder(AccountType.BOT).setToken(BOT_TOKEN);
        + * JDABuilder builder = JDABuilder.createDefault(BOT_TOKEN);
          * builder.setSessionController(new SessionControllerAdapter() {
          *     {@literal @Override}
          *     public void appendSession(SessionConnectNode node) {
        @@ -60,15 +60,14 @@
          * });
          * builder.addEventListeners(myListener);
          * for (int i = 0; i {@literal <} 10; i++) {
        - *     builder.useSharding(i, 10).buildAsync();
        + *     builder.useSharding(i, 10).build();
          * }
          * 
        * *

        Using {@link net.dv8tion.jda.api.sharding.ShardManager ShardManager} *
        *

        
        - * DefaultShardManagerBuilder builder = new DefaultShardManagerBuilder();
        - * builder.setToken(BOT_TOKEN);
        + * DefaultShardManagerBuilder builder = DefaultShardManagerBuilder.createDefault(BOT_TOKEN);
          * builder.setSessionController(new SessionControllerAdapter() {
          *     {@literal @Override}
          *     public {@literal Pair} getGatewayBot(JDA api) {
        
        From e33877d2b5972c4e97eeed6f874814f35e6572e8 Mon Sep 17 00:00:00 2001
        From: arynxd <64087640+arynxd@users.noreply.github.com>
        Date: Sat, 13 Feb 2021 02:04:01 +0000
        Subject: [PATCH 087/121] Add maximum reactions constant
        
        ---
         src/main/java/net/dv8tion/jda/api/entities/Message.java | 7 +++++++
         1 file changed, 7 insertions(+)
        
        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 b1f530d0f9..d23555abae 100644
        --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java
        +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java
        @@ -139,6 +139,13 @@ public interface Message extends ISnowflake, Formattable
              * @see MessageAction#append(CharSequence) MessageAction.append(...)
              */
             int MAX_CONTENT_LENGTH = 2000;
        +    
        +    /**
        +    * The maximum amount of reactions that can be added to one message ({@value})
        +    * 
        +    * @see Message#addReaction(String) Message#addReaction(net.dv8tion.jda.api.entities.Emote)
        +    */
        +    int MAX_REACTIONS = 20;
         
             /**
              * Pattern used to find instant invites in strings.
        
        From d37c5409f2097cc4c7f19150c13def85728c422a Mon Sep 17 00:00:00 2001
        From: arynxd <64087640+arynxd@users.noreply.github.com>
        Date: Sat, 13 Feb 2021 02:17:52 +0000
        Subject: [PATCH 088/121] Update
         src/main/java/net/dv8tion/jda/api/entities/Message.java
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        
        yeah i was taking examples from the ones above.
        
        Co-authored-by: Florian Spieß 
        ---
         src/main/java/net/dv8tion/jda/api/entities/Message.java | 3 ++-
         1 file changed, 2 insertions(+), 1 deletion(-)
        
        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 d23555abae..15c043e640 100644
        --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java
        +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java
        @@ -143,7 +143,8 @@ public interface Message extends ISnowflake, Formattable
             /**
             * The maximum amount of reactions that can be added to one message ({@value})
             * 
        -    * @see Message#addReaction(String) Message#addReaction(net.dv8tion.jda.api.entities.Emote)
        +    * @see Message#addReaction(String)
        +    * @see Message#addReaction(net.dv8tion.jda.api.entities.Emote)
             */
             int MAX_REACTIONS = 20;
         
        
        From cd1c7d86a3395f43c3ca6e68ff2510a48618edf3 Mon Sep 17 00:00:00 2001
        From: arynxd <64087640+arynxd@users.noreply.github.com>
        Date: Tue, 23 Feb 2021 15:41:52 +0000
        Subject: [PATCH 089/121] Adjust docs
        MIME-Version: 1.0
        Content-Type: text/plain; charset=UTF-8
        Content-Transfer-Encoding: 8bit
        
        Co-authored-by: Florian Spieß 
        ---
         src/main/java/net/dv8tion/jda/api/entities/Message.java | 2 +-
         1 file changed, 1 insertion(+), 1 deletion(-)
        
        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 15c043e640..62121bfe45 100644
        --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java
        +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java
        @@ -140,7 +140,7 @@ public interface Message extends ISnowflake, Formattable
              */
             int MAX_CONTENT_LENGTH = 2000;
             
        -    /**
        +   /**
             * The maximum amount of reactions that can be added to one message ({@value})
             * 
             * @see Message#addReaction(String)
        
        From 17659ee2d5865aaf58f74bfda531a1aeb0da6bf9 Mon Sep 17 00:00:00 2001
        From: Duncan Sterken 
        Date: Tue, 2 Mar 2021 21:37:19 +0100
        Subject: [PATCH 090/121] Add a length check for the author name (#1528)
        
        * Add a length check for the author name
        
        * Change length variable
        
        * Add docs
        
        * Add constant for author length
        ---
         src/main/java/net/dv8tion/jda/api/EmbedBuilder.java      | 6 ++++++
         .../java/net/dv8tion/jda/api/entities/MessageEmbed.java  | 9 +++++++++
         2 files changed, 15 insertions(+)
        
        diff --git a/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java b/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java
        index 2765e3d983..da66a1c791 100644
        --- a/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java
        +++ b/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java
        @@ -567,6 +567,9 @@ public EmbedBuilder setImage(@Nullable String url)
              * @param  name
              *         the name of the author of the embed. If this is not set, the author will not appear in the embed
              *
        +     * @throws java.lang.IllegalArgumentException
        +     *         If the length of {@code name} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#AUTHOR_MAX_LENGTH}.
        +     *
              * @return the builder after the author has been set
              */
             @Nonnull
        @@ -589,6 +592,7 @@ public EmbedBuilder setAuthor(@Nullable String name)
              *
              * @throws java.lang.IllegalArgumentException
              *         
          + *
        • If the length of {@code name} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#AUTHOR_MAX_LENGTH}.
        • *
        • If the length of {@code url} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#URL_MAX_LENGTH}.
        • *
        • If the provided {@code url} is not a properly formatted http or https url.
        • *
        @@ -631,6 +635,7 @@ public EmbedBuilder setAuthor(@Nullable String name, @Nullable String url) * * @throws java.lang.IllegalArgumentException *
          + *
        • If the length of {@code name} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#AUTHOR_MAX_LENGTH}.
        • *
        • If the length of {@code url} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#URL_MAX_LENGTH}.
        • *
        • If the provided {@code url} is not a properly formatted http or https url.
        • *
        • If the length of {@code iconUrl} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#URL_MAX_LENGTH}.
        • @@ -650,6 +655,7 @@ public EmbedBuilder setAuthor(@Nullable String name, @Nullable String url, @Null } else { + Checks.check(name.length() <= MessageEmbed.AUTHOR_MAX_LENGTH, "Name cannot be longer than %d characters.", MessageEmbed.AUTHOR_MAX_LENGTH); urlCheck(url); urlCheck(iconUrl); this.author = new MessageEmbed.AuthorInfo(name, url, iconUrl, null); 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 3f4bd5f195..5896e309a3 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java @@ -53,6 +53,15 @@ public class MessageEmbed implements SerializableData */ public static final int TITLE_MAX_LENGTH = 256; + /** + * The maximum length the author name of an embed can have + * + * @see net.dv8tion.jda.api.EmbedBuilder#setAuthor(String) (String) EmbedBuilder.setAuthor(title) + * @see net.dv8tion.jda.api.EmbedBuilder#setAuthor(String, String) EmbedBuilder.setAuthor(title, url) + * @see net.dv8tion.jda.api.EmbedBuilder#setAuthor(String, String, String) EmbedBuilder.setAuthor(title, url, iconUrl) + */ + public static final int AUTHOR_MAX_LENGTH = 256; + /** * The maximum length an embed field value can have * From f1ed9a211fc254c99ff8a879b7bf913f7b0ba183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 3 Mar 2021 16:29:36 +0100 Subject: [PATCH 091/121] Add Permission.USE_SLASH_COMMANDS (#1522) --- src/main/java/net/dv8tion/jda/api/Permission.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/Permission.java b/src/main/java/net/dv8tion/jda/api/Permission.java index 1b13d76bc2..d5a0b8fab1 100644 --- a/src/main/java/net/dv8tion/jda/api/Permission.java +++ b/src/main/java/net/dv8tion/jda/api/Permission.java @@ -52,6 +52,7 @@ public enum Permission MESSAGE_HISTORY( 16, true, true, "Read History"), MESSAGE_MENTION_EVERYONE(17, true, true, "Mention Everyone"), MESSAGE_EXT_EMOJI( 18, true, true, "Use External Emojis"), + USE_SLASH_COMMANDS( 31, true, true, "Use Slash Commands"), // Voice Permissions VOICE_STREAM( 9, true, true, "Stream"), @@ -101,7 +102,7 @@ public enum Permission public static final long ALL_TEXT_PERMISSIONS = Permission.getRaw(MESSAGE_ADD_REACTION, MESSAGE_WRITE, MESSAGE_TTS, MESSAGE_MANAGE, MESSAGE_EMBED_LINKS, MESSAGE_ATTACH_FILES, - MESSAGE_HISTORY, MESSAGE_MENTION_EVERYONE); + MESSAGE_HISTORY, MESSAGE_MENTION_EVERYONE, USE_SLASH_COMMANDS); /** * All voice channel specific permissions which are only available in voice channel permission overrides @@ -118,7 +119,7 @@ public enum Permission Permission(int offset, boolean isGuild, boolean isChannel, @Nonnull String name) { this.offset = offset; - this.raw = 1 << offset; + this.raw = 1L << offset; this.isGuild = isGuild; this.isChannel = isChannel; this.name = name; From ebe3d3aa26ca8ca41aa95e759f00c553efa58570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Wed, 3 Mar 2021 22:30:49 +0100 Subject: [PATCH 092/121] Remove 2020 from copyright (#1529) We can just stick to the date of creation --- LICENSE | 2 +- build.gradle.kts | 2 +- src/examples/java/AudioEchoExample.java | 2 +- src/examples/java/LRUCachePolicy.java | 2 +- src/examples/java/MessageListenerExample.java | 2 +- .../java/net/dv8tion/jda/annotations/DeprecatedSince.java | 2 +- src/main/java/net/dv8tion/jda/annotations/ForRemoval.java | 2 +- src/main/java/net/dv8tion/jda/annotations/Incubating.java | 2 +- src/main/java/net/dv8tion/jda/annotations/ReplaceWith.java | 2 +- src/main/java/net/dv8tion/jda/annotations/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/AccountType.java | 2 +- src/main/java/net/dv8tion/jda/api/EmbedBuilder.java | 2 +- src/main/java/net/dv8tion/jda/api/GatewayEncoding.java | 2 +- src/main/java/net/dv8tion/jda/api/JDA.java | 2 +- src/main/java/net/dv8tion/jda/api/JDABuilder.java | 2 +- src/main/java/net/dv8tion/jda/api/JDAInfo.java | 2 +- src/main/java/net/dv8tion/jda/api/MessageBuilder.java | 2 +- src/main/java/net/dv8tion/jda/api/OnlineStatus.java | 2 +- src/main/java/net/dv8tion/jda/api/Permission.java | 2 +- src/main/java/net/dv8tion/jda/api/Region.java | 2 +- src/main/java/net/dv8tion/jda/api/audio/AudioNatives.java | 2 +- .../java/net/dv8tion/jda/api/audio/AudioReceiveHandler.java | 2 +- src/main/java/net/dv8tion/jda/api/audio/AudioSendHandler.java | 2 +- src/main/java/net/dv8tion/jda/api/audio/CombinedAudio.java | 2 +- src/main/java/net/dv8tion/jda/api/audio/OpusPacket.java | 2 +- src/main/java/net/dv8tion/jda/api/audio/SpeakingMode.java | 2 +- src/main/java/net/dv8tion/jda/api/audio/UserAudio.java | 2 +- .../net/dv8tion/jda/api/audio/factory/DefaultSendFactory.java | 2 +- .../net/dv8tion/jda/api/audio/factory/DefaultSendSystem.java | 2 +- .../net/dv8tion/jda/api/audio/factory/IAudioSendFactory.java | 2 +- .../net/dv8tion/jda/api/audio/factory/IAudioSendSystem.java | 2 +- .../net/dv8tion/jda/api/audio/factory/IPacketProvider.java | 2 +- .../java/net/dv8tion/jda/api/audio/factory/package-info.java | 2 +- .../net/dv8tion/jda/api/audio/hooks/ConnectionListener.java | 2 +- .../net/dv8tion/jda/api/audio/hooks/ConnectionStatus.java | 2 +- .../java/net/dv8tion/jda/api/audio/hooks/ListenerProxy.java | 2 +- .../java/net/dv8tion/jda/api/audio/hooks/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/audio/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/audit/ActionType.java | 2 +- src/main/java/net/dv8tion/jda/api/audit/AuditLogChange.java | 2 +- src/main/java/net/dv8tion/jda/api/audit/AuditLogEntry.java | 2 +- src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java | 2 +- src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java | 2 +- src/main/java/net/dv8tion/jda/api/audit/TargetType.java | 2 +- .../java/net/dv8tion/jda/api/audit/ThreadLocalReason.java | 2 +- src/main/java/net/dv8tion/jda/api/audit/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Activity.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/ActivityFlag.java | 2 +- .../java/net/dv8tion/jda/api/entities/ApplicationInfo.java | 2 +- .../java/net/dv8tion/jda/api/entities/ApplicationTeam.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Category.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/ChannelType.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/ClientType.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/EmbedType.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Emote.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Guild.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java | 2 +- .../java/net/dv8tion/jda/api/entities/GuildVoiceState.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/IFakeable.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/IMentionable.java | 2 +- .../java/net/dv8tion/jda/api/entities/IPermissionHolder.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/ISnowflake.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Icon.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Invite.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/ListedEmote.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Member.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Message.java | 2 +- .../java/net/dv8tion/jda/api/entities/MessageActivity.java | 2 +- .../java/net/dv8tion/jda/api/entities/MessageChannel.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java | 2 +- .../java/net/dv8tion/jda/api/entities/MessageHistory.java | 2 +- .../java/net/dv8tion/jda/api/entities/MessageReaction.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/MessageType.java | 2 +- .../java/net/dv8tion/jda/api/entities/PermissionOverride.java | 2 +- .../java/net/dv8tion/jda/api/entities/PrivateChannel.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/RichPresence.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Role.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/SelfUser.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/TeamMember.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/TextChannel.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/User.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/VoiceChannel.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/Webhook.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/WebhookType.java | 2 +- src/main/java/net/dv8tion/jda/api/entities/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/events/DisconnectEvent.java | 2 +- src/main/java/net/dv8tion/jda/api/events/Event.java | 2 +- src/main/java/net/dv8tion/jda/api/events/ExceptionEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/GatewayPingEvent.java | 2 +- src/main/java/net/dv8tion/jda/api/events/GenericEvent.java | 2 +- src/main/java/net/dv8tion/jda/api/events/RawGatewayEvent.java | 2 +- src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/ReconnectedEvent.java | 2 +- src/main/java/net/dv8tion/jda/api/events/ResumedEvent.java | 2 +- src/main/java/net/dv8tion/jda/api/events/ShutdownEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/StatusChangeEvent.java | 2 +- src/main/java/net/dv8tion/jda/api/events/UpdateEvent.java | 2 +- .../jda/api/events/channel/category/CategoryCreateEvent.java | 2 +- .../jda/api/events/channel/category/CategoryDeleteEvent.java | 2 +- .../jda/api/events/channel/category/GenericCategoryEvent.java | 2 +- .../dv8tion/jda/api/events/channel/category/package-info.java | 2 +- .../channel/category/update/CategoryUpdateNameEvent.java | 2 +- .../category/update/CategoryUpdatePermissionsEvent.java | 2 +- .../channel/category/update/CategoryUpdatePositionEvent.java | 2 +- .../channel/category/update/GenericCategoryUpdateEvent.java | 2 +- .../jda/api/events/channel/category/update/package-info.java | 2 +- .../java/net/dv8tion/jda/api/events/channel/package-info.java | 2 +- .../api/events/channel/priv/PrivateChannelCreateEvent.java | 2 +- .../api/events/channel/priv/PrivateChannelDeleteEvent.java | 2 +- .../net/dv8tion/jda/api/events/channel/priv/package-info.java | 2 +- .../api/events/channel/store/GenericStoreChannelEvent.java | 2 +- .../jda/api/events/channel/store/StoreChannelCreateEvent.java | 2 +- .../jda/api/events/channel/store/StoreChannelDeleteEvent.java | 2 +- .../channel/store/update/GenericStoreChannelUpdateEvent.java | 2 +- .../channel/store/update/StoreChannelUpdateNameEvent.java | 2 +- .../store/update/StoreChannelUpdatePermissionsEvent.java | 2 +- .../channel/store/update/StoreChannelUpdatePositionEvent.java | 2 +- .../jda/api/events/channel/text/GenericTextChannelEvent.java | 2 +- .../jda/api/events/channel/text/TextChannelCreateEvent.java | 2 +- .../jda/api/events/channel/text/TextChannelDeleteEvent.java | 2 +- .../net/dv8tion/jda/api/events/channel/text/package-info.java | 2 +- .../channel/text/update/GenericTextChannelUpdateEvent.java | 2 +- .../channel/text/update/TextChannelUpdateNSFWEvent.java | 2 +- .../channel/text/update/TextChannelUpdateNameEvent.java | 2 +- .../channel/text/update/TextChannelUpdateNewsEvent.java | 2 +- .../channel/text/update/TextChannelUpdateParentEvent.java | 2 +- .../text/update/TextChannelUpdatePermissionsEvent.java | 2 +- .../channel/text/update/TextChannelUpdatePositionEvent.java | 2 +- .../channel/text/update/TextChannelUpdateSlowmodeEvent.java | 2 +- .../channel/text/update/TextChannelUpdateTopicEvent.java | 2 +- .../jda/api/events/channel/text/update/package-info.java | 2 +- .../api/events/channel/voice/GenericVoiceChannelEvent.java | 2 +- .../jda/api/events/channel/voice/VoiceChannelCreateEvent.java | 2 +- .../jda/api/events/channel/voice/VoiceChannelDeleteEvent.java | 2 +- .../dv8tion/jda/api/events/channel/voice/package-info.java | 2 +- .../channel/voice/update/GenericVoiceChannelUpdateEvent.java | 2 +- .../channel/voice/update/VoiceChannelUpdateBitrateEvent.java | 2 +- .../channel/voice/update/VoiceChannelUpdateNameEvent.java | 2 +- .../channel/voice/update/VoiceChannelUpdateParentEvent.java | 2 +- .../voice/update/VoiceChannelUpdatePermissionsEvent.java | 2 +- .../channel/voice/update/VoiceChannelUpdatePositionEvent.java | 2 +- .../voice/update/VoiceChannelUpdateUserLimitEvent.java | 2 +- .../jda/api/events/channel/voice/update/package-info.java | 2 +- .../net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java | 2 +- .../net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java | 2 +- .../net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/emote/package-info.java | 2 +- .../jda/api/events/emote/update/EmoteUpdateNameEvent.java | 2 +- .../jda/api/events/emote/update/EmoteUpdateRolesEvent.java | 2 +- .../jda/api/events/emote/update/GenericEmoteUpdateEvent.java | 2 +- .../net/dv8tion/jda/api/events/emote/update/package-info.java | 2 +- .../net/dv8tion/jda/api/events/guild/GenericGuildEvent.java | 2 +- .../net/dv8tion/jda/api/events/guild/GuildAvailableEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java | 2 +- .../net/dv8tion/jda/api/events/guild/GuildLeaveEvent.java | 2 +- .../net/dv8tion/jda/api/events/guild/GuildReadyEvent.java | 2 +- .../dv8tion/jda/api/events/guild/GuildUnavailableEvent.java | 2 +- .../net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java | 2 +- .../jda/api/events/guild/UnavailableGuildJoinedEvent.java | 2 +- .../jda/api/events/guild/UnavailableGuildLeaveEvent.java | 2 +- .../jda/api/events/guild/invite/GenericGuildInviteEvent.java | 2 +- .../jda/api/events/guild/invite/GuildInviteCreateEvent.java | 2 +- .../jda/api/events/guild/invite/GuildInviteDeleteEvent.java | 2 +- .../jda/api/events/guild/member/GenericGuildMemberEvent.java | 2 +- .../jda/api/events/guild/member/GuildMemberJoinEvent.java | 2 +- .../jda/api/events/guild/member/GuildMemberLeaveEvent.java | 2 +- .../jda/api/events/guild/member/GuildMemberRemoveEvent.java | 2 +- .../jda/api/events/guild/member/GuildMemberRoleAddEvent.java | 2 +- .../api/events/guild/member/GuildMemberRoleRemoveEvent.java | 2 +- .../jda/api/events/guild/member/GuildMemberUpdateEvent.java | 2 +- .../net/dv8tion/jda/api/events/guild/member/package-info.java | 2 +- .../guild/member/update/GenericGuildMemberUpdateEvent.java | 2 +- .../guild/member/update/GuildMemberUpdateBoostTimeEvent.java | 2 +- .../guild/member/update/GuildMemberUpdateNicknameEvent.java | 2 +- .../events/guild/override/GenericPermissionOverrideEvent.java | 2 +- .../events/guild/override/PermissionOverrideCreateEvent.java | 2 +- .../events/guild/override/PermissionOverrideDeleteEvent.java | 2 +- .../events/guild/override/PermissionOverrideUpdateEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/guild/package-info.java | 2 +- .../jda/api/events/guild/update/GenericGuildUpdateEvent.java | 2 +- .../api/events/guild/update/GuildUpdateAfkChannelEvent.java | 2 +- .../api/events/guild/update/GuildUpdateAfkTimeoutEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateBannerEvent.java | 2 +- .../api/events/guild/update/GuildUpdateBoostCountEvent.java | 2 +- .../api/events/guild/update/GuildUpdateBoostTierEvent.java | 2 +- .../api/events/guild/update/GuildUpdateDescriptionEvent.java | 2 +- .../guild/update/GuildUpdateExplicitContentLevelEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateFeaturesEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateIconEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateLocaleEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateMFALevelEvent.java | 2 +- .../api/events/guild/update/GuildUpdateMaxMembersEvent.java | 2 +- .../api/events/guild/update/GuildUpdateMaxPresencesEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateNameEvent.java | 2 +- .../guild/update/GuildUpdateNotificationLevelEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateOwnerEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateRegionEvent.java | 2 +- .../jda/api/events/guild/update/GuildUpdateSplashEvent.java | 2 +- .../events/guild/update/GuildUpdateSystemChannelEvent.java | 2 +- .../api/events/guild/update/GuildUpdateVanityCodeEvent.java | 2 +- .../guild/update/GuildUpdateVerificationLevelEvent.java | 2 +- .../net/dv8tion/jda/api/events/guild/update/package-info.java | 2 +- .../jda/api/events/guild/voice/GenericGuildVoiceEvent.java | 2 +- .../api/events/guild/voice/GenericGuildVoiceUpdateEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceDeafenEvent.java | 2 +- .../api/events/guild/voice/GuildVoiceGuildDeafenEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceJoinEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceLeaveEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceMoveEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceMuteEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceStreamEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceSuppressEvent.java | 2 +- .../jda/api/events/guild/voice/GuildVoiceUpdateEvent.java | 2 +- .../net/dv8tion/jda/api/events/guild/voice/package-info.java | 2 +- .../net/dv8tion/jda/api/events/http/HttpRequestEvent.java | 2 +- .../dv8tion/jda/api/events/message/GenericMessageEvent.java | 2 +- .../jda/api/events/message/MessageBulkDeleteEvent.java | 2 +- .../dv8tion/jda/api/events/message/MessageDeleteEvent.java | 2 +- .../net/dv8tion/jda/api/events/message/MessageEmbedEvent.java | 2 +- .../dv8tion/jda/api/events/message/MessageReceivedEvent.java | 2 +- .../dv8tion/jda/api/events/message/MessageUpdateEvent.java | 2 +- .../api/events/message/guild/GenericGuildMessageEvent.java | 2 +- .../jda/api/events/message/guild/GuildMessageDeleteEvent.java | 2 +- .../jda/api/events/message/guild/GuildMessageEmbedEvent.java | 2 +- .../api/events/message/guild/GuildMessageReceivedEvent.java | 2 +- .../jda/api/events/message/guild/GuildMessageUpdateEvent.java | 2 +- .../dv8tion/jda/api/events/message/guild/package-info.java | 2 +- .../message/guild/react/GenericGuildMessageReactionEvent.java | 2 +- .../message/guild/react/GuildMessageReactionAddEvent.java | 2 +- .../guild/react/GuildMessageReactionRemoveAllEvent.java | 2 +- .../guild/react/GuildMessageReactionRemoveEmoteEvent.java | 2 +- .../message/guild/react/GuildMessageReactionRemoveEvent.java | 2 +- .../jda/api/events/message/guild/react/package-info.java | 2 +- .../java/net/dv8tion/jda/api/events/message/package-info.java | 2 +- .../api/events/message/priv/GenericPrivateMessageEvent.java | 2 +- .../api/events/message/priv/PrivateMessageDeleteEvent.java | 2 +- .../jda/api/events/message/priv/PrivateMessageEmbedEvent.java | 2 +- .../api/events/message/priv/PrivateMessageReceivedEvent.java | 2 +- .../api/events/message/priv/PrivateMessageUpdateEvent.java | 2 +- .../net/dv8tion/jda/api/events/message/priv/package-info.java | 2 +- .../priv/react/GenericPrivateMessageReactionEvent.java | 2 +- .../message/priv/react/PrivateMessageReactionAddEvent.java | 2 +- .../message/priv/react/PrivateMessageReactionRemoveEvent.java | 2 +- .../jda/api/events/message/priv/react/package-info.java | 2 +- .../api/events/message/react/GenericMessageReactionEvent.java | 2 +- .../jda/api/events/message/react/MessageReactionAddEvent.java | 2 +- .../events/message/react/MessageReactionRemoveAllEvent.java | 2 +- .../events/message/react/MessageReactionRemoveEmoteEvent.java | 2 +- .../api/events/message/react/MessageReactionRemoveEvent.java | 2 +- .../dv8tion/jda/api/events/message/react/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/events/package-info.java | 2 +- .../net/dv8tion/jda/api/events/role/GenericRoleEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/role/RoleCreateEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/role/RoleDeleteEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/role/package-info.java | 2 +- .../jda/api/events/role/update/GenericRoleUpdateEvent.java | 2 +- .../jda/api/events/role/update/RoleUpdateColorEvent.java | 4 ++-- .../jda/api/events/role/update/RoleUpdateHoistedEvent.java | 2 +- .../api/events/role/update/RoleUpdateMentionableEvent.java | 2 +- .../jda/api/events/role/update/RoleUpdateNameEvent.java | 2 +- .../api/events/role/update/RoleUpdatePermissionsEvent.java | 2 +- .../jda/api/events/role/update/RoleUpdatePositionEvent.java | 2 +- .../net/dv8tion/jda/api/events/role/update/package-info.java | 2 +- .../dv8tion/jda/api/events/self/GenericSelfUpdateEvent.java | 2 +- .../dv8tion/jda/api/events/self/SelfUpdateAvatarEvent.java | 2 +- .../jda/api/events/self/SelfUpdateDiscriminatorEvent.java | 2 +- .../net/dv8tion/jda/api/events/self/SelfUpdateEmailEvent.java | 2 +- .../net/dv8tion/jda/api/events/self/SelfUpdateMFAEvent.java | 2 +- .../dv8tion/jda/api/events/self/SelfUpdateMobileEvent.java | 2 +- .../net/dv8tion/jda/api/events/self/SelfUpdateNameEvent.java | 2 +- .../net/dv8tion/jda/api/events/self/SelfUpdateNitroEvent.java | 2 +- .../jda/api/events/self/SelfUpdatePhoneNumberEvent.java | 2 +- .../dv8tion/jda/api/events/self/SelfUpdateVerifiedEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/self/package-info.java | 2 +- .../net/dv8tion/jda/api/events/user/GenericUserEvent.java | 2 +- .../net/dv8tion/jda/api/events/user/UserActivityEndEvent.java | 2 +- .../dv8tion/jda/api/events/user/UserActivityStartEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/user/UserTypingEvent.java | 2 +- .../java/net/dv8tion/jda/api/events/user/package-info.java | 2 +- .../jda/api/events/user/update/GenericUserPresenceEvent.java | 2 +- .../jda/api/events/user/update/GenericUserUpdateEvent.java | 2 +- .../api/events/user/update/UserUpdateActivityOrderEvent.java | 2 +- .../jda/api/events/user/update/UserUpdateAvatarEvent.java | 2 +- .../api/events/user/update/UserUpdateDiscriminatorEvent.java | 2 +- .../jda/api/events/user/update/UserUpdateFlagsEvent.java | 3 +-- .../jda/api/events/user/update/UserUpdateNameEvent.java | 2 +- .../api/events/user/update/UserUpdateOnlineStatusEvent.java | 2 +- .../net/dv8tion/jda/api/exceptions/AccountTypeException.java | 2 +- .../java/net/dv8tion/jda/api/exceptions/ContextException.java | 2 +- .../java/net/dv8tion/jda/api/exceptions/ErrorHandler.java | 2 +- .../dv8tion/jda/api/exceptions/ErrorResponseException.java | 2 +- .../dv8tion/jda/api/exceptions/GuildUnavailableException.java | 2 +- .../net/dv8tion/jda/api/exceptions/HierarchyException.java | 2 +- .../java/net/dv8tion/jda/api/exceptions/HttpException.java | 2 +- .../jda/api/exceptions/InsufficientPermissionException.java | 2 +- .../dv8tion/jda/api/exceptions/MissingAccessException.java | 2 +- .../java/net/dv8tion/jda/api/exceptions/ParsingException.java | 2 +- .../net/dv8tion/jda/api/exceptions/PermissionException.java | 2 +- .../net/dv8tion/jda/api/exceptions/RateLimitedException.java | 2 +- .../jda/api/exceptions/VerificationLevelException.java | 2 +- .../java/net/dv8tion/jda/api/exceptions/package-info.java | 2 +- .../java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java | 2 +- src/main/java/net/dv8tion/jda/api/hooks/EventListener.java | 2 +- src/main/java/net/dv8tion/jda/api/hooks/IEventManager.java | 2 +- .../net/dv8tion/jda/api/hooks/InterfacedEventManager.java | 2 +- src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java | 2 +- src/main/java/net/dv8tion/jda/api/hooks/SubscribeEvent.java | 2 +- .../net/dv8tion/jda/api/hooks/VoiceDispatchInterceptor.java | 2 +- src/main/java/net/dv8tion/jda/api/hooks/package-info.java | 2 +- .../java/net/dv8tion/jda/api/managers/AccountManager.java | 2 +- src/main/java/net/dv8tion/jda/api/managers/AudioManager.java | 2 +- .../java/net/dv8tion/jda/api/managers/ChannelManager.java | 2 +- .../net/dv8tion/jda/api/managers/DirectAudioController.java | 2 +- src/main/java/net/dv8tion/jda/api/managers/EmoteManager.java | 2 +- src/main/java/net/dv8tion/jda/api/managers/GuildManager.java | 2 +- src/main/java/net/dv8tion/jda/api/managers/Manager.java | 2 +- .../net/dv8tion/jda/api/managers/PermOverrideManager.java | 2 +- src/main/java/net/dv8tion/jda/api/managers/Presence.java | 2 +- src/main/java/net/dv8tion/jda/api/managers/RoleManager.java | 4 ++-- .../java/net/dv8tion/jda/api/managers/WebhookManager.java | 2 +- src/main/java/net/dv8tion/jda/api/managers/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/CloseCode.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/Request.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/Response.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/RestAction.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/RestFuture.java | 2 +- src/main/java/net/dv8tion/jda/api/requests/package-info.java | 2 +- .../jda/api/requests/restaction/AuditableRestAction.java | 2 +- .../dv8tion/jda/api/requests/restaction/ChannelAction.java | 2 +- .../net/dv8tion/jda/api/requests/restaction/GuildAction.java | 2 +- .../net/dv8tion/jda/api/requests/restaction/InviteAction.java | 2 +- .../net/dv8tion/jda/api/requests/restaction/MemberAction.java | 2 +- .../dv8tion/jda/api/requests/restaction/MessageAction.java | 2 +- .../jda/api/requests/restaction/PermissionOverrideAction.java | 2 +- .../net/dv8tion/jda/api/requests/restaction/RoleAction.java | 2 +- .../dv8tion/jda/api/requests/restaction/WebhookAction.java | 2 +- .../api/requests/restaction/order/CategoryOrderAction.java | 2 +- .../jda/api/requests/restaction/order/ChannelOrderAction.java | 2 +- .../jda/api/requests/restaction/order/OrderAction.java | 2 +- .../jda/api/requests/restaction/order/RoleOrderAction.java | 2 +- .../jda/api/requests/restaction/order/package-info.java | 2 +- .../net/dv8tion/jda/api/requests/restaction/package-info.java | 2 +- .../restaction/pagination/AuditLogPaginationAction.java | 2 +- .../restaction/pagination/MessagePaginationAction.java | 2 +- .../api/requests/restaction/pagination/PaginationAction.java | 2 +- .../restaction/pagination/ReactionPaginationAction.java | 2 +- .../jda/api/requests/restaction/pagination/package-info.java | 2 +- .../net/dv8tion/jda/api/sharding/DefaultShardManager.java | 2 +- .../dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java | 2 +- src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java | 2 +- .../java/net/dv8tion/jda/api/sharding/ThreadPoolProvider.java | 2 +- src/main/java/net/dv8tion/jda/api/sharding/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/AttachmentOption.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/ClosableIterator.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/Compression.java | 2 +- .../dv8tion/jda/api/utils/ConcurrentSessionController.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/IOBiConsumer.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/IOConsumer.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/IOFunction.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/LockIterator.java | 2 +- .../java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/MarkdownUtil.java | 2 +- .../java/net/dv8tion/jda/api/utils/MemberCachePolicy.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/Procedure.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/Result.java | 2 +- .../java/net/dv8tion/jda/api/utils/SessionController.java | 2 +- .../net/dv8tion/jda/api/utils/SessionControllerAdapter.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/TimeUtil.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/WidgetUtil.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/cache/CacheView.java | 2 +- .../java/net/dv8tion/jda/api/utils/cache/MemberCacheView.java | 2 +- .../java/net/dv8tion/jda/api/utils/cache/ShardCacheView.java | 2 +- .../net/dv8tion/jda/api/utils/cache/SnowflakeCacheView.java | 2 +- .../dv8tion/jda/api/utils/cache/SortedSnowflakeCacheView.java | 2 +- .../dv8tion/jda/api/utils/cache/UnifiedMemberCacheView.java | 2 +- .../java/net/dv8tion/jda/api/utils/cache/package-info.java | 2 +- .../jda/api/utils/concurrent/DelayedCompletableFuture.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/concurrent/Task.java | 2 +- .../net/dv8tion/jda/api/utils/concurrent/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/data/DataType.java | 2 +- .../java/net/dv8tion/jda/api/utils/data/SerializableData.java | 2 +- .../net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java | 2 +- .../net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java | 2 +- .../java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java | 2 +- .../java/net/dv8tion/jda/api/utils/data/etf/package-info.java | 2 +- .../java/net/dv8tion/jda/api/utils/data/package-info.java | 2 +- src/main/java/net/dv8tion/jda/api/utils/package-info.java | 2 +- src/main/java/net/dv8tion/jda/internal/JDAImpl.java | 2 +- .../java/net/dv8tion/jda/internal/audio/AudioConnection.java | 2 +- .../java/net/dv8tion/jda/internal/audio/AudioEncryption.java | 2 +- src/main/java/net/dv8tion/jda/internal/audio/AudioPacket.java | 2 +- .../java/net/dv8tion/jda/internal/audio/AudioWebSocket.java | 2 +- .../net/dv8tion/jda/internal/audio/ConnectionRequest.java | 2 +- .../java/net/dv8tion/jda/internal/audio/ConnectionStage.java | 2 +- src/main/java/net/dv8tion/jda/internal/audio/Decoder.java | 2 +- src/main/java/net/dv8tion/jda/internal/audio/VoiceCode.java | 2 +- .../dv8tion/jda/internal/entities/AbstractChannelImpl.java | 2 +- .../net/dv8tion/jda/internal/entities/AbstractMessage.java | 2 +- .../java/net/dv8tion/jda/internal/entities/ActivityImpl.java | 2 +- .../dv8tion/jda/internal/entities/ApplicationInfoImpl.java | 2 +- .../dv8tion/jda/internal/entities/ApplicationTeamImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/CategoryImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/DataMessage.java | 2 +- .../java/net/dv8tion/jda/internal/entities/EmoteImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/EntityBuilder.java | 2 +- .../java/net/dv8tion/jda/internal/entities/GuildImpl.java | 2 +- .../dv8tion/jda/internal/entities/GuildVoiceStateImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/InviteImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/MemberImpl.java | 2 +- .../dv8tion/jda/internal/entities/PermissionOverrideImpl.java | 2 +- .../net/dv8tion/jda/internal/entities/PrivateChannelImpl.java | 2 +- .../net/dv8tion/jda/internal/entities/ReceivedMessage.java | 2 +- .../net/dv8tion/jda/internal/entities/RichPresenceImpl.java | 2 +- src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/SelfUserImpl.java | 2 +- .../net/dv8tion/jda/internal/entities/StoreChannelImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/SystemMessage.java | 2 +- .../net/dv8tion/jda/internal/entities/TeamMemberImpl.java | 2 +- .../net/dv8tion/jda/internal/entities/TextChannelImpl.java | 2 +- src/main/java/net/dv8tion/jda/internal/entities/UserById.java | 2 +- src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java | 2 +- .../net/dv8tion/jda/internal/entities/VoiceChannelImpl.java | 2 +- .../java/net/dv8tion/jda/internal/entities/WebhookImpl.java | 2 +- .../net/dv8tion/jda/internal/handle/ChannelCreateHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java | 2 +- src/main/java/net/dv8tion/jda/internal/handle/EventCache.java | 2 +- .../java/net/dv8tion/jda/internal/handle/GuildBanHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/GuildCreateHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/GuildDeleteHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildEmojisUpdateHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildMemberAddHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildMembersChunkHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildRoleCreateHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildRoleDeleteHandler.java | 2 +- .../dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/GuildSetupController.java | 2 +- .../java/net/dv8tion/jda/internal/handle/GuildSetupNode.java | 2 +- .../net/dv8tion/jda/internal/handle/GuildSyncHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/GuildUpdateHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/InviteCreateHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/InviteDeleteHandler.java | 2 +- .../dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/MessageCreateHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/MessageDeleteHandler.java | 2 +- .../jda/internal/handle/MessageReactionBulkRemoveHandler.java | 2 +- .../jda/internal/handle/MessageReactionClearEmoteHandler.java | 2 +- .../dv8tion/jda/internal/handle/MessageReactionHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/MessageUpdateHandler.java | 2 +- .../dv8tion/jda/internal/handle/PresenceUpdateHandler.java | 2 +- .../java/net/dv8tion/jda/internal/handle/ReadyHandler.java | 2 +- .../java/net/dv8tion/jda/internal/handle/SocketHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/TypingStartHandler.java | 2 +- .../net/dv8tion/jda/internal/handle/UserUpdateHandler.java | 2 +- .../dv8tion/jda/internal/handle/VoiceServerUpdateHandler.java | 2 +- .../dv8tion/jda/internal/handle/VoiceStateUpdateHandler.java | 2 +- .../net/dv8tion/jda/internal/hooks/EventManagerProxy.java | 2 +- .../net/dv8tion/jda/internal/managers/AccountManagerImpl.java | 2 +- .../net/dv8tion/jda/internal/managers/AudioManagerImpl.java | 2 +- .../net/dv8tion/jda/internal/managers/ChannelManagerImpl.java | 2 +- .../jda/internal/managers/DirectAudioControllerImpl.java | 2 +- .../net/dv8tion/jda/internal/managers/EmoteManagerImpl.java | 2 +- .../net/dv8tion/jda/internal/managers/GuildManagerImpl.java | 2 +- .../java/net/dv8tion/jda/internal/managers/ManagerBase.java | 2 +- .../jda/internal/managers/PermOverrideManagerImpl.java | 2 +- .../java/net/dv8tion/jda/internal/managers/PresenceImpl.java | 2 +- .../net/dv8tion/jda/internal/managers/RoleManagerImpl.java | 2 +- .../net/dv8tion/jda/internal/managers/WebhookManagerImpl.java | 2 +- .../net/dv8tion/jda/internal/requests/CallbackContext.java | 2 +- .../dv8tion/jda/internal/requests/CompletedRestAction.java | 2 +- .../net/dv8tion/jda/internal/requests/DeferredRestAction.java | 2 +- .../net/dv8tion/jda/internal/requests/FunctionalCallback.java | 2 +- .../net/dv8tion/jda/internal/requests/MemberChunkManager.java | 2 +- src/main/java/net/dv8tion/jda/internal/requests/Method.java | 2 +- .../java/net/dv8tion/jda/internal/requests/RateLimiter.java | 2 +- .../java/net/dv8tion/jda/internal/requests/Requester.java | 2 +- .../net/dv8tion/jda/internal/requests/RestActionImpl.java | 2 +- src/main/java/net/dv8tion/jda/internal/requests/Route.java | 2 +- .../net/dv8tion/jda/internal/requests/WebSocketClient.java | 2 +- .../java/net/dv8tion/jda/internal/requests/WebSocketCode.java | 2 +- .../dv8tion/jda/internal/requests/WebSocketSendingThread.java | 2 +- .../jda/internal/requests/ratelimit/BotRateLimiter.java | 2 +- .../net/dv8tion/jda/internal/requests/ratelimit/IBucket.java | 2 +- .../dv8tion/jda/internal/requests/ratelimit/package-info.java | 2 +- .../internal/requests/restaction/AuditableRestActionImpl.java | 2 +- .../jda/internal/requests/restaction/ChannelActionImpl.java | 2 +- .../jda/internal/requests/restaction/GuildActionImpl.java | 2 +- .../jda/internal/requests/restaction/InviteActionImpl.java | 2 +- .../jda/internal/requests/restaction/MemberActionImpl.java | 2 +- .../jda/internal/requests/restaction/MessageActionImpl.java | 2 +- .../jda/internal/requests/restaction/PermOverrideData.java | 2 +- .../requests/restaction/PermissionOverrideActionImpl.java | 2 +- .../jda/internal/requests/restaction/RoleActionImpl.java | 2 +- .../jda/internal/requests/restaction/WebhookActionImpl.java | 2 +- .../requests/restaction/operator/CombineRestAction.java | 2 +- .../requests/restaction/operator/DelayRestAction.java | 2 +- .../requests/restaction/operator/FlatMapErrorRestAction.java | 2 +- .../requests/restaction/operator/FlatMapRestAction.java | 2 +- .../requests/restaction/operator/MapErrorRestAction.java | 2 +- .../internal/requests/restaction/operator/MapRestAction.java | 2 +- .../requests/restaction/operator/RestActionOperator.java | 2 +- .../requests/restaction/order/CategoryOrderActionImpl.java | 2 +- .../requests/restaction/order/ChannelOrderActionImpl.java | 2 +- .../internal/requests/restaction/order/OrderActionImpl.java | 2 +- .../requests/restaction/order/RoleOrderActionImpl.java | 2 +- .../restaction/pagination/AuditLogPaginationActionImpl.java | 2 +- .../restaction/pagination/MessagePaginationActionImpl.java | 2 +- .../requests/restaction/pagination/PaginationActionImpl.java | 2 +- .../restaction/pagination/ReactionPaginationActionImpl.java | 2 +- .../net/dv8tion/jda/internal/utils/BufferedRequestBody.java | 2 +- .../java/net/dv8tion/jda/internal/utils/CacheConsumer.java | 2 +- .../dv8tion/jda/internal/utils/ChainedClosableIterator.java | 2 +- src/main/java/net/dv8tion/jda/internal/utils/Checks.java | 2 +- src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java | 2 +- .../java/net/dv8tion/jda/internal/utils/ContextRunnable.java | 2 +- .../java/net/dv8tion/jda/internal/utils/EncodingUtil.java | 2 +- src/main/java/net/dv8tion/jda/internal/utils/Helpers.java | 2 +- src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java | 2 +- src/main/java/net/dv8tion/jda/internal/utils/JDALogger.java | 2 +- .../java/net/dv8tion/jda/internal/utils/PermissionUtil.java | 2 +- .../java/net/dv8tion/jda/internal/utils/SimpleLogger.java | 2 +- src/main/java/net/dv8tion/jda/internal/utils/UnlockHook.java | 2 +- .../dv8tion/jda/internal/utils/cache/AbstractCacheView.java | 2 +- .../dv8tion/jda/internal/utils/cache/MemberCacheViewImpl.java | 2 +- .../dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java | 2 +- .../dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java | 2 +- .../jda/internal/utils/cache/SnowflakeCacheViewImpl.java | 2 +- .../dv8tion/jda/internal/utils/cache/SnowflakeReference.java | 2 +- .../internal/utils/cache/SortedSnowflakeCacheViewImpl.java | 2 +- .../jda/internal/utils/cache/UnifiedCacheViewImpl.java | 2 +- .../net/dv8tion/jda/internal/utils/compress/Decompressor.java | 2 +- .../dv8tion/jda/internal/utils/compress/ZlibDecompressor.java | 2 +- .../jda/internal/utils/concurrent/CountingThreadFactory.java | 2 +- .../jda/internal/utils/concurrent/task/GatewayTask.java | 3 +-- .../jda/internal/utils/config/AuthorizationConfig.java | 2 +- .../net/dv8tion/jda/internal/utils/config/MetaConfig.java | 2 +- .../net/dv8tion/jda/internal/utils/config/SessionConfig.java | 2 +- .../dv8tion/jda/internal/utils/config/ThreadingConfig.java | 2 +- .../dv8tion/jda/internal/utils/config/flags/ConfigFlag.java | 2 +- .../jda/internal/utils/config/flags/ShardingConfigFlag.java | 2 +- .../jda/internal/utils/config/sharding/EventConfig.java | 2 +- .../utils/config/sharding/PresenceProviderConfig.java | 2 +- .../jda/internal/utils/config/sharding/ShardingConfig.java | 2 +- .../internal/utils/config/sharding/ShardingMetaConfig.java | 2 +- .../internal/utils/config/sharding/ShardingSessionConfig.java | 2 +- .../utils/config/sharding/ThreadingProviderConfig.java | 2 +- .../net/dv8tion/jda/internal/utils/tuple/ImmutablePair.java | 2 +- .../net/dv8tion/jda/internal/utils/tuple/MutablePair.java | 2 +- .../net/dv8tion/jda/internal/utils/tuple/MutableTriple.java | 2 +- src/main/java/net/dv8tion/jda/internal/utils/tuple/Pair.java | 2 +- .../net/dv8tion/jda/internal/utils/tuple/package-info.java | 2 +- src/main/java/net/dv8tion/jda/package-info.java | 2 +- src/test/java/HelpersTest.java | 2 +- src/test/java/JsonTest.java | 2 +- src/test/java/MarkdownTest.java | 2 +- src/test/java/MarkdownUtilTest.java | 2 +- 571 files changed, 573 insertions(+), 575 deletions(-) diff --git a/LICENSE b/LICENSE index 1e8fc69685..8932594ccd 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle.kts b/build.gradle.kts index a34b0dbe39..ea7ca70c4c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/examples/java/AudioEchoExample.java b/src/examples/java/AudioEchoExample.java index d202bf9ce7..63bb95a3c5 100644 --- a/src/examples/java/AudioEchoExample.java +++ b/src/examples/java/AudioEchoExample.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/examples/java/LRUCachePolicy.java b/src/examples/java/LRUCachePolicy.java index e90bea65db..8a04779982 100644 --- a/src/examples/java/LRUCachePolicy.java +++ b/src/examples/java/LRUCachePolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/examples/java/MessageListenerExample.java b/src/examples/java/MessageListenerExample.java index 9921584658..af907aa5cf 100644 --- a/src/examples/java/MessageListenerExample.java +++ b/src/examples/java/MessageListenerExample.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/annotations/DeprecatedSince.java b/src/main/java/net/dv8tion/jda/annotations/DeprecatedSince.java index f97a566c6a..a1c5c83528 100644 --- a/src/main/java/net/dv8tion/jda/annotations/DeprecatedSince.java +++ b/src/main/java/net/dv8tion/jda/annotations/DeprecatedSince.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java b/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java index 89db186d94..87a38d3efc 100644 --- a/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java +++ b/src/main/java/net/dv8tion/jda/annotations/ForRemoval.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/annotations/Incubating.java b/src/main/java/net/dv8tion/jda/annotations/Incubating.java index 64a05ee243..e2531a76fe 100644 --- a/src/main/java/net/dv8tion/jda/annotations/Incubating.java +++ b/src/main/java/net/dv8tion/jda/annotations/Incubating.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/annotations/ReplaceWith.java b/src/main/java/net/dv8tion/jda/annotations/ReplaceWith.java index 9ccdd12ce7..f2af3432c6 100644 --- a/src/main/java/net/dv8tion/jda/annotations/ReplaceWith.java +++ b/src/main/java/net/dv8tion/jda/annotations/ReplaceWith.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/annotations/package-info.java b/src/main/java/net/dv8tion/jda/annotations/package-info.java index efc025b973..6c705e621a 100644 --- a/src/main/java/net/dv8tion/jda/annotations/package-info.java +++ b/src/main/java/net/dv8tion/jda/annotations/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/AccountType.java b/src/main/java/net/dv8tion/jda/api/AccountType.java index aae8512146..9cf719905b 100644 --- a/src/main/java/net/dv8tion/jda/api/AccountType.java +++ b/src/main/java/net/dv8tion/jda/api/AccountType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java b/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java index 2765e3d983..337da83f2a 100644 --- a/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/EmbedBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java b/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java index 86b30120f1..ec383a9e37 100644 --- a/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java +++ b/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/JDA.java b/src/main/java/net/dv8tion/jda/api/JDA.java index d44c6d3a25..a2abf44cb8 100644 --- a/src/main/java/net/dv8tion/jda/api/JDA.java +++ b/src/main/java/net/dv8tion/jda/api/JDA.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index 0188bc934b..14701ecc5b 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/JDAInfo.java b/src/main/java/net/dv8tion/jda/api/JDAInfo.java index e3faec48df..48a3e0b94e 100644 --- a/src/main/java/net/dv8tion/jda/api/JDAInfo.java +++ b/src/main/java/net/dv8tion/jda/api/JDAInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java index eb27b7e2db..caef2d0623 100644 --- a/src/main/java/net/dv8tion/jda/api/MessageBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/MessageBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/OnlineStatus.java b/src/main/java/net/dv8tion/jda/api/OnlineStatus.java index c966a0f927..c93b4e732e 100644 --- a/src/main/java/net/dv8tion/jda/api/OnlineStatus.java +++ b/src/main/java/net/dv8tion/jda/api/OnlineStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/Permission.java b/src/main/java/net/dv8tion/jda/api/Permission.java index 1b13d76bc2..334369afac 100644 --- a/src/main/java/net/dv8tion/jda/api/Permission.java +++ b/src/main/java/net/dv8tion/jda/api/Permission.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/Region.java b/src/main/java/net/dv8tion/jda/api/Region.java index 02d010afc2..7383cddd00 100644 --- a/src/main/java/net/dv8tion/jda/api/Region.java +++ b/src/main/java/net/dv8tion/jda/api/Region.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/AudioNatives.java b/src/main/java/net/dv8tion/jda/api/audio/AudioNatives.java index d09b03768c..a6e1cfb397 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/AudioNatives.java +++ b/src/main/java/net/dv8tion/jda/api/audio/AudioNatives.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/AudioReceiveHandler.java b/src/main/java/net/dv8tion/jda/api/audio/AudioReceiveHandler.java index 4a75ab5aa2..f4110b799c 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/AudioReceiveHandler.java +++ b/src/main/java/net/dv8tion/jda/api/audio/AudioReceiveHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/AudioSendHandler.java b/src/main/java/net/dv8tion/jda/api/audio/AudioSendHandler.java index c5c3dfed0c..37ba6df660 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/AudioSendHandler.java +++ b/src/main/java/net/dv8tion/jda/api/audio/AudioSendHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/CombinedAudio.java b/src/main/java/net/dv8tion/jda/api/audio/CombinedAudio.java index d9f4d85d00..4dcf9afb44 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/CombinedAudio.java +++ b/src/main/java/net/dv8tion/jda/api/audio/CombinedAudio.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/OpusPacket.java b/src/main/java/net/dv8tion/jda/api/audio/OpusPacket.java index 6c75b2ac1a..16bf5a52c8 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/OpusPacket.java +++ b/src/main/java/net/dv8tion/jda/api/audio/OpusPacket.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/SpeakingMode.java b/src/main/java/net/dv8tion/jda/api/audio/SpeakingMode.java index 3e2a0ee746..b8ca376016 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/SpeakingMode.java +++ b/src/main/java/net/dv8tion/jda/api/audio/SpeakingMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/UserAudio.java b/src/main/java/net/dv8tion/jda/api/audio/UserAudio.java index 99f86e1d25..f7cf0ea614 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/UserAudio.java +++ b/src/main/java/net/dv8tion/jda/api/audio/UserAudio.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendFactory.java b/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendFactory.java index a0f12fd8eb..e9ae9473ad 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendFactory.java +++ b/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendSystem.java b/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendSystem.java index 32f1e90f98..226ecbcf2d 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendSystem.java +++ b/src/main/java/net/dv8tion/jda/api/audio/factory/DefaultSendSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendFactory.java b/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendFactory.java index f215bb6ff3..6231ff8735 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendFactory.java +++ b/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendSystem.java b/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendSystem.java index a5a401def3..af9e03a2a7 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendSystem.java +++ b/src/main/java/net/dv8tion/jda/api/audio/factory/IAudioSendSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/factory/IPacketProvider.java b/src/main/java/net/dv8tion/jda/api/audio/factory/IPacketProvider.java index 34b68f6d8b..7b371d04bc 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/factory/IPacketProvider.java +++ b/src/main/java/net/dv8tion/jda/api/audio/factory/IPacketProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/factory/package-info.java b/src/main/java/net/dv8tion/jda/api/audio/factory/package-info.java index 06806ad2c8..b26145711a 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/factory/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/audio/factory/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 db0fb824d3..22cfcf11c3 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 @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionStatus.java b/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionStatus.java index 9028b6a567..65b28fcaa3 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionStatus.java +++ b/src/main/java/net/dv8tion/jda/api/audio/hooks/ConnectionStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/hooks/ListenerProxy.java b/src/main/java/net/dv8tion/jda/api/audio/hooks/ListenerProxy.java index af3ce44765..ee8528cbf1 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/hooks/ListenerProxy.java +++ b/src/main/java/net/dv8tion/jda/api/audio/hooks/ListenerProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/hooks/package-info.java b/src/main/java/net/dv8tion/jda/api/audio/hooks/package-info.java index 1a05fbb0d9..c9606a07a5 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/hooks/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/audio/hooks/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audio/package-info.java b/src/main/java/net/dv8tion/jda/api/audio/package-info.java index e4ce5e8bc7..6e7223b453 100644 --- a/src/main/java/net/dv8tion/jda/api/audio/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/audio/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/ActionType.java b/src/main/java/net/dv8tion/jda/api/audit/ActionType.java index ab29db9a55..08b64f27e3 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/ActionType.java +++ b/src/main/java/net/dv8tion/jda/api/audit/ActionType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/AuditLogChange.java b/src/main/java/net/dv8tion/jda/api/audit/AuditLogChange.java index e35e1df24e..343deef8d9 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/AuditLogChange.java +++ b/src/main/java/net/dv8tion/jda/api/audit/AuditLogChange.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/AuditLogEntry.java b/src/main/java/net/dv8tion/jda/api/audit/AuditLogEntry.java index 705eaaecd6..db0d3d1274 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/AuditLogEntry.java +++ b/src/main/java/net/dv8tion/jda/api/audit/AuditLogEntry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java b/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java index e6ea8b16c9..f96c3c74b7 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java +++ b/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java b/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java index 76a063712c..6bcfd0c53a 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java +++ b/src/main/java/net/dv8tion/jda/api/audit/AuditLogOption.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/TargetType.java b/src/main/java/net/dv8tion/jda/api/audit/TargetType.java index 39d3c5c37a..f0694ece72 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/TargetType.java +++ b/src/main/java/net/dv8tion/jda/api/audit/TargetType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/ThreadLocalReason.java b/src/main/java/net/dv8tion/jda/api/audit/ThreadLocalReason.java index d011490ba7..81c7d9b568 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/ThreadLocalReason.java +++ b/src/main/java/net/dv8tion/jda/api/audit/ThreadLocalReason.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/audit/package-info.java b/src/main/java/net/dv8tion/jda/api/audit/package-info.java index a65c5b0c48..808d5ec480 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/audit/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Activity.java b/src/main/java/net/dv8tion/jda/api/entities/Activity.java index 6999e16f37..0a8f45f88e 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Activity.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Activity.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/ActivityFlag.java b/src/main/java/net/dv8tion/jda/api/entities/ActivityFlag.java index 6c207265c8..143cc6be90 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ActivityFlag.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ActivityFlag.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java b/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java index ba3dda9f66..a7efbf4182 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ApplicationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/ApplicationTeam.java b/src/main/java/net/dv8tion/jda/api/entities/ApplicationTeam.java index 8019b802ed..5dc3c47da3 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ApplicationTeam.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ApplicationTeam.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Category.java b/src/main/java/net/dv8tion/jda/api/entities/Category.java index 116c34b868..8e95072e3d 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Category.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Category.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/ChannelType.java b/src/main/java/net/dv8tion/jda/api/entities/ChannelType.java index 89e2fc0df5..8c097dafe5 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ChannelType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ChannelType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/ClientType.java b/src/main/java/net/dv8tion/jda/api/entities/ClientType.java index f1d34c01a2..c07be5d40d 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ClientType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ClientType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/EmbedType.java b/src/main/java/net/dv8tion/jda/api/entities/EmbedType.java index 66a393c203..08f5a51388 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/EmbedType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/EmbedType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Emote.java b/src/main/java/net/dv8tion/jda/api/entities/Emote.java index 24748ec945..9eed3f9249 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Emote.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Emote.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 022f92d61a..985040cfe4 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java index 28ddee3a70..c33c496069 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java b/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java index b733c58ec3..069e37f2d4 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildVoiceState.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java b/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java index 24537c84e1..51ecc21203 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java +++ b/src/main/java/net/dv8tion/jda/api/entities/IFakeable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/IMentionable.java b/src/main/java/net/dv8tion/jda/api/entities/IMentionable.java index 1dff5e921e..78a001c41f 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/IMentionable.java +++ b/src/main/java/net/dv8tion/jda/api/entities/IMentionable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java b/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java index 5c4069701f..3a52ffa2f4 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java +++ b/src/main/java/net/dv8tion/jda/api/entities/IPermissionHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/ISnowflake.java b/src/main/java/net/dv8tion/jda/api/entities/ISnowflake.java index 295921fa9c..53c37403a5 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ISnowflake.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ISnowflake.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Icon.java b/src/main/java/net/dv8tion/jda/api/entities/Icon.java index ee6cb33d98..02dd20965f 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Icon.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Icon.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Invite.java b/src/main/java/net/dv8tion/jda/api/entities/Invite.java index 259d7fc246..291c1cd3a1 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Invite.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Invite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/ListedEmote.java b/src/main/java/net/dv8tion/jda/api/entities/ListedEmote.java index 1ce95a9109..b6cf465d0c 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/ListedEmote.java +++ b/src/main/java/net/dv8tion/jda/api/entities/ListedEmote.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 a1baf09a18..35765f4105 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Member.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Member.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 62121bfe45..8633efbe45 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageActivity.java b/src/main/java/net/dv8tion/jda/api/entities/MessageActivity.java index 3a04b4f971..cf47907352 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageActivity.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageActivity.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java index 4706ee2647..3678fa2c10 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 3f4bd5f195..dd99518598 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageEmbed.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java b/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java index fc71d479ab..b0b44d049d 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageHistory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageReaction.java b/src/main/java/net/dv8tion/jda/api/entities/MessageReaction.java index 6dbe919894..7762dff31a 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageReaction.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageReaction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageType.java b/src/main/java/net/dv8tion/jda/api/entities/MessageType.java index 6030574ddf..b05d605eb4 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java b/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java index bd055e85eb..be42dc7fd7 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java +++ b/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/PrivateChannel.java b/src/main/java/net/dv8tion/jda/api/entities/PrivateChannel.java index e4d7defa7b..c021d8cd1a 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/PrivateChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/PrivateChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/RichPresence.java b/src/main/java/net/dv8tion/jda/api/entities/RichPresence.java index fe2c89ba6f..def1af66c5 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/RichPresence.java +++ b/src/main/java/net/dv8tion/jda/api/entities/RichPresence.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Role.java b/src/main/java/net/dv8tion/jda/api/entities/Role.java index 33ea8c8d73..bddae941cb 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Role.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Role.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java b/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java index d0cfe467ff..25b2c45341 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java +++ b/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java b/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java index a9359a5ec7..9bcfb9da09 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/StoreChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java b/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java index cf040ba874..f0fdc38d5f 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java +++ b/src/main/java/net/dv8tion/jda/api/entities/TeamMember.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java index 8d12ad76f2..edb1df2ee7 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 3cfa885ffd..6104baf717 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/User.java +++ b/src/main/java/net/dv8tion/jda/api/entities/User.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/VoiceChannel.java b/src/main/java/net/dv8tion/jda/api/entities/VoiceChannel.java index 1c278dc585..4c785e7f43 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/VoiceChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/VoiceChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java index 0ff499ee97..4b8b6748b5 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/WebhookType.java b/src/main/java/net/dv8tion/jda/api/entities/WebhookType.java index 1f86afcd8b..092b87e104 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/WebhookType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/WebhookType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/entities/package-info.java b/src/main/java/net/dv8tion/jda/api/entities/package-info.java index 51bac155fa..ee8b21017a 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/entities/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/DisconnectEvent.java b/src/main/java/net/dv8tion/jda/api/events/DisconnectEvent.java index bd5c53ac53..80b9137a26 100644 --- a/src/main/java/net/dv8tion/jda/api/events/DisconnectEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/DisconnectEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/Event.java b/src/main/java/net/dv8tion/jda/api/events/Event.java index 0d476d9706..830da831c8 100644 --- a/src/main/java/net/dv8tion/jda/api/events/Event.java +++ b/src/main/java/net/dv8tion/jda/api/events/Event.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/ExceptionEvent.java b/src/main/java/net/dv8tion/jda/api/events/ExceptionEvent.java index c57fd9a9a1..403d37fc18 100644 --- a/src/main/java/net/dv8tion/jda/api/events/ExceptionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/ExceptionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/GatewayPingEvent.java b/src/main/java/net/dv8tion/jda/api/events/GatewayPingEvent.java index 99a6df4f08..2919cd8a5c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/GatewayPingEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/GatewayPingEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/GenericEvent.java b/src/main/java/net/dv8tion/jda/api/events/GenericEvent.java index 41949f96e7..9ccbdec127 100644 --- a/src/main/java/net/dv8tion/jda/api/events/GenericEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/GenericEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/RawGatewayEvent.java b/src/main/java/net/dv8tion/jda/api/events/RawGatewayEvent.java index cea02674ef..206d73c56d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/RawGatewayEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/RawGatewayEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java b/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java index 2514e07f2c..8e48ac6864 100644 --- a/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/ReconnectedEvent.java b/src/main/java/net/dv8tion/jda/api/events/ReconnectedEvent.java index aa91567953..8df1e5130d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/ReconnectedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/ReconnectedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/ResumedEvent.java b/src/main/java/net/dv8tion/jda/api/events/ResumedEvent.java index c5992693fe..151be2fd5c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/ResumedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/ResumedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/ShutdownEvent.java b/src/main/java/net/dv8tion/jda/api/events/ShutdownEvent.java index 04a4584839..01b4f4cdd0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/ShutdownEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/ShutdownEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/StatusChangeEvent.java b/src/main/java/net/dv8tion/jda/api/events/StatusChangeEvent.java index 48304ec934..b12c2b7c93 100644 --- a/src/main/java/net/dv8tion/jda/api/events/StatusChangeEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/StatusChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/UpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/UpdateEvent.java index 0bf515adcf..a29679a45d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/UpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/UpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryCreateEvent.java index f5bf037239..e3179a89fe 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryDeleteEvent.java index 5cd25f60aa..24bf1f7eb4 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/CategoryDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/GenericCategoryEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/GenericCategoryEvent.java index 8a94eebcbd..9fbf003611 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/GenericCategoryEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/GenericCategoryEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/package-info.java index 3da6809be9..418db8e7ee 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdateNameEvent.java index 7176e762e5..ed237e6c1d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePermissionsEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePermissionsEvent.java index a8de648537..776d72fa61 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePermissionsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePermissionsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePositionEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePositionEvent.java index b993dad457..cf15c3774d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePositionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/CategoryUpdatePositionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/GenericCategoryUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/GenericCategoryUpdateEvent.java index 4f7cb62265..7f6447495f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/GenericCategoryUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/GenericCategoryUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/package-info.java index 8ac5f8ff8e..ed1932aae5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/category/update/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/category/update/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/package-info.java index fbd4de93ac..2d983a9492 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelCreateEvent.java index 2100276fd9..a62d227b79 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelDeleteEvent.java index 679e96ddc1..8f081a12be 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/priv/PrivateChannelDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/priv/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/priv/package-info.java index f3a4c26c2c..01a657cec0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/priv/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/priv/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/store/GenericStoreChannelEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/store/GenericStoreChannelEvent.java index 37d0ac0fa5..3de6a900c4 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/store/GenericStoreChannelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/store/GenericStoreChannelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelCreateEvent.java index d0f416d719..633b25c9a1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelDeleteEvent.java index e7b58f6f79..3608c240b2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/store/StoreChannelDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/GenericStoreChannelUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/GenericStoreChannelUpdateEvent.java index eb6d227bcb..08b26ab9d5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/GenericStoreChannelUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/GenericStoreChannelUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdateNameEvent.java index e93b0c5078..0cde7a62b9 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePermissionsEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePermissionsEvent.java index e54181b74c..b9d1ce3a38 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePermissionsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePermissionsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePositionEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePositionEvent.java index d8de6b348a..505f433b3f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePositionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/store/update/StoreChannelUpdatePositionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/GenericTextChannelEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/GenericTextChannelEvent.java index 6effa4092f..4252e1e4d2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/GenericTextChannelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/GenericTextChannelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelCreateEvent.java index 259c9c1090..e8abb398f6 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelDeleteEvent.java index 476941cbcc..a1d6da5e2d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/TextChannelDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/package-info.java index 3fd606c0e3..901626aa93 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/GenericTextChannelUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/GenericTextChannelUpdateEvent.java index f186a1a5a9..142b8a1822 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/GenericTextChannelUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/GenericTextChannelUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNSFWEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNSFWEvent.java index 16332b514f..0ba66c60c7 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNSFWEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNSFWEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNameEvent.java index 4540aded23..2e086e9fd8 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java index 0eafb5915f..df8fba2155 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateParentEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateParentEvent.java index 29650a842d..f67b98f918 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateParentEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateParentEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePermissionsEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePermissionsEvent.java index 73d1c34055..701a0d07e1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePermissionsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePermissionsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePositionEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePositionEvent.java index 40da5db0c6..ed4b512714 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePositionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdatePositionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateSlowmodeEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateSlowmodeEvent.java index d0d09e3ae6..92b60948a6 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateSlowmodeEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateSlowmodeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateTopicEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateTopicEvent.java index 2170a3dd6d..f70d8cd5c4 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateTopicEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateTopicEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/package-info.java index 6b63f6c60e..227ed8a6db 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/GenericVoiceChannelEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/GenericVoiceChannelEvent.java index ecd8ed5f32..48be7bcfd8 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/GenericVoiceChannelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/GenericVoiceChannelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelCreateEvent.java index 5a0f05ce2c..5f2682fd47 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelDeleteEvent.java index d13272170e..6b34d998cd 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/VoiceChannelDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/package-info.java index ee720bea59..8514cc634b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/GenericVoiceChannelUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/GenericVoiceChannelUpdateEvent.java index 1373644c9b..5e680e93ec 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/GenericVoiceChannelUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/GenericVoiceChannelUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateBitrateEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateBitrateEvent.java index 698651ecf7..993da70eca 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateBitrateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateBitrateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateNameEvent.java index bb19f589b0..5829c96231 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateParentEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateParentEvent.java index d57348a362..7f1ed8c82a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateParentEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateParentEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePermissionsEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePermissionsEvent.java index dc0be2fcf8..dd658da400 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePermissionsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePermissionsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePositionEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePositionEvent.java index 700c2b398a..660e2a9b78 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePositionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdatePositionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateUserLimitEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateUserLimitEvent.java index e0b0eda874..42b282dd5c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateUserLimitEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/VoiceChannelUpdateUserLimitEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/package-info.java b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/package-info.java index d4978edb81..94772c122d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/voice/update/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java index 8602a707d4..fff752d95a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteAddedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java index afce2b8362..c918bc39fc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/EmoteRemovedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java index b5d4c10bcd..1952264787 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/GenericEmoteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java b/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java index 307d9543a7..7f9e3eb9b5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java index e2a5d2b560..84f3fccde1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java index 1fd17ec9f3..f8ec6c02d0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/EmoteUpdateRolesEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java index 36b43c734d..57fb7dac59 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/GenericEmoteUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java b/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java index 67bb11a37a..65362034c6 100644 --- a/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/emote/update/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GenericGuildEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GenericGuildEvent.java index 624ee43e76..9f19069182 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GenericGuildEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GenericGuildEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildAvailableEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildAvailableEvent.java index 1d29ce5738..18924fd833 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildAvailableEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildAvailableEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java index f43e10a555..adf7769b67 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildBanEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java index 40df1ea4a1..cc05e0ccb6 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildJoinEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildLeaveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildLeaveEvent.java index 43ae4b047d..ffffcced20 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildLeaveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildLeaveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java index e802843f7d..fbd594aff0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnavailableEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnavailableEvent.java index 70172eb2bd..79879948bb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnavailableEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnavailableEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java index f5c588c9f2..1a9862c126 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildUnbanEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java index 88e9c80dad..eb8703108d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildLeaveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildLeaveEvent.java index 3560807dd7..61d91a1169 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildLeaveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildLeaveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java index 5036d15c14..4db3af934e 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GenericGuildInviteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java index 84f0b36300..1ae1658c75 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java index 09f479a945..d3373cac25 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/invite/GuildInviteDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GenericGuildMemberEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GenericGuildMemberEvent.java index 396db031b5..10ce303ca8 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GenericGuildMemberEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GenericGuildMemberEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberJoinEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberJoinEvent.java index 624452f220..fdf4b99f04 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberJoinEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberJoinEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberLeaveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberLeaveEvent.java index 05a8e45eb6..4e8770dd5c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberLeaveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberLeaveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java index 30617891ba..8ea94e9b0c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRemoveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java index 841ee0d8ed..31bc1ae9c8 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleAddEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java index f88b84fbba..086ef5db96 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberRoleRemoveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java index c033375f9a..b57321c69c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/package-info.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/package-info.java index d085274133..90af1316e7 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java index ded2e170f3..48324c601e 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GenericGuildMemberUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java index 9f08a732b7..b00b15dca9 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateBoostTimeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java index 95ee076c14..25d745ef48 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdateNicknameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/override/GenericPermissionOverrideEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/override/GenericPermissionOverrideEvent.java index 70c4e7114f..2184a6c7ef 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/override/GenericPermissionOverrideEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/override/GenericPermissionOverrideEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideCreateEvent.java index b05aa63af2..26062b8fc9 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideDeleteEvent.java index 77b05493a0..ce695bd0fb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideUpdateEvent.java index 246d23c356..690993bfbc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/override/PermissionOverrideUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/package-info.java b/src/main/java/net/dv8tion/jda/api/events/guild/package-info.java index 3c7e6660bd..d9720bcbfa 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GenericGuildUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GenericGuildUpdateEvent.java index e3138aac82..9fae264ea0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GenericGuildUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GenericGuildUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkChannelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkChannelEvent.java index 22523597db..151ee27173 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkChannelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkChannelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkTimeoutEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkTimeoutEvent.java index 5cba0b201f..88ed98c785 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkTimeoutEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateAfkTimeoutEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBannerEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBannerEvent.java index f48663a162..5d2ba45d68 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBannerEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBannerEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostCountEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostCountEvent.java index 09df87fb0b..5f1df2ef52 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostCountEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostCountEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostTierEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostTierEvent.java index bb65abb1b0..1ba028c9a6 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostTierEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateBoostTierEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateDescriptionEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateDescriptionEvent.java index 37e64e45ae..c606651649 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateDescriptionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateDescriptionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateExplicitContentLevelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateExplicitContentLevelEvent.java index 58f43420cd..54a5db5371 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateExplicitContentLevelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateExplicitContentLevelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateFeaturesEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateFeaturesEvent.java index c5b44a692f..411980e057 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateFeaturesEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateFeaturesEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateIconEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateIconEvent.java index 135ea11ed9..55bb3ea474 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateIconEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateIconEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java index cff15c685f..a07e16adad 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMFALevelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMFALevelEvent.java index 746646cbc3..4961ecaf9d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMFALevelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMFALevelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxMembersEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxMembersEvent.java index 74bd3be5bc..c5dff6bcd7 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxMembersEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxMembersEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxPresencesEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxPresencesEvent.java index 2795c3acf7..d57c415fec 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxPresencesEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateMaxPresencesEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNameEvent.java index 153bcb48d6..dfe3f4a50c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNotificationLevelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNotificationLevelEvent.java index abc52ce34c..ec3064eed5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNotificationLevelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateNotificationLevelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java index a9a0c6c71c..67af2ee4c5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRegionEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRegionEvent.java index fc2458c328..220918cf3b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRegionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRegionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSplashEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSplashEvent.java index 259061641f..b3f85d0524 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSplashEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSplashEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSystemChannelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSystemChannelEvent.java index ae14acbe51..0933d2a7ef 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSystemChannelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateSystemChannelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVanityCodeEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVanityCodeEvent.java index 41ca82a880..c9e23fc254 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVanityCodeEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVanityCodeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVerificationLevelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVerificationLevelEvent.java index 94dd9bd361..8998980bb0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVerificationLevelEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateVerificationLevelEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/package-info.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/package-info.java index e45e598b3a..3348208ca0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java index 79b5951d0a..d31c250a83 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java index c69b3731a2..435f2f9f4c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GenericGuildVoiceUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java index 7c29a4aff8..8cfff145d1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceDeafenEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java index f6dbe73a56..8df04674e0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildDeafenEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java index cf70691814..7aba9011fc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceGuildMuteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java index 597a8fde48..640391145f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceJoinEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java index 605550f8ce..cce2128d86 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceLeaveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java index 1dd65980cd..8292679c9b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMoveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java index 57b1ddbb45..6627718fa3 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceMuteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java index 56118b48cb..a959fb198b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfDeafenEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java index 41aff40f1e..3e7aad264e 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSelfMuteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java index dc6eaee980..b61ec38f1f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceStreamEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java index 856f098176..87d8776412 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceSuppressEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java index 14f9c723e4..90945a60cf 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/GuildVoiceUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java b/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java index 5db6f302fe..4c8b279c9f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/voice/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/http/HttpRequestEvent.java b/src/main/java/net/dv8tion/jda/api/events/http/HttpRequestEvent.java index 32a9a1e0a4..15a03449eb 100644 --- a/src/main/java/net/dv8tion/jda/api/events/http/HttpRequestEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/http/HttpRequestEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java index e82a83bef5..0e11969ba2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/GenericMessageEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java index 2e96b192fd..acb88f5915 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageBulkDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java index 052ac12817..86e1b36e36 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java index 8edb75e264..ee5fcc5bc0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageEmbedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java index db44e291fc..7677514a88 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageReceivedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java index 38a167f9cb..5a25ffc692 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/MessageUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java index a2554b3cac..cc92dda4a3 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GenericGuildMessageEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java index b890561d83..3208a24116 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java index fef848b284..5a855af156 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageEmbedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java index d1424f045c..e50bd4699b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageReceivedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java index 73765047db..1b7cc8c716 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/GuildMessageUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java index daff8c2385..64a703fb57 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java index fd4d3c3790..35ad47b3d5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java index 2d5a319984..7ee1fee404 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java index ec8385fcbb..c9a8eb1e5e 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveAllEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java index e0d8864f93..5abf7c157c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEmoteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java index fd26e38498..b2fd076b54 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionRemoveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java index 4df6881cda..f6b524475d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/package-info.java index 1df19e6c33..dd5ed33b54 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java index 68e88624cc..d497812ae1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/GenericPrivateMessageEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java index 94d0d85736..f73c7c201c 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java index 474875402f..d576b99fe3 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageEmbedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java index a9c66c2d28..91f3468682 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageReceivedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java index cb65db1acb..414be54181 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/PrivateMessageUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java index 5f035e4cb1..e7798eff70 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java index 3cde9b028a..2ac1f2f2dc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/GenericPrivateMessageReactionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java index de233e9ea5..ba26edbbd4 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionAddEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java index 18017b6361..f66ef1e736 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/PrivateMessageReactionRemoveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java index 4eb02e2a15..5cfada0015 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/priv/react/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java index 99e8113e21..71b351f260 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java index 71ffabcd32..50db94409f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionAddEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java index 688e335170..4a81ac9f07 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveAllEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java index fa8882d997..244b22d257 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEmoteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java index 12f7eff7bf..3aa0f4976b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/MessageReactionRemoveEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java b/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java index 8b988e91a1..fa2082cf36 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/package-info.java b/src/main/java/net/dv8tion/jda/api/events/package-info.java index 45d41a097f..ce7f4e78a4 100644 --- a/src/main/java/net/dv8tion/jda/api/events/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/GenericRoleEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/GenericRoleEvent.java index 2c66523d0a..ef151c1817 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/GenericRoleEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/GenericRoleEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/RoleCreateEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/RoleCreateEvent.java index bf6acf2d0b..52961b0fc7 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/RoleCreateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/RoleCreateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/RoleDeleteEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/RoleDeleteEvent.java index a9cb0b3d09..3d91403a4f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/RoleDeleteEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/RoleDeleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/package-info.java b/src/main/java/net/dv8tion/jda/api/events/role/package-info.java index f7f96493c0..d78f1cdd36 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/GenericRoleUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/update/GenericRoleUpdateEvent.java index 5c0aaf9712..0501947261 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/GenericRoleUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/GenericRoleUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateColorEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateColorEvent.java index 0e6a00b58e..0ac9f23665 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateColorEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateColorEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.awt.Color; +import java.awt.*; /** * Indicates that a {@link net.dv8tion.jda.api.entities.Role Role} updated its color. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateHoistedEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateHoistedEvent.java index deb5c260fd..790b059abc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateHoistedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateHoistedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateMentionableEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateMentionableEvent.java index e4d967f53a..a417be54a6 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateMentionableEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateMentionableEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateNameEvent.java index 7ec54bebb0..d839b9980b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePermissionsEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePermissionsEvent.java index 19c0e6b762..3378c97dd5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePermissionsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePermissionsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePositionEvent.java b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePositionEvent.java index bfd8e4f7d8..2c2d9bee3a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePositionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/RoleUpdatePositionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/role/update/package-info.java b/src/main/java/net/dv8tion/jda/api/events/role/update/package-info.java index 699c259703..d31defdc30 100644 --- a/src/main/java/net/dv8tion/jda/api/events/role/update/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/role/update/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/GenericSelfUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/GenericSelfUpdateEvent.java index 5d8e5706fc..6a9395b6b0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/GenericSelfUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/GenericSelfUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateAvatarEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateAvatarEvent.java index 305103aab5..9d5b85b760 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateAvatarEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateAvatarEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 c2335c7b50..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 @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateEmailEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateEmailEvent.java index 71fd3ccc4c..53379fb0a2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateEmailEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateEmailEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMFAEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMFAEvent.java index 7b79826e60..14727c669d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMFAEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMFAEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMobileEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMobileEvent.java index 2ca0c5b8aa..da05ccacf1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMobileEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateMobileEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNameEvent.java index 2d4a731cd8..4b4a0ab85d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNitroEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNitroEvent.java index e530b9daa8..1fe79f079f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNitroEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateNitroEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdatePhoneNumberEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdatePhoneNumberEvent.java index 8c6c64d43c..73602a2a0a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdatePhoneNumberEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdatePhoneNumberEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateVerifiedEvent.java b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateVerifiedEvent.java index 035dc5646c..ebe056c739 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateVerifiedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/SelfUpdateVerifiedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/self/package-info.java b/src/main/java/net/dv8tion/jda/api/events/self/package-info.java index d6b88f9d91..6cfc369cce 100644 --- a/src/main/java/net/dv8tion/jda/api/events/self/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/self/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/GenericUserEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/GenericUserEvent.java index c524921559..3d48e3ddd5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/GenericUserEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/GenericUserEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java index 00dd928bd2..69696675fc 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityEndEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java index 34c4ce0bf2..b957c10c89 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/UserActivityStartEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java index 9d40a62ebb..6fc5b738e2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/package-info.java b/src/main/java/net/dv8tion/jda/api/events/user/package-info.java index 41814207f0..86d855d12b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java index cb4329e8b1..ab7e6c6f34 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserPresenceEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java index 5527b38ff8..4021019bf1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/GenericUserUpdateEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java index 50b888dbe1..83386fd28a 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivityOrderEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java index fdf201d6b7..957c308b96 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateAvatarEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java index f8cf0bd82c..3e208b4f72 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateDiscriminatorEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateFlagsEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateFlagsEvent.java index 08c7e60693..fee53857c3 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateFlagsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateFlagsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import net.dv8tion.jda.api.entities.User; import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.EnumSet; /** diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java index 7bd1c4933d..efd9b011ff 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateNameEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java index 1d1bdf4be0..bedf532ad5 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateOnlineStatusEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/AccountTypeException.java b/src/main/java/net/dv8tion/jda/api/exceptions/AccountTypeException.java index 1b8fdad6bc..bd8fa43e3a 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/AccountTypeException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/AccountTypeException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/ContextException.java b/src/main/java/net/dv8tion/jda/api/exceptions/ContextException.java index e34d96a82a..e858e35f3c 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/ContextException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/ContextException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/ErrorHandler.java b/src/main/java/net/dv8tion/jda/api/exceptions/ErrorHandler.java index 56c3c07054..8ad2b704f9 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/ErrorHandler.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/ErrorHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/ErrorResponseException.java b/src/main/java/net/dv8tion/jda/api/exceptions/ErrorResponseException.java index 76b308668f..7a43ee4618 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/ErrorResponseException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/ErrorResponseException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/GuildUnavailableException.java b/src/main/java/net/dv8tion/jda/api/exceptions/GuildUnavailableException.java index dc92821342..3cc7ee6070 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/GuildUnavailableException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/GuildUnavailableException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/HierarchyException.java b/src/main/java/net/dv8tion/jda/api/exceptions/HierarchyException.java index 1cd406e0c5..b97c8639f7 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/HierarchyException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/HierarchyException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/HttpException.java b/src/main/java/net/dv8tion/jda/api/exceptions/HttpException.java index c6c921b530..e3d08a5e99 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/HttpException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/HttpException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java b/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java index 86c0d1e377..59ccfc6ba4 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/InsufficientPermissionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java b/src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java index ca897e027e..6fe03815ab 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/MissingAccessException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/ParsingException.java b/src/main/java/net/dv8tion/jda/api/exceptions/ParsingException.java index eff581818e..96ee55d030 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/ParsingException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/ParsingException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/PermissionException.java b/src/main/java/net/dv8tion/jda/api/exceptions/PermissionException.java index 61dbd6f390..025bfaa7e8 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/PermissionException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/PermissionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/RateLimitedException.java b/src/main/java/net/dv8tion/jda/api/exceptions/RateLimitedException.java index 0c7f7d521f..7a6b53b2a7 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/RateLimitedException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/RateLimitedException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/VerificationLevelException.java b/src/main/java/net/dv8tion/jda/api/exceptions/VerificationLevelException.java index 08b5cbef5b..2b1dae0e6b 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/VerificationLevelException.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/VerificationLevelException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/exceptions/package-info.java b/src/main/java/net/dv8tion/jda/api/exceptions/package-info.java index 73f3500612..77ebdf77a3 100644 --- a/src/main/java/net/dv8tion/jda/api/exceptions/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/exceptions/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java b/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java index 2ef282fb9c..a26d2c0d0a 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/AnnotatedEventManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java b/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java index 40abe42770..64cb199ead 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/EventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/IEventManager.java b/src/main/java/net/dv8tion/jda/api/hooks/IEventManager.java index 13a24c4713..d89109c7c6 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/IEventManager.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/IEventManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/InterfacedEventManager.java b/src/main/java/net/dv8tion/jda/api/hooks/InterfacedEventManager.java index a1d13ed126..bd73f22b02 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/InterfacedEventManager.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/InterfacedEventManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 56dbc8470c..0972beafab 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/SubscribeEvent.java b/src/main/java/net/dv8tion/jda/api/hooks/SubscribeEvent.java index cf1b007188..c0e90f27b0 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/SubscribeEvent.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/SubscribeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/VoiceDispatchInterceptor.java b/src/main/java/net/dv8tion/jda/api/hooks/VoiceDispatchInterceptor.java index d6ab041490..8963512423 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/VoiceDispatchInterceptor.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/VoiceDispatchInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/hooks/package-info.java b/src/main/java/net/dv8tion/jda/api/hooks/package-info.java index ae4bab5e72..eccedd431c 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java b/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java index af4713423e..f80befd114 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/AccountManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 5e02f9a7c1..79e03e0bb2 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/AudioManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/AudioManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java index ecd2f00602..ace39ca479 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/DirectAudioController.java b/src/main/java/net/dv8tion/jda/api/managers/DirectAudioController.java index aa56d77428..1e9df4e99a 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/DirectAudioController.java +++ b/src/main/java/net/dv8tion/jda/api/managers/DirectAudioController.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/EmoteManager.java b/src/main/java/net/dv8tion/jda/api/managers/EmoteManager.java index c2bcff9c21..ef79c3417b 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/EmoteManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/EmoteManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java b/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java index 589bed7d97..218711f7d4 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/Manager.java b/src/main/java/net/dv8tion/jda/api/managers/Manager.java index 041f6a9166..22999eb56a 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/Manager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/Manager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/PermOverrideManager.java b/src/main/java/net/dv8tion/jda/api/managers/PermOverrideManager.java index e3fa4d7dc5..a0cbdbdca2 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/PermOverrideManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/PermOverrideManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/Presence.java b/src/main/java/net/dv8tion/jda/api/managers/Presence.java index 3bc9c7cfdf..f10ca8f912 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/Presence.java +++ b/src/main/java/net/dv8tion/jda/api/managers/Presence.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/RoleManager.java b/src/main/java/net/dv8tion/jda/api/managers/RoleManager.java index b8563977b9..e7d0afa074 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/RoleManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/RoleManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.awt.Color; +import java.awt.*; import java.util.Arrays; import java.util.Collection; diff --git a/src/main/java/net/dv8tion/jda/api/managers/WebhookManager.java b/src/main/java/net/dv8tion/jda/api/managers/WebhookManager.java index a22ad6c5fe..5371e82e4d 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/WebhookManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/WebhookManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/managers/package-info.java b/src/main/java/net/dv8tion/jda/api/managers/package-info.java index 9666b931e9..cb1ce48bfb 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/managers/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/package-info.java b/src/main/java/net/dv8tion/jda/api/package-info.java index d9ba316f6f..0a5f6a2915 100644 --- a/src/main/java/net/dv8tion/jda/api/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java b/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java index d7d6bf4068..72d3bcaca2 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java +++ b/src/main/java/net/dv8tion/jda/api/requests/CloseCode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java b/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java index 25400573fd..1b691dea0a 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java +++ b/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java b/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java index 243a150333..73b5c3c546 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java +++ b/src/main/java/net/dv8tion/jda/api/requests/GatewayIntent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/Request.java b/src/main/java/net/dv8tion/jda/api/requests/Request.java index 43b20e1c6b..0ed4b5f407 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/Request.java +++ b/src/main/java/net/dv8tion/jda/api/requests/Request.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/Response.java b/src/main/java/net/dv8tion/jda/api/requests/Response.java index 0ec7da48b2..8a46dd93d1 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/Response.java +++ b/src/main/java/net/dv8tion/jda/api/requests/Response.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/RestAction.java b/src/main/java/net/dv8tion/jda/api/requests/RestAction.java index 604e0bcf86..475b21d5b1 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/RestAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/RestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/RestFuture.java b/src/main/java/net/dv8tion/jda/api/requests/RestFuture.java index 2457a4ae62..465781e4ae 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/RestFuture.java +++ b/src/main/java/net/dv8tion/jda/api/requests/RestFuture.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/package-info.java b/src/main/java/net/dv8tion/jda/api/requests/package-info.java index 98dbc3a8a1..e9474a5c98 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/requests/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/AuditableRestAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/AuditableRestAction.java index c8a84d0453..4ef9020735 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/AuditableRestAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/AuditableRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java index 118d3558fd..e8e3be5159 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java index d4e4a5188c..204bf38fbd 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/InviteAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/InviteAction.java index 7742cd5ce2..dd1cf35acd 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/InviteAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/InviteAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/MemberAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/MemberAction.java index 60ff72eca4..8f0ce40c62 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/MemberAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/MemberAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java index e51d954486..8ce0d280b2 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java index 9034434aeb..92becb4ae6 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java index 324e730d97..fd7d984070 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/WebhookAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/WebhookAction.java index 265a51de68..78d11b2d03 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/WebhookAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/WebhookAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/CategoryOrderAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/CategoryOrderAction.java index 1fb49c31ba..ec0f02d3f2 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/CategoryOrderAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/CategoryOrderAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/ChannelOrderAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/ChannelOrderAction.java index 97ae8bad1d..a4d5754f9c 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/ChannelOrderAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/ChannelOrderAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java index 678bf52381..ebfdf94c44 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/OrderAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/RoleOrderAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/RoleOrderAction.java index df22a46d4c..8d66491a2f 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/RoleOrderAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/RoleOrderAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/package-info.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/package-info.java index 68ba7c2407..8838b0e2ad 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/order/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/order/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/package-info.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/package-info.java index be1a71a91e..7a480a8f53 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/AuditLogPaginationAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/AuditLogPaginationAction.java index bd2b0ee68d..ba21d77777 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/AuditLogPaginationAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/AuditLogPaginationAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/MessagePaginationAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/MessagePaginationAction.java index d247799535..22ae415632 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/MessagePaginationAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/MessagePaginationAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java index 3ddc25d821..a75f725f67 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/PaginationAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/ReactionPaginationAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/ReactionPaginationAction.java index 5b7ab1eb76..ce6562df36 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/ReactionPaginationAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/ReactionPaginationAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/package-info.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/package-info.java index de3f9b8086..31f8ef0866 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/pagination/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java index a47ded3535..984338743d 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index bdd3c859c9..53d0104c38 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java b/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java index 7547a7403a..4393abfe29 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/ShardManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/sharding/ThreadPoolProvider.java b/src/main/java/net/dv8tion/jda/api/sharding/ThreadPoolProvider.java index 0eff5c70e1..0281ea6971 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/ThreadPoolProvider.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/ThreadPoolProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/sharding/package-info.java b/src/main/java/net/dv8tion/jda/api/sharding/package-info.java index f6466d2b06..e223230187 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/AttachmentOption.java b/src/main/java/net/dv8tion/jda/api/utils/AttachmentOption.java index bfff6e7eab..b80ef378b2 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/AttachmentOption.java +++ b/src/main/java/net/dv8tion/jda/api/utils/AttachmentOption.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java b/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java index 5951163bb8..ae1086d11a 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java +++ b/src/main/java/net/dv8tion/jda/api/utils/ChunkingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/ClosableIterator.java b/src/main/java/net/dv8tion/jda/api/utils/ClosableIterator.java index bb8e3d5ec2..b192bc7d38 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/ClosableIterator.java +++ b/src/main/java/net/dv8tion/jda/api/utils/ClosableIterator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/Compression.java b/src/main/java/net/dv8tion/jda/api/utils/Compression.java index 70d5e58c3a..128ad5c26d 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/Compression.java +++ b/src/main/java/net/dv8tion/jda/api/utils/Compression.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java b/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java index 2a111275c5..f340faba8e 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java +++ b/src/main/java/net/dv8tion/jda/api/utils/ConcurrentSessionController.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/IOBiConsumer.java b/src/main/java/net/dv8tion/jda/api/utils/IOBiConsumer.java index 50d9ef8c0b..65405796d2 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/IOBiConsumer.java +++ b/src/main/java/net/dv8tion/jda/api/utils/IOBiConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/IOConsumer.java b/src/main/java/net/dv8tion/jda/api/utils/IOConsumer.java index d9d88f10f7..a8838d7f1a 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/IOConsumer.java +++ b/src/main/java/net/dv8tion/jda/api/utils/IOConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/IOFunction.java b/src/main/java/net/dv8tion/jda/api/utils/IOFunction.java index ab8ea4440a..6176ad24e6 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/IOFunction.java +++ b/src/main/java/net/dv8tion/jda/api/utils/IOFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/LockIterator.java b/src/main/java/net/dv8tion/jda/api/utils/LockIterator.java index 3bb1a6a635..2762bce737 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/LockIterator.java +++ b/src/main/java/net/dv8tion/jda/api/utils/LockIterator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java b/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java index a0f31664bf..f4077925fd 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MarkdownSanitizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/MarkdownUtil.java b/src/main/java/net/dv8tion/jda/api/utils/MarkdownUtil.java index e3dbfc9e44..50816a712b 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MarkdownUtil.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MarkdownUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java b/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java index 6ce71ea108..385a093f9a 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java b/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java index 13603a86eb..41a413ab7c 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MiscUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/Procedure.java b/src/main/java/net/dv8tion/jda/api/utils/Procedure.java index 392aef22fd..1d7e64aaca 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/Procedure.java +++ b/src/main/java/net/dv8tion/jda/api/utils/Procedure.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/Result.java b/src/main/java/net/dv8tion/jda/api/utils/Result.java index 91b59b52e5..30b5268c10 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/Result.java +++ b/src/main/java/net/dv8tion/jda/api/utils/Result.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 91b6793c44..4fdc60cf4d 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/SessionController.java +++ b/src/main/java/net/dv8tion/jda/api/utils/SessionController.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java b/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java index 084f01b585..2c55ce565a 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/utils/SessionControllerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/TimeUtil.java b/src/main/java/net/dv8tion/jda/api/utils/TimeUtil.java index 11bd72c9d3..be892510d4 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/TimeUtil.java +++ b/src/main/java/net/dv8tion/jda/api/utils/TimeUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/WidgetUtil.java b/src/main/java/net/dv8tion/jda/api/utils/WidgetUtil.java index 503864974d..27c5ea42a0 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/WidgetUtil.java +++ b/src/main/java/net/dv8tion/jda/api/utils/WidgetUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java b/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java index 7e2d7b3c7b..38e03eff01 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/CacheFlag.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/CacheView.java b/src/main/java/net/dv8tion/jda/api/utils/cache/CacheView.java index 35e200af4d..a12b5499f6 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/CacheView.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/CacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/MemberCacheView.java b/src/main/java/net/dv8tion/jda/api/utils/cache/MemberCacheView.java index 1cd0696b2a..a22d5dd2af 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/MemberCacheView.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/MemberCacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/ShardCacheView.java b/src/main/java/net/dv8tion/jda/api/utils/cache/ShardCacheView.java index f407915783..7a3744b9e0 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/ShardCacheView.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/ShardCacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/SnowflakeCacheView.java b/src/main/java/net/dv8tion/jda/api/utils/cache/SnowflakeCacheView.java index 20f05b13b5..e926806274 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/SnowflakeCacheView.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/SnowflakeCacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/SortedSnowflakeCacheView.java b/src/main/java/net/dv8tion/jda/api/utils/cache/SortedSnowflakeCacheView.java index a4c470aa21..ff039d02f1 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/SortedSnowflakeCacheView.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/SortedSnowflakeCacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/UnifiedMemberCacheView.java b/src/main/java/net/dv8tion/jda/api/utils/cache/UnifiedMemberCacheView.java index 53f20872e3..a2f86ee162 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/UnifiedMemberCacheView.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/UnifiedMemberCacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/cache/package-info.java b/src/main/java/net/dv8tion/jda/api/utils/cache/package-info.java index 827fc15219..be93713cab 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/cache/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/utils/cache/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/concurrent/DelayedCompletableFuture.java b/src/main/java/net/dv8tion/jda/api/utils/concurrent/DelayedCompletableFuture.java index 4892a3437d..bb3eb4679f 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/concurrent/DelayedCompletableFuture.java +++ b/src/main/java/net/dv8tion/jda/api/utils/concurrent/DelayedCompletableFuture.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/concurrent/Task.java b/src/main/java/net/dv8tion/jda/api/utils/concurrent/Task.java index 87d347d97d..87ca1454b1 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/concurrent/Task.java +++ b/src/main/java/net/dv8tion/jda/api/utils/concurrent/Task.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/concurrent/package-info.java b/src/main/java/net/dv8tion/jda/api/utils/concurrent/package-info.java index 1d77264529..cbe905f883 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/concurrent/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/utils/concurrent/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java b/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java index 746053e845..f122911002 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java b/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java index 8de504ee7c..b87f871644 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/DataType.java b/src/main/java/net/dv8tion/jda/api/utils/data/DataType.java index 4db77244ab..e8a1a98f32 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/DataType.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/DataType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/SerializableData.java b/src/main/java/net/dv8tion/jda/api/utils/data/SerializableData.java index bd92c7b534..7fd60d20e3 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/SerializableData.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/SerializableData.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java index 7ad4524d0b..a5ee57ca25 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java index 0beb556186..26e4f62cf7 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java index 8bb9268522..65e736df4f 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java index 2bfd391839..1e7b93a398 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/package-info.java b/src/main/java/net/dv8tion/jda/api/utils/data/package-info.java index 3484963b39..edaeddde14 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/api/utils/package-info.java b/src/main/java/net/dv8tion/jda/api/utils/package-info.java index b872452fb3..fa48409ffe 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/utils/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java index cc9094eeb8..353ae27781 100644 --- a/src/main/java/net/dv8tion/jda/internal/JDAImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/JDAImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/audio/AudioConnection.java b/src/main/java/net/dv8tion/jda/internal/audio/AudioConnection.java index 31e054471b..06dc6cd7ea 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioConnection.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/audio/AudioEncryption.java b/src/main/java/net/dv8tion/jda/internal/audio/AudioEncryption.java index 1215bcaa0e..9487199ff6 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioEncryption.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioEncryption.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/audio/AudioPacket.java b/src/main/java/net/dv8tion/jda/internal/audio/AudioPacket.java index b64b40ee94..38d9c7c628 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioPacket.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioPacket.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 9ebe117411..1df80ae962 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/audio/ConnectionRequest.java b/src/main/java/net/dv8tion/jda/internal/audio/ConnectionRequest.java index 4f733c1828..4653746437 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/ConnectionRequest.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/ConnectionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/audio/ConnectionStage.java b/src/main/java/net/dv8tion/jda/internal/audio/ConnectionStage.java index 9e92ab750f..a88823da70 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/ConnectionStage.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/ConnectionStage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/audio/Decoder.java b/src/main/java/net/dv8tion/jda/internal/audio/Decoder.java index 764fd74c20..dab2943a26 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/Decoder.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/Decoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/audio/VoiceCode.java b/src/main/java/net/dv8tion/jda/internal/audio/VoiceCode.java index a97fe00565..43ba60ad50 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/VoiceCode.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/VoiceCode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java index 5d5fdb514f..6bc49b2198 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java index b8ae9466f7..696f0a1b8e 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ActivityImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/ActivityImpl.java index 2bf8eb1126..98e5728cef 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ActivityImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ActivityImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ApplicationInfoImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/ApplicationInfoImpl.java index f398387b36..4d87d58e4d 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ApplicationInfoImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ApplicationInfoImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ApplicationTeamImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/ApplicationTeamImpl.java index 11151fee39..c2ae63849a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ApplicationTeamImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ApplicationTeamImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java index 2615edffd3..5a1a2d0655 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/CategoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/DataMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/DataMessage.java index 98d8dae63a..c539ef1dbc 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/DataMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/DataMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java index 2790c738d7..910fc33503 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index a631481921..430fde1faf 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 33f02107e6..64654d62d3 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java index c6d2e92cf1..1883c894bb 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildVoiceStateImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/InviteImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/InviteImpl.java index ad351e85e2..032c66f2d0 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/InviteImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/InviteImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java index 6c98b0ab7b..8368990b86 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java index 7d57aa69c6..0a592c4c98 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java index 0545323267..eacf03ca78 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/PrivateChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java index 8ffb3ffc6f..95267f70be 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/ReceivedMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/RichPresenceImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/RichPresenceImpl.java index a302448fe3..7948d0eaeb 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/RichPresenceImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/RichPresenceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java index c1b8161f02..6bd04fab40 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java index 5113ef071e..28e62f3346 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java index c5f8453a7f..3b1470690d 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/StoreChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java b/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java index a628ad67ab..346e7ba3e6 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/SystemMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/TeamMemberImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/TeamMemberImpl.java index 19befc8c18..f7f5defa6a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/TeamMemberImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/TeamMemberImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java index 76d550adf3..bae56cf78d 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/UserById.java b/src/main/java/net/dv8tion/jda/internal/entities/UserById.java index 0c2ce6c24c..03df02da42 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/UserById.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/UserById.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 a18df15169..837022e6d6 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/UserImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/VoiceChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/VoiceChannelImpl.java index 499400fba2..e06b6d22d3 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/VoiceChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/VoiceChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java index b05694c0aa..ea558b3aaa 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java index 17cbfa30b9..61a17b3ad9 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelCreateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java index b1478ddbc6..52ce078a50 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelDeleteHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java index 62784af53c..285f913a04 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/EventCache.java b/src/main/java/net/dv8tion/jda/internal/handle/EventCache.java index 8b14aa7b3d..90130d599c 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/EventCache.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/EventCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java index a7d259ffa5..e8a5df4836 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildBanHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildCreateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildCreateHandler.java index ff408049e5..e4c35cc452 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildCreateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildCreateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java index 040019a5e3..3d45007cf2 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildDeleteHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildEmojisUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildEmojisUpdateHandler.java index 8f4dfb7747..6bbc19a5e8 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildEmojisUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildEmojisUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberAddHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberAddHandler.java index 65e9d2b024..9124c8fe26 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberAddHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberAddHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java index 0aedd7a892..c97e30c9f8 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberRemoveHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java index 288fa36a9b..1adacf5bfc 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildMemberUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildMembersChunkHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildMembersChunkHandler.java index abafc417f0..ac3acd40f3 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildMembersChunkHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildMembersChunkHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleCreateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleCreateHandler.java index 8079ecdbb4..0c6d9c2fe7 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleCreateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleCreateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleDeleteHandler.java index 0b379ec761..8f3c79d863 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleDeleteHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java index 0950bf56fe..d6d071d774 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildRoleUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java index 87906951c1..184f2d196b 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java index 1d58562028..deb04af14b 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildSyncHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildSyncHandler.java index 131abd560f..7f2e46b390 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildSyncHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildSyncHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java index 812ccdd6ae..d17fd5a110 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java index c5242cf98a..7657351844 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/InviteCreateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/InviteDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/InviteDeleteHandler.java index c705dbd786..2e618e15b3 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/InviteDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/InviteDeleteHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java index c975c03544..fc93d92506 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageBulkDeleteHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageCreateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageCreateHandler.java index f0ff85c069..e2fd0b450e 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageCreateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageCreateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java index e142998767..a003fa81b2 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionBulkRemoveHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionBulkRemoveHandler.java index 383baa6e9d..645a630b0c 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionBulkRemoveHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionBulkRemoveHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java index e80ef4f434..25de78632c 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionClearEmoteHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java index a921907ce3..cfbeeab68f 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageReactionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java index 250d9849b6..11ccba6864 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java index 595d33fc1a..da659e9c5c 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ReadyHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ReadyHandler.java index 3b021367c4..6d3908c861 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ReadyHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ReadyHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/SocketHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/SocketHandler.java index d371a901cc..f3061d1d08 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/SocketHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/SocketHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java index 869902dcf0..bcb005657e 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 2f730eaa2c..35e70b8917 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/UserUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/UserUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/VoiceServerUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/VoiceServerUpdateHandler.java index e3e8c2b9cf..88e1a9afa3 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/VoiceServerUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/VoiceServerUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/handle/VoiceStateUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/VoiceStateUpdateHandler.java index 9621faf38b..3c1a65e908 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/VoiceStateUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/VoiceStateUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java b/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java index 684ae5d1a4..cc84301f85 100644 --- a/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java +++ b/src/main/java/net/dv8tion/jda/internal/hooks/EventManagerProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 3f9f4faea3..d658caa994 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/AccountManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/AudioManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/AudioManagerImpl.java index 941dc3cac9..8a7998bb0f 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/AudioManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/AudioManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java index a6d23c886a..e0650324bd 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/ChannelManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/DirectAudioControllerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/DirectAudioControllerImpl.java index fbada0a057..a2e6bd4e3b 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/DirectAudioControllerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/DirectAudioControllerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java index 008cd0cc45..fd2903639a 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/EmoteManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java index 67ce21b20c..c93c7bd544 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/ManagerBase.java b/src/main/java/net/dv8tion/jda/internal/managers/ManagerBase.java index 890568e198..61bf205c55 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/ManagerBase.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/ManagerBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java index c7c3c4260f..594e177c6e 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/PermOverrideManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java index 2ca0e164d9..0c1894715b 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/PresenceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java index b3486263f4..d561549aa3 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/RoleManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java index fde4223946..a3324efeea 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/WebhookManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/CallbackContext.java b/src/main/java/net/dv8tion/jda/internal/requests/CallbackContext.java index 275791a08a..1f84f6a4ef 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/CallbackContext.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/CallbackContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/CompletedRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/CompletedRestAction.java index 1eef63bdb1..1ae5565aca 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/CompletedRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/CompletedRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java index c8de99fc8d..9ee27802f2 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/DeferredRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/FunctionalCallback.java b/src/main/java/net/dv8tion/jda/internal/requests/FunctionalCallback.java index 13a744d0fa..02c3f80aa2 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/FunctionalCallback.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/FunctionalCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java b/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java index 216e6b6d4f..7453ef8164 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Method.java b/src/main/java/net/dv8tion/jda/internal/requests/Method.java index 338986c481..d1f9326eb0 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Method.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Method.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/RateLimiter.java b/src/main/java/net/dv8tion/jda/internal/requests/RateLimiter.java index 62c9c6ca0a..ed49168058 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/RateLimiter.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/RateLimiter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java index fedc232719..35dc00f5d0 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Requester.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Requester.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java index 0b6a070cf1..e48caeafed 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/RestActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Route.java b/src/main/java/net/dv8tion/jda/internal/requests/Route.java index 25e064e287..47a5848187 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Route.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Route.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index 5b66cd829a..a79a6f1468 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketCode.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketCode.java index a2826675dc..e3e68cb17c 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketCode.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketCode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java index 975e955fec..9a371dcfdb 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketSendingThread.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java index c890df346f..eb24579562 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/IBucket.java b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/IBucket.java index 07fafce214..33416c94f2 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/IBucket.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/IBucket.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/package-info.java b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/package-info.java index e034ca0b06..032e8ceb89 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/package-info.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/AuditableRestActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/AuditableRestActionImpl.java index ebaa419994..283b78bd0d 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/AuditableRestActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/AuditableRestActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java index c9295c6a8a..3556099a58 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/GuildActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/GuildActionImpl.java index b84df97316..cb44bd3a72 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/GuildActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/GuildActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java index ad92dc4e7e..2774d98698 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/InviteActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MemberActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MemberActionImpl.java index ee9f0a984f..5aad2bc843 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MemberActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MemberActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java index 3a84ec9373..638f2c5619 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java index fa396e82d3..abffc3df2a 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermOverrideData.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java index 745e2530a4..fe267b3f07 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java index c5b80041e4..fe4d55116c 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/WebhookActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/WebhookActionImpl.java index e62b60976b..a36e5542df 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/WebhookActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/WebhookActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java index 8bf17af3f3..f8de71df67 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/CombineRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/DelayRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/DelayRestAction.java index 6bb4f94331..4b54730b01 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/DelayRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/DelayRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapErrorRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapErrorRestAction.java index 7b5fde15b7..de404d6741 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapErrorRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapErrorRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapRestAction.java index 4d2a8e3601..46400d2114 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/FlatMapRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapErrorRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapErrorRestAction.java index db6db013a5..7406d7dc06 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapErrorRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapErrorRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapRestAction.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapRestAction.java index 19e604a48b..2a922e0dbd 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapRestAction.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/MapRestAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java index b513606e64..8d5eb47b72 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/operator/RestActionOperator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/CategoryOrderActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/CategoryOrderActionImpl.java index b2021326b8..f78dd4c62e 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/CategoryOrderActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/CategoryOrderActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/ChannelOrderActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/ChannelOrderActionImpl.java index 4f0b07425d..9573cd8c2e 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/ChannelOrderActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/ChannelOrderActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/OrderActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/OrderActionImpl.java index 7cbdaba55a..0171561a38 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/OrderActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/OrderActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/RoleOrderActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/RoleOrderActionImpl.java index 26f822d9bb..ec95961ba6 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/RoleOrderActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/order/RoleOrderActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/AuditLogPaginationActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/AuditLogPaginationActionImpl.java index da487ef4ae..afa21cd380 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/AuditLogPaginationActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/AuditLogPaginationActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java index 66fe43df0a..7f35f49b0d 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/MessagePaginationActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/PaginationActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/PaginationActionImpl.java index 8445d162f0..fc651d83a5 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/PaginationActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/PaginationActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java index 06a0b6087f..0843e0732b 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/pagination/ReactionPaginationActionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/BufferedRequestBody.java b/src/main/java/net/dv8tion/jda/internal/utils/BufferedRequestBody.java index 27f7c812f4..9e1bdad3b1 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/BufferedRequestBody.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/BufferedRequestBody.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/CacheConsumer.java b/src/main/java/net/dv8tion/jda/internal/utils/CacheConsumer.java index 73db6d131f..ef01253f29 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/CacheConsumer.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/CacheConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/ChainedClosableIterator.java b/src/main/java/net/dv8tion/jda/internal/utils/ChainedClosableIterator.java index 681fa41994..55bb7f5d89 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/ChainedClosableIterator.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/ChainedClosableIterator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/Checks.java b/src/main/java/net/dv8tion/jda/internal/utils/Checks.java index 4ef055ba00..2f4e979886 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/Checks.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/Checks.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java b/src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java index aa065a0954..bdab48ef1d 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/ClassWalker.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/ContextRunnable.java b/src/main/java/net/dv8tion/jda/internal/utils/ContextRunnable.java index 012bf3055e..c7710d3b90 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/ContextRunnable.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/ContextRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/EncodingUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/EncodingUtil.java index 51cc3e270f..8819cc54b8 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/EncodingUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/EncodingUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java b/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java index 8501175b6a..a499ca60a8 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/Helpers.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java index ba8be28677..bd8c116ba7 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/IOUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/JDALogger.java b/src/main/java/net/dv8tion/jda/internal/utils/JDALogger.java index 9c74f232bd..1fe5cedb4c 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/JDALogger.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/JDALogger.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java index 94740252a9..4591060b2a 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/PermissionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/SimpleLogger.java b/src/main/java/net/dv8tion/jda/internal/utils/SimpleLogger.java index 4216c262b6..d9f6c542c9 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/SimpleLogger.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/SimpleLogger.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/UnlockHook.java b/src/main/java/net/dv8tion/jda/internal/utils/UnlockHook.java index dc6ec5b07b..e5ac86ca74 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/UnlockHook.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/UnlockHook.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java index 5aa3fc9e0e..8e0618fbf4 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/AbstractCacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/MemberCacheViewImpl.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/MemberCacheViewImpl.java index 13292078b5..4a870b1394 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/MemberCacheViewImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/MemberCacheViewImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java index 294c7d4b8e..deefff0cf9 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/ReadWriteLockCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java index a91d1ee4d3..39b57c6fd1 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/ShardCacheViewImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeCacheViewImpl.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeCacheViewImpl.java index 8b15d6356e..4cb311fd57 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeCacheViewImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeCacheViewImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java index 76fa690451..1c7dfcc39a 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/SnowflakeReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/SortedSnowflakeCacheViewImpl.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/SortedSnowflakeCacheViewImpl.java index f058c3c2a8..4a6d7ce29c 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/SortedSnowflakeCacheViewImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/SortedSnowflakeCacheViewImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/cache/UnifiedCacheViewImpl.java b/src/main/java/net/dv8tion/jda/internal/utils/cache/UnifiedCacheViewImpl.java index 84d8cb0842..f13e308611 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/cache/UnifiedCacheViewImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/cache/UnifiedCacheViewImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/compress/Decompressor.java b/src/main/java/net/dv8tion/jda/internal/utils/compress/Decompressor.java index ba04f8d845..3cc4306981 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/compress/Decompressor.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/compress/Decompressor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/compress/ZlibDecompressor.java b/src/main/java/net/dv8tion/jda/internal/utils/compress/ZlibDecompressor.java index 8e7b7f7b40..6293345d40 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/compress/ZlibDecompressor.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/compress/ZlibDecompressor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/concurrent/CountingThreadFactory.java b/src/main/java/net/dv8tion/jda/internal/utils/concurrent/CountingThreadFactory.java index 7613b5932c..56b3c45a59 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/concurrent/CountingThreadFactory.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/concurrent/CountingThreadFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java b/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java index d060fe783c..e7ba949eba 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ import javax.annotation.Nonnull; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; -import java.util.function.Function; public class GatewayTask implements Task { diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/AuthorizationConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/AuthorizationConfig.java index a6757b1491..399b36792a 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/AuthorizationConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/AuthorizationConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/MetaConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/MetaConfig.java index 45e26bf209..6440e3c53a 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/MetaConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/MetaConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/SessionConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/SessionConfig.java index 40c96f16dd..0addd7f29e 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/SessionConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/SessionConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java index 18501f688d..3ee6855e51 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/ThreadingConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ConfigFlag.java b/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ConfigFlag.java index 71281eefd7..50233c635b 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ConfigFlag.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ConfigFlag.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ShardingConfigFlag.java b/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ShardingConfigFlag.java index 73fb96af8e..76ce8e9cff 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ShardingConfigFlag.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/flags/ShardingConfigFlag.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/EventConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/EventConfig.java index 3927d4a771..ff12072f97 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/EventConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/EventConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/PresenceProviderConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/PresenceProviderConfig.java index 041abb7c7c..d469c1fa27 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/PresenceProviderConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/PresenceProviderConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingConfig.java index 0f2c33a60b..31fb0b54fa 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java index de944d44ba..0f7277946f 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingMetaConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingSessionConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingSessionConfig.java index 181f0c8fd8..78f46cbed2 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingSessionConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ShardingSessionConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java index 059cb6dd8e..f9af30bd1f 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/config/sharding/ThreadingProviderConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/tuple/ImmutablePair.java b/src/main/java/net/dv8tion/jda/internal/utils/tuple/ImmutablePair.java index 8c9ab63689..0e384f3ea4 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/tuple/ImmutablePair.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/tuple/ImmutablePair.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutablePair.java b/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutablePair.java index 85be2dec51..11cc3c3dc6 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutablePair.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutablePair.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutableTriple.java b/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutableTriple.java index 1c3269f3ba..f96226ad85 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutableTriple.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/tuple/MutableTriple.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/tuple/Pair.java b/src/main/java/net/dv8tion/jda/internal/utils/tuple/Pair.java index e59f19b914..3b9bea238a 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/tuple/Pair.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/tuple/Pair.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/internal/utils/tuple/package-info.java b/src/main/java/net/dv8tion/jda/internal/utils/tuple/package-info.java index 43a5322c48..a78309ca59 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/tuple/package-info.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/tuple/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/net/dv8tion/jda/package-info.java b/src/main/java/net/dv8tion/jda/package-info.java index 0e7c2e85c5..332d986e5e 100644 --- a/src/main/java/net/dv8tion/jda/package-info.java +++ b/src/main/java/net/dv8tion/jda/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/HelpersTest.java b/src/test/java/HelpersTest.java index 8b28d788bb..f5fed4bca5 100644 --- a/src/test/java/HelpersTest.java +++ b/src/test/java/HelpersTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/JsonTest.java b/src/test/java/JsonTest.java index 39a2c643a5..f147dc3cfd 100644 --- a/src/test/java/JsonTest.java +++ b/src/test/java/JsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/MarkdownTest.java b/src/test/java/MarkdownTest.java index 91c473ec6e..cefafd9f65 100644 --- a/src/test/java/MarkdownTest.java +++ b/src/test/java/MarkdownTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/MarkdownUtilTest.java b/src/test/java/MarkdownUtilTest.java index 3e4e5db5fe..2501e4f2bb 100644 --- a/src/test/java/MarkdownUtilTest.java +++ b/src/test/java/MarkdownUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 1bdc0ea4c9f9f3e8aab118b33cd081120f6a3484 Mon Sep 17 00:00:00 2001 From: M*C*O Date: Fri, 12 Feb 2021 20:01:32 +0100 Subject: [PATCH 093/121] Docs: Nullability in GuildMessageReactionAddEvent Previously, Javadocs were copied from the superclass, which stated that getMember and getUser could be null. This contrasted with the @Nonnull annotation of this event's methods, which is guaranteed to have a Member and User. --- .../guild/react/GuildMessageReactionAddEvent.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java index 7ee1fee404..452a9ae35e 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GuildMessageReactionAddEvent.java @@ -39,6 +39,13 @@ public GuildMessageReactionAddEvent(@Nonnull JDA api, long responseNumber, @Nonn super(api, responseNumber, member, reaction, member.getIdLong()); } + /** + * The reacting {@link net.dv8tion.jda.api.entities.User User} + * + * @return The reacting user + * + * @see #getUserIdLong() + */ @Nonnull @Override @SuppressWarnings("ConstantConditions") @@ -47,6 +54,11 @@ public User getUser() return super.getUser(); } + /** + * The {@link net.dv8tion.jda.api.entities.Member Member} instance for the reacting user + * + * @return The member instance for the reacting user + */ @Nonnull @Override @SuppressWarnings("ConstantConditions") From 37d4277302514c4eec452faac99757113d073e1e Mon Sep 17 00:00:00 2001 From: caneleex Date: Thu, 4 Mar 2021 13:53:11 +0100 Subject: [PATCH 094/121] clarify Guild#getLocale for guilds without the COMMUNITY feature (#1493) * clarify Guild#getLocale for guilds without the COMMUNITY feature * mention the default locale --- src/main/java/net/dv8tion/jda/api/entities/Guild.java | 3 +++ 1 file changed, 3 insertions(+) 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 985040cfe4..feee8848a1 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -417,6 +417,9 @@ default String getVanityUrl() /** * The preferred locale for this guild. + *
          If the guild doesn't have the COMMUNITY feature, this returns the default. + * + *
          Default: {@link Locale#US} * * @return The preferred {@link Locale} for this guild */ From 213eda3de45dc35ecc12879e0ee9d2b26432b94c Mon Sep 17 00:00:00 2001 From: caneleex Date: Mon, 4 Jan 2021 22:57:05 +0100 Subject: [PATCH 095/121] fix mismatched docs for GuildUpdateOwnerEvent getters --- .../guild/update/GuildUpdateOwnerEvent.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java index 67af2ee4c5..e03ece880f 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateOwnerEvent.java @@ -44,9 +44,9 @@ public GuildUpdateOwnerEvent(@Nonnull JDA api, long responseNumber, @Nonnull Gui } /** - * The previous owner user id + * The new owner user id * - * @return The previous owner id + * @return The new owner id */ public long getNewOwnerIdLong() { @@ -54,9 +54,9 @@ public long getNewOwnerIdLong() } /** - * The previous owner user id + * The new owner user id * - * @return The previous owner id + * @return The new owner id */ @Nonnull public String getNewOwnerId() @@ -65,9 +65,9 @@ public String getNewOwnerId() } /** - * The new owner user id + * The previous owner user id * - * @return The new owner id + * @return The previous owner id */ public long getOldOwnerIdLong() { @@ -75,9 +75,9 @@ public long getOldOwnerIdLong() } /** - * The new owner user id + * The previous owner user id * - * @return The new owner id + * @return The previous owner id */ @Nonnull public String getOldOwnerId() From 875d1b097c8fdc96490f193d7f4b883bfe0f0d02 Mon Sep 17 00:00:00 2001 From: Andre_601 <11576465+Andre601@users.noreply.github.com> Date: Fri, 5 Mar 2021 14:42:49 +0100 Subject: [PATCH 096/121] Update Features list for Guild#getFeatures() (#1530) --- .../net/dv8tion/jda/api/entities/Guild.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) 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 feee8848a1..03e92344c2 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -287,21 +287,8 @@ default String getIconUrl() /** * The Features of the {@link net.dv8tion.jda.api.entities.Guild Guild}. *

          - * Possible known features: - *

            - *
          • ANIMATED_ICON - Guild can have an animated icon
          • - *
          • BANNER - Guild can have a banner
          • - *
          • COMMERCE - Guild can sell software through a store channel
          • - *
          • DISCOVERABLE - Guild shows up in discovery tab
          • - *
          • INVITE_SPLASH - Guild has custom invite splash. See {@link #getSplashId()} and {@link #getSplashUrl()}
          • - *
          • MORE_EMOJI - Guild is able to use more than 50 emoji
          • - *
          • NEWS - Guild can create news channels
          • - *
          • PARTNERED - Guild is "partnered"
          • - *
          • PUBLIC - Guild is public
          • - *
          • VANITY_URL - Guild a vanity URL (custom invite link). See {@link #getVanityUrl()}
          • - *
          • VERIFIED - Guild is "verified"
          • - *
          • VIP_REGIONS - Guild has VIP voice regions
          • - *
          + * List of Features + * * * @return Never-null, unmodifiable Set containing all of the Guild's features. */ From 20e7499beeaa1535bfd685d2fde73892237782b2 Mon Sep 17 00:00:00 2001 From: Simon <52353587+Simon-official@users.noreply.github.com> Date: Fri, 5 Mar 2021 15:11:41 +0100 Subject: [PATCH 097/121] Add fail_if_not_exists (#1524) --- .../net/dv8tion/jda/api/entities/Message.java | 16 +++++++ .../requests/restaction/MessageAction.java | 48 +++++++++++++++++++ .../restaction/MessageActionImpl.java | 23 ++++++++- 3 files changed, 86 insertions(+), 1 deletion(-) 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 b1f530d0f9..1453ad18bd 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -965,6 +965,8 @@ default boolean isFromGuild() * Replies and references this message. *
          This is identical to {@code message.getChannel().sendMessage(content).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendMessage(CharSequence)} and {@link MessageAction#reference(Message)}. * @@ -984,6 +986,8 @@ default MessageAction reply(@Nonnull CharSequence content) * Replies and references this message. *
          This is identical to {@code message.getChannel().sendMessage(content).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendMessage(MessageEmbed)} and {@link MessageAction#reference(Message)}. * @@ -1003,6 +1007,8 @@ default MessageAction reply(@Nonnull MessageEmbed content) * Replies and references this message. *
          This is identical to {@code message.getChannel().sendMessage(content).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendMessage(Message)} and {@link MessageAction#reference(Message)}. * @@ -1022,6 +1028,8 @@ default MessageAction reply(@Nonnull Message content) * Replies and references this message. *
          This is identical to {@code message.getChannel().sendMessageFormat(content, args).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendMessageFormat(String, Object...)} and {@link MessageAction#reference(Message)}. * @@ -1043,6 +1051,8 @@ default MessageAction replyFormat(@Nonnull String format, @Nonnull Object... arg * Replies and references this message. *
          This is identical to {@code message.getChannel().sendFile(file, options).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendFile(File, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. * @@ -1064,6 +1074,8 @@ default MessageAction reply(@Nonnull File file, @Nonnull AttachmentOption... opt * Replies and references this message. *
          This is identical to {@code message.getChannel().sendFile(data, name, options).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendFile(File, String, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. * @@ -1087,6 +1099,8 @@ default MessageAction reply(@Nonnull File data, @Nonnull String name, @Nonnull A * Replies and references this message. *
          This is identical to {@code message.getChannel().sendFile(data, name, options).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendFile(InputStream, String, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. * @@ -1110,6 +1124,8 @@ default MessageAction reply(@Nonnull InputStream data, @Nonnull String name, @No * Replies and references this message. *
          This is identical to {@code message.getChannel().sendFile(data, name, options).reference(message)}. * You can use {@link MessageAction#mentionRepliedUser(boolean) mentionRepliedUser(false)} to not mention the author of the message. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link MessageAction#failOnInvalidReply(boolean)}. * *

          For further info, see {@link MessageChannel#sendFile(byte[], String, net.dv8tion.jda.api.utils.AttachmentOption...)} and {@link MessageAction#reference(Message)}. * diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java index db38314a6c..3897aa9391 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java @@ -152,6 +152,33 @@ static boolean isDefaultMentionRepliedUser() return MessageActionImpl.isDefaultMentionRepliedUser(); } + /** + * Sets the default value for {@link #failOnInvalidReply(boolean)} + * + *

          Default: false + * + * @param fail + * True, to throw a exception if the referenced message does not exist + */ + static void setDefaultFailOnInvalidReply(boolean fail) + { + MessageActionImpl.setDefaultFailOnInvalidReply(fail); + } + + /** + * Returns the default behavior for replies when the referenced message does not exist. + *
          If this is {@code true} then all replies will throw an exception if the referenced message does not exist. + * You can specify this individually with {@link #failOnInvalidReply(boolean)} for each message. + * + *

          Default: false + * + * @return True, to throw a exception if the referenced message does not exist + */ + static boolean isDefaultFailOnInvalidReply() + { + return MessageActionImpl.isDefaultFailOnInvalidReply(); + } + @Nonnull @Override MessageAction setCheck(@Nullable BooleanSupplier checks); @@ -214,6 +241,8 @@ static boolean isDefaultMentionRepliedUser() * Make the message a reply to the referenced message. *
          You can only reply to messages from the same channel! *
          This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link #failOnInvalidReply(boolean)}. * *

          This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! * @@ -230,6 +259,8 @@ static boolean isDefaultMentionRepliedUser() * Make the message a reply to the referenced message. *
          You can only reply to messages from the same channel! *
          This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link #failOnInvalidReply(boolean)}. * *

          This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! * You cannot reply to system messages (such as {@link net.dv8tion.jda.api.entities.MessageType#CHANNEL_PINNED_ADD CHANNEL_PINNED_ADD} and similar). @@ -253,6 +284,8 @@ default MessageAction referenceById(@Nonnull String messageId) * Make the message a reply to the referenced message. *
          You can only reply to messages from the same channel! *
          This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. + *
          By default there won't be any error thrown if the referenced message does not exist. + * This behavior can be changed with {@link #failOnInvalidReply(boolean)}. * *

          This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! * @@ -289,6 +322,21 @@ default MessageAction reference(@Nonnull Message message) @CheckReturnValue MessageAction mentionRepliedUser(boolean mention); + /** + * Whether to throw a exception if the referenced message does not exist, when replying to a message. + *
          This only matters in combination with {@link #reference(Message)} and {@link #referenceById(long)}! + * + *

          This is false by default but can be configured using {@link #setDefaultFailOnInvalidReply(boolean)}! + * + * @param fail + * True, to throw a exception if the referenced message does not exist + * + * @return Updated MessageAction for chaining convenience + */ + @Nonnull + @CheckReturnValue + MessageAction failOnInvalidReply(boolean fail); + /** * Enable/Disable Text-To-Speech for the resulting message. *
          This is only relevant to MessageActions that are not {@code isEdit() == true}! diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java index 3a84ec9373..73284a1bf8 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/MessageActionImpl.java @@ -53,6 +53,7 @@ public class MessageActionImpl extends RestActionImpl implements Messag private static final String CONTENT_TOO_BIG = String.format("A message may not exceed %d characters. Please limit your input!", Message.MAX_CONTENT_LENGTH); protected static EnumSet defaultMentions = EnumSet.allOf(Message.MentionType.class); protected static boolean defaultMentionRepliedUser = true; + protected static boolean defaultFailOnInvalidReply = false; protected final Map files = new HashMap<>(); protected final Set ownedResources = new HashSet<>(); protected final StringBuilder content; @@ -61,6 +62,7 @@ public class MessageActionImpl extends RestActionImpl implements Messag protected String nonce = null; protected boolean tts = false, override = false; protected boolean mentionRepliedUser = defaultMentionRepliedUser; + protected boolean failOnInvalidReply = defaultFailOnInvalidReply; protected EnumSet allowedMentions; protected Set mentionableUsers = new HashSet<>(); protected Set mentionableRoles = new HashSet<>(); @@ -89,6 +91,16 @@ public static boolean isDefaultMentionRepliedUser() return defaultMentionRepliedUser; } + public static void setDefaultFailOnInvalidReply(boolean fail) + { + defaultFailOnInvalidReply = fail; + } + + public static boolean isDefaultFailOnInvalidReply() + { + return defaultFailOnInvalidReply; + } + public MessageActionImpl(JDA api, Route.CompiledRoute route, MessageChannel channel) { super(api, route); @@ -214,6 +226,14 @@ public MessageAction mentionRepliedUser(boolean mention) return this; } + @Nonnull + @Override + public MessageAction failOnInvalidReply(boolean fail) + { + failOnInvalidReply = fail; + return this; + } + @Nonnull @Override @CheckReturnValue @@ -513,7 +533,8 @@ protected DataObject getJSON() { obj.put("message_reference", DataObject.empty() .put("message_id", messageReference) - .put("channel_id", channel.getId())); + .put("channel_id", channel.getId()) + .put("fail_if_not_exists", failOnInvalidReply)); } obj.put("tts", tts); if ((messageReference != 0L && !mentionRepliedUser) || allowedMentions != null || !mentionableUsers.isEmpty() || !mentionableRoles.isEmpty()) From ad259c0dd40976083e2035e11b83fcac3bbc83a0 Mon Sep 17 00:00:00 2001 From: Horstexplorer <21320859+Horstexplorer@users.noreply.github.com> Date: Mon, 18 Jan 2021 17:17:10 +0100 Subject: [PATCH 098/121] Update Member.java added missing word --- src/main/java/net/dv8tion/jda/api/entities/Member.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 35765f4105..2c8ef2e83b 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Member.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Member.java @@ -449,9 +449,9 @@ default AuditableRestAction kick() } /** - * Kicks this from the {@link net.dv8tion.jda.api.entities.Guild Guild}. + * Kicks this Member from the {@link net.dv8tion.jda.api.entities.Guild Guild}. * - *

          Note: {@link net.dv8tion.jda.api.entities.Guild#getMembers()} will still contain the {@link net.dv8tion.jda.api.entities.User User} + *

          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 From 7c936470b78416ac20b52e8a1521f9388e5bc316 Mon Sep 17 00:00:00 2001 From: caneleex Date: Sat, 6 Mar 2021 17:50:29 +0100 Subject: [PATCH 099/121] add Guild#getRulesChannel and Guild#getCommunityUpdatesChannel (#1464) --- .../net/dv8tion/jda/api/audit/ActionType.java | 2 + .../dv8tion/jda/api/audit/AuditLogKey.java | 16 +++++ .../net/dv8tion/jda/api/entities/Guild.java | 24 +++++++ ...ildUpdateCommunityUpdatesChannelEvent.java | 63 +++++++++++++++++++ .../update/GuildUpdateRulesChannelEvent.java | 63 +++++++++++++++++++ .../jda/api/hooks/ListenerAdapter.java | 2 + .../jda/api/managers/GuildManager.java | 44 ++++++++++++- .../jda/internal/entities/EntityBuilder.java | 6 +- .../jda/internal/entities/GuildImpl.java | 26 ++++++++ .../internal/handle/GuildUpdateHandler.java | 22 +++++++ .../internal/managers/GuildManagerImpl.java | 32 +++++++++- 11 files changed, 296 insertions(+), 4 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateCommunityUpdatesChannelEvent.java create mode 100644 src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRulesChannelEvent.java diff --git a/src/main/java/net/dv8tion/jda/api/audit/ActionType.java b/src/main/java/net/dv8tion/jda/api/audit/ActionType.java index ab29db9a55..67cad2359e 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/ActionType.java +++ b/src/main/java/net/dv8tion/jda/api/audit/ActionType.java @@ -38,6 +38,8 @@ public enum ActionType *

        • {@link net.dv8tion.jda.api.audit.AuditLogKey#GUILD_REGION GUILD_REGION}
        • *
        • {@link net.dv8tion.jda.api.audit.AuditLogKey#GUILD_SPLASH GUILD_SPLASH}
        • *
        • {@link net.dv8tion.jda.api.audit.AuditLogKey#GUILD_SYSTEM_CHANNEL GUILD_SYSTEM_CHANNEL}
        • + *
        • {@link net.dv8tion.jda.api.audit.AuditLogKey#GUILD_RULES_CHANNEL GUILD_RULES_CHANNEL}
        • + *
        • {@link net.dv8tion.jda.api.audit.AuditLogKey#GUILD_COMMUNITY_UPDATES_CHANNEL GUILD_COMMUNITY_UPDATES_CHANNEL}
        • *
        */ GUILD_UPDATE(1, TargetType.GUILD), diff --git a/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java b/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java index e6ea8b16c9..cac971fa02 100644 --- a/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java +++ b/src/main/java/net/dv8tion/jda/api/audit/AuditLogKey.java @@ -100,6 +100,22 @@ public enum AuditLogKey */ GUILD_SYSTEM_CHANNEL("system_channel_id"), + /** + * Change of the {@link net.dv8tion.jda.api.entities.Guild#getRulesChannel() Guild.getRulesChannel()} value represented by a TextChannel ID. + *
        Use with {@link net.dv8tion.jda.api.entities.Guild#getTextChannelById(String) Guild.getTextChannelById(String)} + * + *

        Expected type: String + */ + GUILD_RULES_CHANNEL("rules_channel_id"), + + /** + * Change of the {@link net.dv8tion.jda.api.entities.Guild#getCommunityUpdatesChannel() Guild.getCommunityUpdatesChannel()} value represented by a TextChannel ID. + *
        Use with {@link net.dv8tion.jda.api.entities.Guild#getTextChannelById(String) Guild.getTextChannelById(String)} + * + *

        Expected type: String + */ + GUILD_COMMUNITY_UPDATES_CHANNEL("public_updates_channel_id"), + /** * Change of the {@link net.dv8tion.jda.api.entities.Guild#getExplicitContentLevel() Guild.getExplicitContentLevel()} of a Guild. *
        Use with {@link net.dv8tion.jda.api.entities.Guild.ExplicitContentLevel#fromKey(int) Guild.ExplicitContentLevel.fromKey(int)} 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 16e19fffa6..9b08556146 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -292,7 +292,9 @@ default String getIconUrl() *

      • ANIMATED_ICON - Guild can have an animated icon
      • *
      • BANNER - Guild can have a banner
      • *
      • COMMERCE - Guild can sell software through a store channel
      • + *
      • COMMUNITY - Guild can enable welcome screen and discovery, and receives community updates. See {@link #getRulesChannel()} and {@link #getCommunityUpdatesChannel()}
      • *
      • DISCOVERABLE - Guild shows up in discovery tab
      • + *
      • FEATURABLE - Guild is able to be featured in discovery tab
      • *
      • INVITE_SPLASH - Guild has custom invite splash. See {@link #getSplashId()} and {@link #getSplashUrl()}
      • *
      • MORE_EMOJI - Guild is able to use more than 50 emoji
      • *
      • NEWS - Guild can create news channels
      • @@ -585,6 +587,28 @@ default int getMaxEmotes() @Nullable TextChannel getSystemChannel(); + /** + * Provides the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that lists the rules of the guild. + *
        If this guild doesn't have the COMMUNITY {@link #getFeatures() feature}, this returns {@code null}. + * + * @return Possibly-null {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that is the rules channel + * + * @see #getFeatures() + */ + @Nullable + TextChannel getRulesChannel(); + + /** + * Provides the {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that receives community updates. + *
        If this guild doesn't have the COMMUNITY {@link #getFeatures() feature}, this returns {@code null}. + * + * @return Possibly-null {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} that is the community updates channel + * + * @see #getFeatures() + */ + @Nullable + TextChannel getCommunityUpdatesChannel(); + /** * The {@link net.dv8tion.jda.api.entities.Member Member} object for the owner of this Guild. *
        This is null when the owner is no longer in this guild or not yet loaded (lazy loading). diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateCommunityUpdatesChannelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateCommunityUpdatesChannelEvent.java new file mode 100644 index 0000000000..75a7aec704 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateCommunityUpdatesChannelEvent.java @@ -0,0 +1,63 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.guild.update; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.TextChannel; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Indicates that the community updates channel of a {@link Guild Guild} changed. + * + *

        Can be used to detect when a guild community updates channel changes and retrieve the old one + * + *

        Identifier: {@code community_updates_channel} + */ +public class GuildUpdateCommunityUpdatesChannelEvent extends GenericGuildUpdateEvent +{ + public static final String IDENTIFIER = "community_updates_channel"; + + public GuildUpdateCommunityUpdatesChannelEvent(@Nonnull JDA api, long responseNumber, @Nonnull Guild guild, @Nullable TextChannel oldCommunityUpdatesChannel) + { + super(api, responseNumber, guild, oldCommunityUpdatesChannel, guild.getCommunityUpdatesChannel(), IDENTIFIER); + } + + /** + * The previous community updates channel. + * + * @return The previous community updates channel + */ + @Nullable + public TextChannel getOldCommunityUpdatesChannel() + { + return getOldValue(); + } + + /** + * The new community updates channel. + * + * @return The new community updates channel + */ + @Nullable + public TextChannel getNewCommunityUpdatesChannel() + { + return getNewValue(); + } +} diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRulesChannelEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRulesChannelEvent.java new file mode 100644 index 0000000000..9d0f9621cb --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateRulesChannelEvent.java @@ -0,0 +1,63 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.guild.update; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.TextChannel; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Indicates that the rules channel of a {@link Guild Guild} changed. + * + *

        Can be used to detect when a guild rule channel changes and retrieve the old one + * + *

        Identifier: {@code rules_channel} + */ +public class GuildUpdateRulesChannelEvent extends GenericGuildUpdateEvent +{ + public static final String IDENTIFIER = "rules_channel"; + + public GuildUpdateRulesChannelEvent(@Nonnull JDA api, long responseNumber, @Nonnull Guild guild, @Nullable TextChannel oldRulesChannel) + { + super(api, responseNumber, guild, oldRulesChannel, guild.getRulesChannel(), IDENTIFIER); + } + + /** + * The previous rules channel. + * + * @return The previous rules channel + */ + @Nullable + public TextChannel getOldRulesChannel() + { + return getOldValue(); + } + + /** + * The new rules channel. + * + * @return The new rules channel + */ + @Nullable + public TextChannel getNewRulesChannel() + { + return getNewValue(); + } +} diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 56dbc8470c..f1b89e6d3a 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -280,6 +280,8 @@ public void onGuildMemberRemove(@Nonnull GuildMemberRemoveEvent event) {} //Guild Update Events public void onGuildUpdateAfkChannel(@Nonnull GuildUpdateAfkChannelEvent event) {} public void onGuildUpdateSystemChannel(@Nonnull GuildUpdateSystemChannelEvent event) {} + public void onGuildUpdateRulesChannel(@Nonnull GuildUpdateRulesChannelEvent event) {} + public void onGuildUpdateCommunityUpdatesChannel(@Nonnull GuildUpdateCommunityUpdatesChannelEvent event) {} public void onGuildUpdateAfkTimeout(@Nonnull GuildUpdateAfkTimeoutEvent event) {} public void onGuildUpdateExplicitContentLevel(@Nonnull GuildUpdateExplicitContentLevelEvent event) {} public void onGuildUpdateIcon(@Nonnull GuildUpdateIconEvent event) {} diff --git a/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java b/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java index 589bed7d97..4d8d63f292 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/GuildManager.java @@ -69,9 +69,13 @@ public interface GuildManager extends Manager /** Used to reset the banner field */ long BANNER = 0x800; /** Used to reset the vanity code field */ - long VANITY_URL = 0x1000; + long VANITY_URL = 0x1000; /** Used to reset the description field */ - long DESCRIPTION = 0x2000; + long DESCRIPTION = 0x2000; + /** Used to reset the rules channel field */ + long RULES_CHANNEL = 0x4000; + /** Used to reset the community updates channel field */ + long COMMUNITY_UPDATES_CHANNEL = 0x8000; /** * Resets the fields specified by the provided bit-flag pattern. @@ -87,6 +91,8 @@ public interface GuildManager extends Manager *

      • {@link #AFK_CHANNEL}
      • *
      • {@link #AFK_TIMEOUT}
      • *
      • {@link #SYSTEM_CHANNEL}
      • + *
      • {@link #RULES_CHANNEL}
      • + *
      • {@link #COMMUNITY_UPDATES_CHANNEL}
      • *
      • {@link #MFA_LEVEL}
      • *
      • {@link #NOTIFICATION_LEVEL}
      • *
      • {@link #EXPLICIT_CONTENT_LEVEL}
      • @@ -116,6 +122,8 @@ public interface GuildManager extends Manager *
      • {@link #AFK_CHANNEL}
      • *
      • {@link #AFK_TIMEOUT}
      • *
      • {@link #SYSTEM_CHANNEL}
      • + *
      • {@link #RULES_CHANNEL}
      • + *
      • {@link #COMMUNITY_UPDATES_CHANNEL}
      • *
      • {@link #MFA_LEVEL}
      • *
      • {@link #NOTIFICATION_LEVEL}
      • *
      • {@link #EXPLICIT_CONTENT_LEVEL}
      • @@ -235,6 +243,38 @@ public interface GuildManager extends Manager @CheckReturnValue GuildManager setSystemChannel(@Nullable TextChannel systemChannel); + /** + * Sets the rules {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} of this {@link net.dv8tion.jda.api.entities.Guild Guild}. + * + * @param rulesChannel + * The new rules channel for this {@link net.dv8tion.jda.api.entities.Guild Guild} + * or {@code null} to reset + * + * @throws IllegalArgumentException + * If the provided channel is not from this guild + * + * @return GuildManager for chaining convenience + */ + @Nonnull + @CheckReturnValue + GuildManager setRulesChannel(@Nullable TextChannel rulesChannel); + + /** + * Sets the community updates {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} of this {@link net.dv8tion.jda.api.entities.Guild Guild}. + * + * @param communityUpdatesChannel + * The new community updates channel for this {@link net.dv8tion.jda.api.entities.Guild Guild} + * or {@code null} to reset + * + * @throws IllegalArgumentException + * If the provided channel is not from this guild + * + * @return GuildManager for chaining convenience + */ + @Nonnull + @CheckReturnValue + GuildManager setCommunityUpdatesChannel(@Nullable TextChannel communityUpdatesChannel); + /** * Sets the afk {@link net.dv8tion.jda.api.entities.Guild.Timeout Timeout} of this {@link net.dv8tion.jda.api.entities.Guild Guild}. * diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index a631481921..0c1bc2c322 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -180,6 +180,8 @@ public GuildImpl createGuild(long guildId, DataObject guildJson, TLongObjectMap< final long ownerId = guildJson.getUnsignedLong("owner_id", 0L); final long afkChannelId = guildJson.getUnsignedLong("afk_channel_id", 0L); final long systemChannelId = guildJson.getUnsignedLong("system_channel_id", 0L); + final long rulesChannelId = guildJson.getUnsignedLong("rules_channel_id", 0L); + final long communityUpdatesChannelId = guildJson.getUnsignedLong("public_updates_channel_id", 0L); final int boostCount = guildJson.getInt("premium_subscription_count", 0); final int boostTier = guildJson.getInt("premium_tier", 0); final int maxMembers = guildJson.getInt("max_members", 0); @@ -266,7 +268,9 @@ public GuildImpl createGuild(long guildId, DataObject guildJson, TLongObjectMap< createGuildEmotePass(guildObj, emotesArray); guildObj.setAfkChannel(guildObj.getVoiceChannelById(afkChannelId)) - .setSystemChannel(guildObj.getTextChannelById(systemChannelId)); + .setSystemChannel(guildObj.getTextChannelById(systemChannelId)) + .setRulesChannel(guildObj.getTextChannelById(rulesChannelId)) + .setCommunityUpdatesChannel(guildObj.getTextChannelById(communityUpdatesChannelId)); return guildObj; } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 33f02107e6..659928de45 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -102,6 +102,8 @@ public class GuildImpl implements Guild private Set features; private VoiceChannel afkChannel; private TextChannel systemChannel; + private TextChannel rulesChannel; + private TextChannel communityUpdatesChannel; private Role publicRole; private VerificationLevel verificationLevel = VerificationLevel.UNKNOWN; private NotificationLevel defaultNotificationLevel = NotificationLevel.UNKNOWN; @@ -328,6 +330,18 @@ public TextChannel getSystemChannel() return systemChannel; } + @Override + public TextChannel getRulesChannel() + { + return rulesChannel; + } + + @Override + public TextChannel getCommunityUpdatesChannel() + { + return communityUpdatesChannel; + } + @Nonnull @Override public RestAction> retrieveWebhooks() @@ -1573,6 +1587,18 @@ public GuildImpl setSystemChannel(TextChannel systemChannel) return this; } + public GuildImpl setRulesChannel(TextChannel rulesChannel) + { + this.rulesChannel = rulesChannel; + return this; + } + + public GuildImpl setCommunityUpdatesChannel(TextChannel communityUpdatesChannel) + { + this.communityUpdatesChannel = communityUpdatesChannel; + return this; + } + public GuildImpl setPublicRole(Role publicRole) { this.publicRole = publicRole; diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java index 812ccdd6ae..452e7a071c 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildUpdateHandler.java @@ -86,6 +86,10 @@ protected Long handleInternally(DataObject content) ? null : guild.getVoiceChannelsView().get(content.getLong("afk_channel_id")); TextChannel systemChannel = content.isNull("system_channel_id") ? null : guild.getTextChannelsView().get(content.getLong("system_channel_id")); + TextChannel rulesChannel = content.isNull("rules_channel_id") + ? null : guild.getTextChannelsView().get(content.getLong("rules_channel_id")); + TextChannel communityUpdatesChannel = content.isNull("public_updates_channel_id") + ? null : guild.getTextChannelsView().get(content.getLong("public_updates_channel_id")); Set features; if (!content.isNull("features")) { @@ -292,6 +296,24 @@ protected Long handleInternally(DataObject content) getJDA(), responseNumber, guild, oldSystemChannel)); } + if (!Objects.equals(rulesChannel, guild.getRulesChannel())) + { + TextChannel oldRulesChannel = guild.getRulesChannel(); + guild.setRulesChannel(rulesChannel); + getJDA().handleEvent( + new GuildUpdateRulesChannelEvent( + getJDA(), responseNumber, + guild, oldRulesChannel)); + } + if (!Objects.equals(communityUpdatesChannel, guild.getCommunityUpdatesChannel())) + { + TextChannel oldCommunityUpdatesChannel = guild.getCommunityUpdatesChannel(); + guild.setCommunityUpdatesChannel(communityUpdatesChannel); + getJDA().handleEvent( + new GuildUpdateCommunityUpdatesChannelEvent( + getJDA(), responseNumber, + guild, oldCommunityUpdatesChannel)); + } return null; } } diff --git a/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java b/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java index 67ce21b20c..e446f27814 100644 --- a/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/managers/GuildManagerImpl.java @@ -41,7 +41,7 @@ public class GuildManagerImpl extends ManagerBase implements Guild protected String name; protected String region; protected Icon icon, splash, banner; - protected String afkChannel, systemChannel; + protected String afkChannel, systemChannel, rulesChannel, communityUpdatesChannel; protected String description, vanityCode; protected int afkTimeout; protected int mfaLevel; @@ -86,6 +86,10 @@ public GuildManagerImpl reset(long fields) this.afkChannel = null; if ((fields & SYSTEM_CHANNEL) == SYSTEM_CHANNEL) this.systemChannel = null; + if ((fields & RULES_CHANNEL) == RULES_CHANNEL) + this.rulesChannel = null; + if ((fields & COMMUNITY_UPDATES_CHANNEL) == COMMUNITY_UPDATES_CHANNEL) + this.communityUpdatesChannel = null; if ((fields & DESCRIPTION) == DESCRIPTION) this.description = null; if ((fields & BANNER) == BANNER) @@ -188,6 +192,28 @@ public GuildManagerImpl setSystemChannel(TextChannel systemChannel) return this; } + @Nonnull + @Override + @CheckReturnValue + public GuildManagerImpl setRulesChannel(TextChannel rulesChannel) + { + Checks.check(rulesChannel == null || rulesChannel.getGuild().equals(getGuild()), "Channel must be from the same guild"); + this.rulesChannel = rulesChannel == null ? null : rulesChannel.getId(); + set |= RULES_CHANNEL; + return this; + } + + @Nonnull + @Override + @CheckReturnValue + public GuildManagerImpl setCommunityUpdatesChannel(TextChannel communityUpdatesChannel) + { + Checks.check(communityUpdatesChannel == null || communityUpdatesChannel.getGuild().equals(getGuild()), "Channel must be from the same guild"); + this.communityUpdatesChannel = communityUpdatesChannel == null ? null : communityUpdatesChannel.getId(); + set |= COMMUNITY_UPDATES_CHANNEL; + return this; + } + @Nonnull @Override @CheckReturnValue @@ -295,6 +321,10 @@ protected RequestBody finalizeData() body.put("afk_channel_id", afkChannel); if (shouldUpdate(SYSTEM_CHANNEL)) body.put("system_channel_id", systemChannel); + if (shouldUpdate(RULES_CHANNEL)) + body.put("rules_channel_id", rulesChannel); + if (shouldUpdate(COMMUNITY_UPDATES_CHANNEL)) + body.put("public_updates_channel_id", communityUpdatesChannel); if (shouldUpdate(VERIFICATION_LEVEL)) body.put("verification_level", verificationLevel); if (shouldUpdate(NOTIFICATION_LEVEL)) From cb9e94f8f41e9c33da4eafe386d1515e20953f11 Mon Sep 17 00:00:00 2001 From: Andre_601 <11576465+Andre601@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:56:44 +0100 Subject: [PATCH 100/121] [Docs] Mention that createDefault and createLight may override GatewayIntent#DEFAULT (#1481) --- src/main/java/net/dv8tion/jda/api/JDABuilder.java | 12 ++++++++++++ .../jda/api/sharding/DefaultShardManagerBuilder.java | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index 14701ecc5b..2ed388f9be 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -198,6 +198,9 @@ public static JDABuilder createDefault(@Nullable String token) *
      • This disables {@link CacheFlag#ACTIVITY} and {@link CacheFlag#CLIENT_STATUS}
      • *
      * + *

      You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

      If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. @@ -238,6 +241,9 @@ public static JDABuilder createDefault(@Nullable String token, @Nonnull GatewayI *

    • This disables {@link CacheFlag#ACTIVITY} and {@link CacheFlag#CLIENT_STATUS}
    • *
    * + *

    You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

    If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. @@ -308,6 +314,9 @@ public static JDABuilder createLight(@Nullable String token) *

  • This disables all existing {@link CacheFlag CacheFlags}
  • * * + *

    You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

    If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. @@ -345,6 +354,9 @@ public static JDABuilder createLight(@Nullable String token, @Nonnull GatewayInt *

  • This disables all existing {@link CacheFlag CacheFlags}
  • * * + *

    You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

    If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index 53d0104c38..5c9f4c18b0 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -175,6 +175,9 @@ public static DefaultShardManagerBuilder createDefault(@Nullable String token) *

  • This disables {@link CacheFlag#ACTIVITY} and {@link CacheFlag#CLIENT_STATUS}
  • * * + *

    You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

    If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. @@ -215,6 +218,9 @@ public static DefaultShardManagerBuilder createDefault(@Nullable String token, @ *

  • This disables {@link CacheFlag#ACTIVITY} and {@link CacheFlag#CLIENT_STATUS}
  • * * + *

    You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

    If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. @@ -285,6 +291,9 @@ public static DefaultShardManagerBuilder createLight(@Nullable String token) *

  • This disables all existing {@link CacheFlag CacheFlags}
  • * * + *

    You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

    If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. @@ -322,6 +331,9 @@ public static DefaultShardManagerBuilder createLight(@Nullable String token, @No *

  • This disables all existing {@link CacheFlag CacheFlags}
  • * * + *

    You can omit intents in this method to use {@link GatewayIntent#DEFAULT} and enable additional intents with + * {@link #enableIntents(Collection)}. + * *

    If you don't enable certain intents, the cache will be disabled. * For instance, if the {@link GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent is disabled, then members will only * be cached when a voice state is available. From 648f829365807ff6723e4e77b6a18c1246086abf Mon Sep 17 00:00:00 2001 From: David <47890579+RedstonecraftHD@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:58:16 +0100 Subject: [PATCH 101/121] Fixed Documentation for MessageAction#reference (#1510) --- .../jda/api/requests/restaction/MessageAction.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java index 8ce0d280b2..9b3a642e20 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java @@ -216,10 +216,16 @@ static boolean isDefaultMentionRepliedUser() *
    This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. * *

    This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! + * You cannot reply to system messages such as {@link net.dv8tion.jda.api.entities.MessageType#CHANNEL_PINNED_ADD CHANNEL_PINNED_ADD} and similar. * * @param messageId * The target message * + * @throws IllegalArgumentException + * If the provided ID is null or not a valid snowflake + * @throws UnsupportedOperationException + * If the provided message is from a {@link MessageBuilder} + * * @return Updated MessageAction for chaining convenience */ @Nonnull @@ -232,13 +238,15 @@ static boolean isDefaultMentionRepliedUser() *
    This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. * *

    This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! - * You cannot reply to system messages (such as {@link net.dv8tion.jda.api.entities.MessageType#CHANNEL_PINNED_ADD CHANNEL_PINNED_ADD} and similar). + * You cannot reply to system messages such as {@link net.dv8tion.jda.api.entities.MessageType#CHANNEL_PINNED_ADD CHANNEL_PINNED_ADD} and similar. * * @param messageId * The target message * * @throws IllegalArgumentException * If the provided ID is null or not a valid snowflake + * @throws UnsupportedOperationException + * If the provided message is from a {@link MessageBuilder} * * @return Updated MessageAction for chaining convenience */ @@ -255,6 +263,7 @@ default MessageAction referenceById(@Nonnull String messageId) *
    This will mention the author of the target message. You can disable this through {@link #mentionRepliedUser(boolean)}. * *

    This requires {@link net.dv8tion.jda.api.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY} in the channel! + * You cannot reply to system messages such as {@link net.dv8tion.jda.api.entities.MessageType#CHANNEL_PINNED_ADD CHANNEL_PINNED_ADD} and similar. * * @param message * The target message From b84333d1a43430f40627463f8bbb0c99447e8ecd Mon Sep 17 00:00:00 2001 From: Taucher2003 Date: Sun, 7 Mar 2021 16:09:24 +0100 Subject: [PATCH 102/121] Fixed isSynced() in GuildChannel (#1486) --- .../jda/api/entities/GuildChannel.java | 8 +++++-- .../entities/AbstractChannelImpl.java | 22 +++++++++++++++---- .../jda/internal/entities/EntityBuilder.java | 3 +++ .../internal/handle/ChannelUpdateHandler.java | 21 ++++++++++++++++-- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java index c33c496069..3f4ae3495b 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java @@ -181,11 +181,15 @@ public interface GuildChannel extends ISnowflake, Comparable /** * Whether or not this GuildChannel's {@link net.dv8tion.jda.api.entities.PermissionOverride PermissionOverrides} match - * those of {@link #getParent() its parent category}. If the channel doesn't have a parent category this will return true. - * + * those of {@link #getParent() its parent category}. If the channel doesn't have a parent category, this will return true. + * + *

    This requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#MEMBER_OVERRIDES CacheFlag.MEMBER_OVERRIDES} to be enabled. + *
    {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables this CacheFlag by default. + * * @return True, if this channel is synced with its parent category */ boolean isSynced(); + /** * Creates a copy of the specified {@link GuildChannel GuildChannel} * in the specified {@link net.dv8tion.jda.api.entities.Guild Guild}. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java index 6bc49b2198..36b7638e52 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java @@ -38,7 +38,6 @@ import net.dv8tion.jda.internal.requests.restaction.InviteActionImpl; import net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl; import net.dv8tion.jda.internal.utils.Checks; -import net.dv8tion.jda.internal.utils.Helpers; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -164,10 +163,25 @@ public List getRolePermissionOverrides() @Override public boolean isSynced() { - if (getParent() == null) + AbstractChannelImpl parent = (AbstractChannelImpl) getParent(); // We accept the unchecked cast here + if (parent == null) return true; // Channels without a parent category are always considered synced. Also the case for categories. - - return Helpers.deepEqualsUnordered(getParent().getPermissionOverrides(), getPermissionOverrides()); + TLongObjectMap parentOverrides = parent.getOverrideMap(); + if (parentOverrides.size() != overrides.size()) + return false; + // Check that each override matches with the parent override + for (PermissionOverride override : parentOverrides.valueCollection()) + { + PermissionOverride ourOverride = overrides.get(override.getIdLong()); + if (ourOverride == null) // this means we don't have the parent override => not synced + return false; + // Permissions are different => not synced + if (ourOverride.getAllowedRaw() != override.getAllowedRaw() || ourOverride.getDeniedRaw() != override.getDeniedRaw()) + return false; + } + + // All overrides exist and are the same as the parent => synced + return true; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index f7c5693dfc..839cb3272e 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -1395,6 +1395,9 @@ public PermissionOverride createPermissionOverride(DataObject override, Abstract long allow = override.getLong("allow_new"); long deny = override.getLong("deny_new"); + // Don't cache empty @everyone overrides, they ruin our sync check + if (id == chan.getGuild().getIdLong() && (allow | deny) == 0L) + return null; PermissionOverrideImpl permOverride = (PermissionOverrideImpl) chan.getOverrideMap().get(id); if (permOverride == null) diff --git a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java index 285f913a04..94d32b18ec 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/ChannelUpdateHandler.java @@ -347,6 +347,8 @@ private void addPermissionHolder(List changed, Guild guild, l changed.add(holder); } + // True => override status changed (created/deleted/updated) + // False => nothing changed, ignore private boolean handlePermissionOverride(PermissionOverride currentOverride, DataObject override, long overrideId, AbstractChannelImpl channel) { final long allow = override.getLong("allow_new"); @@ -366,13 +368,25 @@ else if (!api.isCacheFlagSet(CacheFlag.MEMBER_OVERRIDES) && overrideId != api.ge } } - if (currentOverride != null) + if (currentOverride != null) // Permissions were updated? { long oldAllow = currentOverride.getAllowedRaw(); long oldDeny = currentOverride.getDeniedRaw(); PermissionOverrideImpl impl = (PermissionOverrideImpl) currentOverride; if (oldAllow == allow && oldDeny == deny) return false; + + if (overrideId == channel.getGuild().getIdLong() && (allow | deny) == 0L) + { + // We delete empty overrides for the @everyone role because that's what the client also does, otherwise our sync checks don't work! + channel.getOverrideMap().remove(overrideId); + api.handleEvent( + new PermissionOverrideDeleteEvent( + api, responseNumber, + channel, currentOverride)); + return true; + } + impl.setAllow(allow); impl.setDeny(deny); api.handleEvent( @@ -380,8 +394,11 @@ else if (!api.isCacheFlagSet(CacheFlag.MEMBER_OVERRIDES) && overrideId != api.ge api, responseNumber, channel, currentOverride, oldAllow, oldDeny)); } - else + else // New override? { + // Empty @everyone overrides should be treated as not existing at all + if (overrideId == channel.getGuild().getIdLong() && (allow | deny) == 0L) + return false; PermissionOverrideImpl impl; currentOverride = impl = new PermissionOverrideImpl(channel, overrideId, isRole); impl.setAllow(allow); From a01ff2ea6407d4cb3b8a8750dde40f230dc621e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 8 Mar 2021 00:59:39 +0100 Subject: [PATCH 103/121] Remove unnecessary checks for permission values We shouldn't check for unknown enum values And checking the sign for an unsigned int is bad --- .../api/requests/restaction/GuildAction.java | 18 +----------------- .../restaction/PermissionOverrideAction.java | 9 --------- .../api/requests/restaction/RoleAction.java | 2 -- .../requests/restaction/ChannelActionImpl.java | 4 ---- .../PermissionOverrideActionImpl.java | 5 ----- .../requests/restaction/RoleActionImpl.java | 2 -- 6 files changed, 1 insertion(+), 39 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java index 204bf38fbd..3d81d66d7b 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/GuildAction.java @@ -302,19 +302,11 @@ public RoleData(long id) * @param rawPermissions * Raw permission value * - * @throws java.lang.IllegalArgumentException - * If the provided permissions are negative or exceed the maximum permissions - * * @return The current RoleData instance for chaining convenience */ @Nonnull public RoleData setPermissionsRaw(@Nullable Long rawPermissions) { - if (rawPermissions != null) - { - Checks.notNegative(rawPermissions, "Raw Permissions"); - Checks.check(rawPermissions <= Permission.ALL_PERMISSIONS, "Provided permissions may not be greater than a full permission set!"); - } this.permissions = rawPermissions; return this; } @@ -665,11 +657,7 @@ public ChannelData setPosition(@Nullable Integer position) * The permissions to deny in the override * * @throws java.lang.IllegalArgumentException - *

      - *
    • If the provided role is {@code null}
    • - *
    • If the provided allow value is negative or exceeds maximum permissions
    • - *
    • If the provided deny value is negative or exceeds maximum permissions
    • - *
    + * If the provided role is {@code null} * * @return This ChannelData instance for chaining convenience */ @@ -677,10 +665,6 @@ public ChannelData setPosition(@Nullable Integer position) public ChannelData addPermissionOverride(@Nonnull GuildActionImpl.RoleData role, long allow, long deny) { Checks.notNull(role, "Role"); - Checks.notNegative(allow, "Granted permissions value"); - Checks.notNegative(deny, "Denied permissions value"); - Checks.check(allow <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set"); - Checks.check(deny <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set"); this.overrides.add(new PermOverrideData(PermOverrideData.ROLE_TYPE, role.id, allow, deny)); return this; } diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java index 92becb4ae6..af8fda9b36 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java @@ -233,9 +233,6 @@ default EnumSet getInheritedPermissions() * The positive bits representing the granted * permissions for the new PermissionOverride * - * @throws java.lang.IllegalArgumentException - * If the provided bits are negative - * or higher than {@link net.dv8tion.jda.api.Permission#ALL_PERMISSIONS Permission.ALL_PERMISSIONS} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} * on the channel and tries to set permissions it does not have in the channel @@ -391,9 +388,6 @@ default PermissionOverrideAction grant(@Nonnull Permission... permissions) * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} * on the channel and tries to set permissions it does not have in the channel - * @throws java.lang.IllegalArgumentException - * If the provided bits are negative - * or higher than {@link net.dv8tion.jda.api.Permission#ALL_PERMISSIONS Permission.ALL_PERMISSIONS} * * @return The current PermissionOverrideAction - for chaining convenience * @@ -608,9 +602,6 @@ default PermissionOverrideAction clear(@Nonnull Permission... permissions) * An unsigned bitwise representation * of denied Permissions * - * @throws java.lang.IllegalArgumentException - * If any of the provided bits are negative - * or higher than {@link net.dv8tion.jda.api.Permission#ALL_PERMISSIONS Permission.ALL_PERMISSIONS} * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} * on the channel and tries to set permissions it does not have in the channel diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java index fd7d984070..15ddb9e66e 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/RoleAction.java @@ -196,8 +196,6 @@ default RoleAction setPermissions(@Nullable Collection permissions) * The raw {@link net.dv8tion.jda.api.Permission Permissions} value for the new role. * To retrieve this use {@link net.dv8tion.jda.api.Permission#getRawValue()} * - * @throws java.lang.IllegalArgumentException - * If the provided permission value is invalid * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not hold one of the specified permissions * diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java index 321d6a18aa..3908fa155e 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/ChannelActionImpl.java @@ -257,10 +257,6 @@ public ChannelAction syncPermissionOverrides() private ChannelActionImpl addOverride(long targetId, int type, long allow, long deny) { - Checks.notNegative(allow, "Granted permissions value"); - Checks.notNegative(deny, "Denied permissions value"); - Checks.check(allow <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set"); - Checks.check(deny <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set"); Member selfMember = getGuild().getSelfMember(); boolean canSetRoles = selfMember.hasPermission(Permission.ADMINISTRATOR); if (!canSetRoles && parent != null) // You can also set MANAGE_ROLES if you have it on the category (apparently?) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java index fe267b3f07..2236180922 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java @@ -28,7 +28,6 @@ import net.dv8tion.jda.internal.entities.AbstractChannelImpl; import net.dv8tion.jda.internal.entities.PermissionOverrideImpl; import net.dv8tion.jda.internal.requests.Route; -import net.dv8tion.jda.internal.utils.Checks; import net.dv8tion.jda.internal.utils.PermissionUtil; import okhttp3.RequestBody; @@ -187,8 +186,6 @@ public boolean isRole() @CheckReturnValue public PermissionOverrideActionImpl setAllow(long allowBits) { - Checks.notNegative(allowBits, "Granted permissions value"); - Checks.check(allowBits <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set"); checkPermissions(getCurrentAllow() ^ allowBits); this.allow = allowBits; this.deny &= ~allowBits; @@ -201,8 +198,6 @@ public PermissionOverrideActionImpl setAllow(long allowBits) @CheckReturnValue public PermissionOverrideActionImpl setDeny(long denyBits) { - Checks.notNegative(denyBits, "Denied permissions value"); - Checks.check(denyBits <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set"); checkPermissions(getCurrentDeny() ^ denyBits); this.deny = denyBits; this.allow &= ~denyBits; diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java index fe4d55116c..db6ab8aa4e 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/RoleActionImpl.java @@ -127,8 +127,6 @@ public RoleActionImpl setPermissions(Long permissions) { if (permissions != null) { - Checks.notNegative(permissions, "Raw Permissions"); - Checks.check(permissions <= Permission.ALL_PERMISSIONS, "Provided permissions may not be greater than a full permission set!"); for (Permission p : Permission.getPermissions(permissions)) checkPermission(p); } From a106c4b4e0389f7c7274096464378c7ca6ae32a3 Mon Sep 17 00:00:00 2001 From: caneleex Date: Mon, 8 Mar 2021 14:10:10 +0100 Subject: [PATCH 104/121] Add Member#isPending (#1478) This is marked as incubating since the general API design may change in the future --- .../net/dv8tion/jda/api/entities/Member.java | 12 +++ .../update/GuildMemberUpdatePendingEvent.java | 74 +++++++++++++++++++ .../jda/api/hooks/ListenerAdapter.java | 2 + .../jda/api/utils/MemberCachePolicy.java | 11 +++ .../jda/internal/entities/EntityBuilder.java | 17 +++++ .../jda/internal/entities/MemberImpl.java | 13 ++++ 6 files changed, 129 insertions(+) create mode 100644 src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java 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 2c8ef2e83b..4502163a44 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Member.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Member.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.api.entities; +import net.dv8tion.jda.annotations.Incubating; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; @@ -303,6 +304,17 @@ public interface Member extends IMentionable, IPermissionHolder, IFakeable */ boolean isOwner(); + /** + * Checks whether this member has passed the {@link net.dv8tion.jda.api.entities.Guild Guild's} + * Membership Screening requirements. + * + * @incubating Discord is still trying to figure this out + * + * @return True, if this member hasn't passed the guild's Membership Screening requirements + */ + @Incubating + boolean isPending(); + /** * The default {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} for a {@link net.dv8tion.jda.api.entities.Member Member}. *
    This is the channel that the Discord client will default to opening when a Guild is opened for the first time diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java new file mode 100644 index 0000000000..26e8117499 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java @@ -0,0 +1,74 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.guild.member.update; + +import net.dv8tion.jda.annotations.Incubating; +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Member; + +import javax.annotation.Nonnull; + +/** + * Indicates that a {@link Member Member} has agreed to Membership Screening requirements. + * + *

    Can be used to retrieve members who have agreed to Membership Screening requirements. + * + *

    Identifier: {@code pending} + * + *

    Requirements

    + * + *

    This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent to be enabled. + *
    {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and + * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! + * + *

    Additionally, this event also requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. + * + * @incubating Discord is still trying to figure this out + */ +@Incubating +public class GuildMemberUpdatePendingEvent extends GenericGuildMemberUpdateEvent +{ + public static final String IDENTIFIER = "pending"; + + public GuildMemberUpdatePendingEvent(@Nonnull JDA api, long responseNumber, @Nonnull Member member, boolean previous) + { + super(api, responseNumber, member, previous, member.isPending(), IDENTIFIER); + } + + /** + * The old pending status + * + * @return The old pending status + */ + public boolean getOldPending() + { + return getOldValue(); + } + + /** + * The new pending status + * + * @return The new pending status + */ + public boolean getNewPending() + { + return getNewValue(); + } +} diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 6ac21e2119..15b0c9d04f 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -57,6 +57,7 @@ import net.dv8tion.jda.api.events.guild.member.update.GenericGuildMemberUpdateEvent; import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateBoostTimeEvent; import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent; +import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdatePendingEvent; import net.dv8tion.jda.api.events.guild.override.GenericPermissionOverrideEvent; import net.dv8tion.jda.api.events.guild.override.PermissionOverrideCreateEvent; import net.dv8tion.jda.api.events.guild.override.PermissionOverrideDeleteEvent; @@ -315,6 +316,7 @@ public void onGuildMemberRoleRemove(@Nonnull GuildMemberRoleRemoveEvent event) { public void onGuildMemberUpdate(@Nonnull GuildMemberUpdateEvent event) {} public void onGuildMemberUpdateNickname(@Nonnull GuildMemberUpdateNicknameEvent event) {} public void onGuildMemberUpdateBoostTime(@Nonnull GuildMemberUpdateBoostTimeEvent event) {} + public void onGuildMemberUpdatePending(@Nonnull GuildMemberUpdatePendingEvent event) {} //Guild Voice Events public void onGuildVoiceUpdate(@Nonnull GuildVoiceUpdateEvent event) {} diff --git a/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java b/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java index 385a093f9a..8c133b46a5 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java +++ b/src/main/java/net/dv8tion/jda/api/utils/MemberCachePolicy.java @@ -16,6 +16,7 @@ package net.dv8tion.jda.api.utils; +import net.dv8tion.jda.annotations.Incubating; import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.GuildVoiceState; @@ -85,6 +86,16 @@ public interface MemberCachePolicy GuildVoiceState voiceState = member.getVoiceState(); return voiceState != null && voiceState.getChannel() != null; }; + /** + * Caches members who haven't passed Membership Screening. + * + *

    Not recommended without {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent enabled. + * The api will only send the guild member update events when this intent is enabled. Without those events the members will stay in cache indefinitely. + * + * @incubating Discord is still trying to figure this out + */ + @Incubating + MemberCachePolicy PENDING = Member::isPending; /** * The default policy to use with {@link net.dv8tion.jda.api.JDABuilder#createDefault(String)}. *
    This is identical to {@code VOICE.or(OWNER)}. diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index 839cb3272e..decced96a6 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -32,6 +32,7 @@ import net.dv8tion.jda.api.events.guild.member.GuildMemberRoleRemoveEvent; import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateBoostTimeEvent; import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent; +import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdatePendingEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateAvatarEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateDiscriminatorEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateFlagsEvent; @@ -468,6 +469,8 @@ public MemberImpl createMember(GuildImpl guild, DataObject memberJson, DataObjec epoch = Instant.from(date).toEpochMilli(); } member.setBoostDate(epoch); + if (!memberJson.isNull("pending")) + member.setPending(memberJson.getBoolean("pending")); Set roles = member.getRoleSet(); for (int i = 0; i < roleArray.length(); i++) { @@ -580,6 +583,20 @@ public void updateMember(GuildImpl guild, MemberImpl member, DataObject content, member.setJoinDate(joinEpoch); } + if (!content.isNull("pending")) + { + boolean pending = content.getBoolean("pending"); + boolean oldPending = member.isPending(); + if (pending != oldPending) + { + member.setPending(pending); + getJDA().handleEvent( + new GuildMemberUpdatePendingEvent( + getJDA(), responseNumber, + member, oldPending)); + } + } + updateUser((UserImpl) member.getUser(), content.getObject("user")); } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java index 8368990b86..a4c8cea789 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/MemberImpl.java @@ -50,6 +50,7 @@ public class MemberImpl implements Member private long joinDate, boostDate; private List activities = null; private OnlineStatus onlineStatus = OnlineStatus.OFFLINE; + private boolean pending = false; public MemberImpl(GuildImpl guild, User user) { @@ -335,6 +336,12 @@ public boolean isFake() return getGuild().getMemberById(getIdLong()) == null; } + @Override + public boolean isPending() + { + return this.pending; + } + @Override public long getIdLong() { @@ -382,6 +389,12 @@ public MemberImpl setOnlineStatus(OnlineStatus onlineStatus) return this; } + public MemberImpl setPending(boolean pending) + { + this.pending = pending; + return this; + } + public Set getRoleSet() { return roles; From 1f384f5c1fc30ad2468eaad6689486dba1f6bd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 8 Mar 2021 15:27:00 +0100 Subject: [PATCH 105/121] Add UserUpdateActivitiesEvent --- .../update/UserUpdateActivitiesEvent.java | 75 +++++++++++++++++++ .../jda/api/hooks/ListenerAdapter.java | 1 + .../handle/PresenceUpdateHandler.java | 12 ++- 3 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java new file mode 100644 index 0000000000..fb57bd881a --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java @@ -0,0 +1,75 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.user.update; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Activity; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.utils.cache.CacheFlag; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; + +/** + * Indicates that the activities of a guild member changed. + * + *

    This is fired after a sequence of {@link net.dv8tion.jda.api.events.user.UserActivityStartEvent UserActivityStartEvents} and {@link net.dv8tion.jda.api.events.user.UserActivityEndEvent UserActivityEndEvents} + * are fired and can be used to handle the resulting list of activities for the member. + * + *

    Identifier: {@code activities} + * + *

    Requirements

    + * + *

    This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_PRESENCES GUILD_PRESENCES} intent to be enabled. + *
    {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and + * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! + * + *

    Additionally, this event requires the {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the + * member was updated and gives us the updated member object. In order to fire a specific event like this we + * need to have the old member cached to compare against. + * + *

    This also requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ACTIVITY CacheFlag.ACTIVITY} to be enabled. + * You can enable the cache flag with {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) enableCache(CacheFlag.ACTIVITY)}. + */ +public class UserUpdateActivitiesEvent extends GenericUserUpdateEvent> implements GenericUserPresenceEvent +{ + public static final String IDENTIFIER = "activities"; + private final Member member; + + public UserUpdateActivitiesEvent(@Nonnull JDA api, long responseNumber, @Nonnull Member member, @Nullable List previous) + { + super(api, responseNumber, member.getUser(), previous, member.getActivities(), IDENTIFIER); + this.member = member; + } + + @Nonnull + @Override + public Guild getGuild() + { + return member.getGuild(); + } + + @Nonnull + @Override + public Member getMember() + { + return member; + } +} diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 6ac21e2119..e54b106f6b 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -187,6 +187,7 @@ public void onUserUpdateFlags(@Nonnull UserUpdateFlagsEvent event) {} public void onUserTyping(@Nonnull UserTypingEvent event) {} public void onUserActivityStart(@Nonnull UserActivityStartEvent event) {} public void onUserActivityEnd(@Nonnull UserActivityEndEvent event) {} + public void onUserUpdateActivities(@Nonnull UserUpdateActivitiesEvent event) {} //Self Events. Fires only in relation to the currently logged in account. public void onSelfUpdateAvatar(@Nonnull SelfUpdateAvatarEvent event) {} diff --git a/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java index da659e9c5c..fd8d6c82a5 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/PresenceUpdateHandler.java @@ -20,6 +20,7 @@ import net.dv8tion.jda.api.entities.ClientType; import net.dv8tion.jda.api.events.user.UserActivityEndEvent; import net.dv8tion.jda.api.events.user.UserActivityStartEvent; +import net.dv8tion.jda.api.events.user.update.UserUpdateActivitiesEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateActivityOrderEvent; import net.dv8tion.jda.api.events.user.update.UserUpdateOnlineStatusEvent; import net.dv8tion.jda.api.utils.cache.CacheFlag; @@ -192,11 +193,11 @@ private void handleActivities(List newActivities, MemberImpl member) { member.setActivities(newActivities); getJDA().getEntityBuilder().updateMemberCache(member); - oldActivities = new ArrayList<>(oldActivities); // create modifiable copy + List stoppedActivities = new ArrayList<>(oldActivities); // create modifiable copy List startedActivities = new ArrayList<>(); for (Activity activity : newActivities) { - if (!oldActivities.remove(activity)) + if (!stoppedActivities.remove(activity)) startedActivities.add(activity); } @@ -208,13 +209,18 @@ private void handleActivities(List newActivities, MemberImpl member) member, activity)); } - for (Activity activity : oldActivities) + for (Activity activity : stoppedActivities) { getJDA().handleEvent( new UserActivityEndEvent( getJDA(), responseNumber, member, activity)); } + + getJDA().handleEvent( + new UserUpdateActivitiesEvent( + getJDA(), responseNumber, + member, oldActivities)); } } From c7178cff7f280a76f8968370de8c619fb5b9d345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 8 Mar 2021 16:08:03 +0100 Subject: [PATCH 106/121] Load member for typing events in guilds This means the event will work even when members were not cached --- .../jda/api/events/user/UserTypingEvent.java | 10 +++++-- .../internal/handle/TypingStartHandler.java | 29 ++++++++++++------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java index 6fc5b738e2..dbf3c97ae1 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/UserTypingEvent.java @@ -25,6 +25,8 @@ /** * Indicates that a {@link net.dv8tion.jda.api.entities.User User} started typing. (Similar to the typing indicator in the Discord client) * + *

    Requirements

    + * *

    This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MESSAGE_TYPING GUILD_MESSAGE_TYPING} intent to be enabled to fire * for guild channels, and {@link net.dv8tion.jda.api.requests.GatewayIntent#DIRECT_MESSAGE_TYPING DIRECT_MESSAGE_TYPING} to fire for private channels. *
    {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and @@ -34,14 +36,16 @@ */ public class UserTypingEvent extends GenericUserEvent { + private final Member member; private final MessageChannel channel; private final OffsetDateTime timestamp; - public UserTypingEvent(@Nonnull JDA api, long responseNumber, @Nonnull User user, @Nonnull MessageChannel channel, @Nonnull OffsetDateTime timestamp) + public UserTypingEvent(@Nonnull JDA api, long responseNumber, @Nonnull User user, @Nonnull MessageChannel channel, @Nonnull OffsetDateTime timestamp, @Nullable Member member) { super(api, responseNumber, user); this.channel = channel; this.timestamp = timestamp; + this.member = member; } /** @@ -123,7 +127,7 @@ public TextChannel getTextChannel() @Nullable public Guild getGuild() { - return isFromType(ChannelType.TEXT) ? getTextChannel().getGuild() : null; + return isFromType(ChannelType.TEXT) ? member.getGuild() : null; } /** @@ -134,6 +138,6 @@ public Guild getGuild() @Nullable public Member getMember() { - return isFromType(ChannelType.TEXT) ? getGuild().getMember(getUser()) : null; + return member; } } diff --git a/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java index bcb005657e..94d620acd2 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/TypingStartHandler.java @@ -15,12 +15,16 @@ */ package net.dv8tion.jda.internal.handle; +import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.PrivateChannel; import net.dv8tion.jda.api.entities.User; import net.dv8tion.jda.api.events.user.UserTypingEvent; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; +import net.dv8tion.jda.internal.entities.EntityBuilder; +import net.dv8tion.jda.internal.entities.GuildImpl; +import net.dv8tion.jda.internal.entities.MemberImpl; import java.time.Instant; import java.time.OffsetDateTime; @@ -53,19 +57,24 @@ protected Long handleInternally(DataObject content) // because that happen very often and could easily fill up the EventCache if // we, for some reason, never get the channel. Especially in an active channel. -// if (channel instanceof TextChannel) -// { -// final long guildId = ((TextChannel) channel).getGuild().getIdLong(); -// if (getJDA().getGuildSetupController().isLocked(guildId)) -// return guildId; -// } - final long userId = content.getLong("user_id"); User user; + MemberImpl member = null; if (channel instanceof PrivateChannel) user = ((PrivateChannel) channel).getUser(); else user = getJDA().getUsersView().get(userId); + if (!content.isNull("member")) + { + Guild guild = api.getGuildById(content.getUnsignedLong("guild_id")); + if (guild == null) + return null; // Ignore event for unknown guild + // Try to load member for the typing event + EntityBuilder entityBuilder = getJDA().getEntityBuilder(); + member = entityBuilder.createMember((GuildImpl) guild, content.getObject("member")); + entityBuilder.updateMemberCache(member); + user = member.getUser(); + } if (user == null) return null; //Just like in the comment above, if for some reason we don't have the user @@ -73,9 +82,9 @@ protected Long handleInternally(DataObject content) OffsetDateTime timestamp = Instant.ofEpochSecond(content.getInt("timestamp")).atOffset(ZoneOffset.UTC); getJDA().handleEvent( - new UserTypingEvent( - getJDA(), responseNumber, - user, channel, timestamp)); + new UserTypingEvent( + getJDA(), responseNumber, + user, channel, timestamp, member)); return null; } } From 769601e648f3a22183f4d75b9c37920bff61f00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 9 Mar 2021 00:59:16 +0100 Subject: [PATCH 107/121] Implement a timeout for unavailable guilds (#1469) Add GuildTimeoutEvent and some docs --- .../dv8tion/jda/api/events/ReadyEvent.java | 3 +- .../jda/api/events/guild/GuildReadyEvent.java | 7 ++ .../api/events/guild/GuildTimeoutEvent.java | 67 ++++++++++ .../guild/UnavailableGuildJoinedEvent.java | 1 + .../jda/api/hooks/ListenerAdapter.java | 1 + .../internal/handle/GuildSetupController.java | 119 +++++++----------- 6 files changed, 123 insertions(+), 75 deletions(-) create mode 100644 src/main/java/net/dv8tion/jda/api/events/guild/GuildTimeoutEvent.java diff --git a/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java b/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java index 8e48ac6864..e6bfad4e32 100644 --- a/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/ReadyEvent.java @@ -37,7 +37,8 @@ public ReadyEvent(@Nonnull JDA api, long responseNumber) { super(api, responseNumber); this.availableGuilds = (int) getJDA().getGuildCache().size(); - this.unavailableGuilds = ((JDAImpl) getJDA()).getGuildSetupController().getSetupNodes(GuildSetupController.Status.UNAVAILABLE).size(); + GuildSetupController setupController = ((JDAImpl) getJDA()).getGuildSetupController(); + this.unavailableGuilds = setupController.getSetupNodes(GuildSetupController.Status.UNAVAILABLE).size() + setupController.getUnavailableGuilds().size(); } /** diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java index fbd594aff0..006c5aa22b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildReadyEvent.java @@ -18,6 +18,7 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.events.ReadyEvent; import javax.annotation.Nonnull; @@ -29,6 +30,12 @@ * setup and full reconnects (indicated by {@link net.dv8tion.jda.api.events.ReconnectedEvent ReconnectedEvent}). * *

    Can be used to initialize any services that depend on this guild. + * + *

    When a guild fails to ready up due to Discord outages you will not receive this event. + * Guilds that fail to ready up will either timeout or get marked as unavailable. + *
    You can use {@link ReadyEvent#getGuildUnavailableCount()} and {@link JDA#getUnavailableGuilds()} to check for unavailable guilds. + * {@link GuildTimeoutEvent} will be fired for guilds that don't ready up and also don't get marked as unavailable by Discord. + * Guilds that timeout will be marked as unavailable by the timeout event, they will not fire a {@link GuildUnavailableEvent} as that event is only indicating that a guild becomes unavailable after ready happened. */ public class GuildReadyEvent extends GenericGuildEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/GuildTimeoutEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/GuildTimeoutEvent.java new file mode 100644 index 0000000000..3cae6244ce --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/events/guild/GuildTimeoutEvent.java @@ -0,0 +1,67 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.events.guild; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.events.Event; +import net.dv8tion.jda.api.events.ReadyEvent; + +import javax.annotation.Nonnull; + +/** + * Indicates that a guild failed to ready up and timed out. + *
    Usually this event will be fired right before a {@link net.dv8tion.jda.api.events.ReadyEvent ReadyEvent}. + * + *

    This will mark the guild as unavailable and it will not be usable when JDA becomes ready. + * You can check all unavailable guilds with {@link ReadyEvent#getGuildUnavailableCount()} and {@link JDA#getUnavailableGuilds()}. + * + *

    Developer Note

    + * + *

    Discord may also explicitly mark guilds as unavailable during the setup, in which case this event will not fire. + * It is recommended to check for unavailable guilds in the ready event explicitly to avoid any ambiguity. + */ +public class GuildTimeoutEvent extends Event +{ + private final long guildId; + + public GuildTimeoutEvent(@Nonnull JDA api, long guildId) + { + super(api); + this.guildId = guildId; + } + + /** + * The guild id for the timed out guild + * + * @return The guild id + */ + public long getGuildIdLong() + { + return guildId; + } + + /** + * The guild id for the timed out guild + * + * @return The guild id + */ + @Nonnull + public String getGuildId() + { + return Long.toUnsignedString(guildId); + } +} diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java index eb8703108d..0280176e33 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/UnavailableGuildJoinedEvent.java @@ -24,6 +24,7 @@ /** * Indicates that you joined a {@link net.dv8tion.jda.api.entities.Guild Guild} that is not yet available. * This does not extend {@link net.dv8tion.jda.api.events.guild.GenericGuildEvent GenericGuildEvent} + *
    This will be followed by a {@link GuildAvailableEvent} once the guild becomes available again. * *

    Can be used to retrieve id of new unavailable Guild. */ diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 15b0c9d04f..314e92f306 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -268,6 +268,7 @@ public void onPrivateChannelDelete(@Nonnull PrivateChannelDeleteEvent event) {} //Guild Events public void onGuildReady(@Nonnull GuildReadyEvent event) {} + public void onGuildTimeout(@Nonnull GuildTimeoutEvent event) {} public void onGuildJoin(@Nonnull GuildJoinEvent event) {} public void onGuildLeave(@Nonnull GuildLeaveEvent event) {} public void onGuildAvailable(@Nonnull GuildAvailableEvent event) {} diff --git a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java index 184f2d196b..6bf0abee98 100644 --- a/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java +++ b/src/main/java/net/dv8tion/jda/internal/handle/GuildSetupController.java @@ -16,14 +16,12 @@ package net.dv8tion.jda.internal.handle; -import gnu.trove.iterator.TLongLongIterator; import gnu.trove.iterator.TLongObjectIterator; -import gnu.trove.map.TLongLongMap; import gnu.trove.map.TLongObjectMap; -import gnu.trove.map.hash.TLongLongHashMap; import gnu.trove.map.hash.TLongObjectHashMap; import gnu.trove.set.TLongSet; import gnu.trove.set.hash.TLongHashSet; +import net.dv8tion.jda.api.events.guild.GuildTimeoutEvent; import net.dv8tion.jda.api.events.guild.UnavailableGuildLeaveEvent; import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.api.utils.data.DataArray; @@ -35,7 +33,9 @@ import org.slf4j.Logger; import javax.annotation.Nullable; -import java.util.*; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -43,13 +43,14 @@ @SuppressWarnings("WeakerAccess") public class GuildSetupController { - protected static final int CHUNK_TIMEOUT = 10000; protected static final Logger log = JDALogger.getLog(GuildSetupController.class); + private static final long timeoutDuration = 75; // seconds + private static final int timeoutThreshold = 60; // Half of 120 rate limit + private final JDAImpl api; private final TLongObjectMap setupNodes = new TLongObjectHashMap<>(); private final TLongSet chunkingGuilds = new TLongHashSet(); - private final TLongLongMap pendingChunks = new TLongLongHashMap(); private final TLongSet unavailableGuilds = new TLongHashSet(); // TODO: Rewrite this incompleteCount system to just rely on the state of each node @@ -91,7 +92,7 @@ void remove(long id) unavailableGuilds.remove(id); setupNodes.remove(id); chunkingGuilds.remove(id); - synchronized (pendingChunks) { pendingChunks.remove(id); } + checkReady(); } public void ready(long id) @@ -107,21 +108,24 @@ private void checkReady() WebSocketClient client = getJDA().getClient(); // If no guilds are marked as incomplete we can fire a ready if (incompleteCount < 1 && !client.isReady()) + { + if (timeoutHandle != null) + timeoutHandle.cancel(false); + timeoutHandle = null; client.ready(); - else // otherwise see if we can chunk any guilds - tryChunking(); + } + else if (incompleteCount <= timeoutThreshold) + { + startTimeout(); // try to timeout the other guilds + } } public boolean setIncompleteCount(int count) { - log.debug("Setting incomplete count to {}", count); this.incompleteCount = count; - boolean ready = count == 0; - if (ready) - getJDA().getClient().ready(); - else - startTimeout(); - return !ready; + log.debug("Setting incomplete count to {}", incompleteCount); + checkReady(); + return count != 0; } public void onReady(long id, DataObject obj) @@ -191,7 +195,6 @@ public boolean onDelete(long id, DataObject obj) { // Allow other guilds to start chunking chunkingGuilds.remove(id); - synchronized (pendingChunks) { pendingChunks.remove(id); } incompleteCount--; } } @@ -218,10 +221,6 @@ public void onMemberChunk(long id, DataObject chunk) int index = chunk.getInt("chunk_index"); int count = chunk.getInt("chunk_count"); log.debug("Received member chunk for guild id: {} size: {} index: {}/{}", id, members.length(), index, count); - synchronized (pendingChunks) - { - pendingChunks.remove(id); - } GuildSetupNode node = setupNodes.get(id); if (node != null) node.handleMemberChunk(MemberChunkManager.isLastChunk(chunk), members); @@ -286,16 +285,13 @@ public void clearCache() unavailableGuilds.clear(); incompleteCount = 0; close(); - synchronized (pendingChunks) - { - pendingChunks.clear(); - } } public void close() { if (timeoutHandle != null) timeoutHandle.cancel(false); + timeoutHandle = null; } public boolean containsMember(long userId, @Nullable GuildSetupNode excludedNode) @@ -356,21 +352,6 @@ void sendChunkRequest(Object obj) { log.debug("Sending chunking requests for {} guilds", obj instanceof DataArray ? ((DataArray) obj).length() : 1); - long timeout = System.currentTimeMillis() + CHUNK_TIMEOUT; - synchronized (pendingChunks) - { - if (obj instanceof DataArray) - { - DataArray arr = (DataArray) obj; - for (Object o : arr) - pendingChunks.put((long) o, timeout); - } - else - { - pendingChunks.put((long) obj, timeout); - } - } - getJDA().getClient().sendChunkRequest( DataObject.empty() .put("guild_id", obj) @@ -390,7 +371,11 @@ private void tryChunking() private void startTimeout() { - timeoutHandle = getJDA().getGatewayPool().scheduleAtFixedRate(new ChunkTimeout(), CHUNK_TIMEOUT, CHUNK_TIMEOUT, TimeUnit.MILLISECONDS); + if (timeoutHandle != null || incompleteCount < 1) // We don't need to start a timeout for 0 guilds + return; + + log.debug("Starting {} second timeout for {} guilds", timeoutDuration, incompleteCount); + timeoutHandle = getJDA().getGatewayPool().schedule(this::onTimeout, timeoutDuration, TimeUnit.SECONDS); } public void onUnavailable(long id) @@ -399,6 +384,25 @@ public void onUnavailable(long id) log.debug("Guild with id {} is now marked unavailable. Total: {}", id, unavailableGuilds.size()); } + public void onTimeout() + { + if (incompleteCount < 1) + return; + log.warn("Automatically marking {} guilds as unavailable due to timeout!", incompleteCount); + TLongObjectIterator iterator = setupNodes.iterator(); + while (iterator.hasNext()) + { + iterator.advance(); + GuildSetupNode node = iterator.value(); + iterator.remove(); + unavailableGuilds.add(node.getIdLong()); + // Inform users that the guild timed out + getJDA().handleEvent(new GuildTimeoutEvent(getJDA(), node.getIdLong())); + } + incompleteCount = 0; + checkReady(); + } + public enum Status { INIT, @@ -414,37 +418,4 @@ public interface StatusListener { void onStatusChange(long guildId, Status oldStatus, Status newStatus); } - - private class ChunkTimeout implements Runnable - { - @Override - public void run() - { - if (pendingChunks.isEmpty()) - return; - synchronized (pendingChunks) - { - TLongLongIterator it = pendingChunks.iterator(); - List requests = new LinkedList<>(); - DataArray arr = DataArray.empty(); - while (it.hasNext()) - { - // key=guild_id, value=timeout - it.advance(); - if (System.currentTimeMillis() <= it.value()) - continue; - arr.add(it.key()); - - if (arr.length() == 50) - { - requests.add(arr); - arr = DataArray.empty(); - } - } - if (arr.length() > 0) - requests.add(arr); - requests.forEach(GuildSetupController.this::sendChunkRequest); - } - } - } } From 0684d14432bb9cab9079ea83cf15588b5a6dcc24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 9 Mar 2021 16:06:33 +0100 Subject: [PATCH 108/121] Add Guild#retrieveVanityInvite (#1376) Also add another possible error response --- .../net/dv8tion/jda/api/entities/Guild.java | 29 ++++++ .../jda/api/entities/VanityInvite.java | 91 +++++++++++++++++++ .../jda/internal/entities/GuildImpl.java | 11 +++ 3 files changed, 131 insertions(+) create mode 100644 src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java 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 ec3871c6e3..244a21e4d1 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -335,6 +335,9 @@ default String getSplashUrl() * Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: *

      + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#INVITE_CODE_INVALID INVITE_CODE_INVALID} + *
      If this guild does not have a vanity invite
    • + * *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} *
      The vanity url cannot be fetched due to a permission discrepancy
    • *
    @@ -389,6 +392,32 @@ default String getVanityUrl() return getVanityCode() == null ? null : "https://discord.gg/" + getVanityCode(); } + /** + * Retrieves the Vanity Invite meta data for this guild. + *
    This allows you to inspect how many times the vanity invite has been used. + * You can use {@link #getVanityUrl()} if you only care about the invite. + * + *

    This action requires the {@link net.dv8tion.jda.api.Permission#MANAGE_SERVER MANAGE_SERVER} permission. + * + *

    Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by + * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: + *

      + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#INVITE_CODE_INVALID INVITE_CODE_INVALID} + *
      If this guild does not have a vanity invite
    • + * + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
      The vanity invite cannot be fetched due to a permission discrepancy
    • + *
    + * + * @throws InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_SERVER Permission.MANAGE_SERVER} + * + * @return {@link RestAction} - Type: {@link VanityInvite} + */ + @Nonnull + @CheckReturnValue + RestAction retrieveVanityInvite(); + /** * The description for this guild. *
    This is displayed in the server browser below the guild name for verified guilds. diff --git a/src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java b/src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java new file mode 100644 index 0000000000..d20c704786 --- /dev/null +++ b/src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java @@ -0,0 +1,91 @@ +/* + * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.dv8tion.jda.api.entities; + +import javax.annotation.Nonnull; +import java.util.Objects; + +/** + * Meta data for the vanity invite of a guild + */ +public class VanityInvite +{ + private final String code; + private final int uses; + + public VanityInvite(@Nonnull String code, int uses) + { + this.code = code; + this.uses = uses; + } + + /** + * The invite code used for the invite url. + * + * @return The code + */ + @Nonnull + public String getCode() + { + return code; + } + + /** + * How many times this invite has been used. + *
    This is reset after the invite is changed or removed. + * + * @return The invite uses + */ + public int getUses() + { + return uses; + } + + /** + * The invite url. + * + * @return The invite url + */ + @Nonnull + public String getUrl() + { + return "https://discord.gg/" + getCode(); + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!(obj instanceof VanityInvite)) + return false; + VanityInvite other = (VanityInvite) obj; + return uses == other.uses && code.equals(other.code); + } + + @Override + public int hashCode() + { + return Objects.hash(code, uses); + } + + @Override + public String toString() + { + return "VanityInvite(" + code + ")"; + } +} diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 06dc6ff62c..998368519e 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -243,6 +243,17 @@ public String getVanityCode() return vanityCode; } + @Override + @Nonnull + public RestAction retrieveVanityInvite() + { + checkPermission(Permission.MANAGE_SERVER); + JDAImpl api = getJDA(); + Route.CompiledRoute route = Route.Guilds.GET_VANITY_URL.compile(getId()); + return new RestActionImpl<>(api, route, + (response, request) -> new VanityInvite(vanityCode, response.getObject().getInt("uses"))); + } + @Nullable @Override public String getDescription() From 35a2e2c26c9dccd86ce0a8cdb9f9b9cf260286b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Tue, 9 Mar 2021 16:18:00 +0100 Subject: [PATCH 109/121] Add error logging for callbacks in GatewayTask --- .../utils/concurrent/task/GatewayTask.java | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java b/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java index e7ba949eba..3256b9ebb5 100644 --- a/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java +++ b/src/main/java/net/dv8tion/jda/internal/utils/concurrent/task/GatewayTask.java @@ -16,9 +16,12 @@ package net.dv8tion.jda.internal.utils.concurrent.task; +import net.dv8tion.jda.api.exceptions.ContextException; import net.dv8tion.jda.api.utils.concurrent.Task; import net.dv8tion.jda.internal.requests.WebSocketClient; import net.dv8tion.jda.internal.utils.Checks; +import net.dv8tion.jda.internal.utils.JDALogger; +import org.slf4j.Logger; import javax.annotation.Nonnull; import java.util.concurrent.CompletableFuture; @@ -26,10 +29,9 @@ public class GatewayTask implements Task { + private static final Logger log = JDALogger.getLog(Task.class); private final Runnable onCancel; private final CompletableFuture future; - private Consumer success; - private Consumer failure; public GatewayTask(CompletableFuture future, Runnable onCancel) { @@ -48,8 +50,18 @@ public boolean isStarted() public Task onError(@Nonnull Consumer callback) { Checks.notNull(callback, "Callback"); + Consumer failureHandler = ContextException.here((error) -> log.error("Task Failure callback threw error", error)); future.exceptionally(error -> { - callback.accept(error); + try + { + callback.accept(error); + } + catch (Throwable e) + { + failureHandler.accept(e); + if (e instanceof Error) + throw e; + } return null; }); return this; @@ -60,7 +72,19 @@ public Task onError(@Nonnull Consumer callback) public Task onSuccess(@Nonnull Consumer callback) { Checks.notNull(callback, "Callback"); - future.thenAccept(callback); + Consumer failureHandler = ContextException.here((error) -> log.error("Task Success callback threw error", error)); + future.thenAccept(result -> { + try + { + callback.accept(result); + } + catch (Throwable error) + { + failureHandler.accept(error); + if (error instanceof Error) + throw error; + } + }); return this; } From e3015534e3293d8c6422e4813044203317564203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 18 Mar 2021 18:41:39 +0100 Subject: [PATCH 110/121] Set socket timeout before connecting websockets (#1547) --- README.md | 2 +- build.gradle.kts | 2 +- .../java/net/dv8tion/jda/internal/audio/AudioWebSocket.java | 4 ++++ .../net/dv8tion/jda/internal/requests/WebSocketClient.java | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 391e58d98c..8025e8d7b8 100644 --- a/README.md +++ b/README.md @@ -632,7 +632,7 @@ version was by looking at the [release page](https://github.com/DV8FromTheWorld/ This project requires **Java 8+**.
    All dependencies are managed automatically by Gradle. * NV Websocket Client - * Version: **2.9** + * Version: **2.14** * [Github](https://github.com/TakahikoKawasaki/nv-websocket-client) * [JCenter Repository](https://bintray.com/bintray/jcenter/com.neovisionaries%3Anv-websocket-client/view) * OkHttp diff --git a/build.gradle.kts b/build.gradle.kts index ea7ca70c4c..04bce41ee9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -67,7 +67,7 @@ dependencies { api("org.slf4j:slf4j-api:1.7.25") //Web Connection Support - api("com.neovisionaries:nv-websocket-client:2.10") + api("com.neovisionaries:nv-websocket-client:2.14") api("com.squareup.okhttp3:okhttp:3.13.0") //Opus library support 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 1df80ae962..4de7bdc36d 100644 --- a/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java +++ b/src/main/java/net/dv8tion/jda/internal/audio/AudioWebSocket.java @@ -122,6 +122,10 @@ protected void startConnection() { WebSocketFactory socketFactory = new WebSocketFactory(getJDA().getWebSocketFactory()); IOUtil.setServerName(socketFactory, wssEndpoint); + if (socketFactory.getSocketTimeout() > 0) + socketFactory.setSocketTimeout(Math.max(1000, socketFactory.getSocketTimeout())); + else + socketFactory.setSocketTimeout(10000); socket = socketFactory.createSocket(wssEndpoint); socket.setDirectTextMessage(true); socket.addListener(this); diff --git a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java index a79a6f1468..1f4fdcb0fa 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/WebSocketClient.java @@ -366,6 +366,10 @@ protected synchronized void connect() { WebSocketFactory socketFactory = new WebSocketFactory(api.getWebSocketFactory()); IOUtil.setServerName(socketFactory, url); + if (socketFactory.getSocketTimeout() > 0) + socketFactory.setSocketTimeout(Math.max(1000, socketFactory.getSocketTimeout())); + else + socketFactory.setSocketTimeout(10000); socket = socketFactory.createSocket(url); socket.setDirectTextMessage(true); socket.addHeader("Accept-Encoding", "gzip") From db6ba60af6ea8a5b0c6f3114c271eec4636f7a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 21 Mar 2021 01:01:58 +0100 Subject: [PATCH 111/121] Improve some logging for large rate limits (#1533) --- .../requests/ratelimit/BotRateLimiter.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java index eb24579562..ffb01c2bea 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/ratelimit/BotRateLimiter.java @@ -266,11 +266,12 @@ else if (cloudflare) // Handle hard rate limit, pretty much just log that it happened else { - boolean firstHit = hitRatelimit.add(baseRoute); + boolean firstHit = hitRatelimit.add(baseRoute) && retryAfter < 60000; // Update the bucket to the new information bucket.remaining = 0; bucket.reset = getNow() + retryAfter; // don't log warning if we hit the rate limit for the first time, likely due to initialization of the bucket + // unless its a long retry-after delay (more than a minute) if (firstHit) log.debug("Encountered 429 on route {} with bucket {} Retry-After: {} ms", baseRoute, bucket.bucketId, retryAfter); else @@ -377,6 +378,11 @@ public void retry(Request request) requests.addFirst(request); } + private boolean isGlobalRateLimit() + { + return requester.getJDA().getSessionController().getGlobalRatelimit() > getNow(); + } + public long getRateLimit() { long now = getNow(); @@ -440,7 +446,11 @@ public void run() if (rateLimit > 0L) { // We need to backoff since we ran out of remaining uses or hit the global rate limit - log.debug("Backing off {} ms for bucket {}", rateLimit, bucketId); + Request request = requests.peekFirst(); // this *should* not be null + String baseRoute = request != null ? request.getRoute().getBaseRoute().toString() : "N/A"; + if (!isGlobalRateLimit() && rateLimit >= 1000 * 60 * 30) // 30 minutes + log.warn("Encountered long {} minutes Rate-Limit on route {}", TimeUnit.MILLISECONDS.toMinutes(rateLimit), baseRoute); + log.debug("Backing off {} ms for bucket {} on route {}", rateLimit, bucketId, baseRoute); break; } From f134511c7bfd00dc62b66ad34eaad3f999a7ac4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 21 Mar 2021 20:55:05 +0100 Subject: [PATCH 112/121] Add findMembersWithRoles (#1349) --- .../net/dv8tion/jda/api/entities/Guild.java | 69 +++++++++++++++++++ .../jda/internal/entities/GuildImpl.java | 4 ++ .../internal/requests/MemberChunkManager.java | 13 +++- 3 files changed, 84 insertions(+), 2 deletions(-) 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 244a21e4d1..115b03d2cb 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -977,6 +977,8 @@ default List getMembersByEffectiveName(@Nonnull String name, boolean ign * If a provided {@link net.dv8tion.jda.api.entities.Role Role} is from a different guild or null. * * @return Possibly-empty immutable list of Members with all provided Roles. + * + * @see #findMembersWithRoles(Role...) */ @Nonnull default List getMembersWithRoles(@Nonnull Role... roles) @@ -999,6 +1001,8 @@ default List getMembersWithRoles(@Nonnull Role... roles) * If a provided {@link net.dv8tion.jda.api.entities.Role Role} is from a different guild or null. * * @return Possibly-empty immutable list of Members with all provided Roles. + * + * @see #findMembersWithRoles(Collection) */ @Nonnull default List getMembersWithRoles(@Nonnull Collection roles) @@ -2460,6 +2464,71 @@ default Task> findMembers(@Nonnull Predicate filter return task; } + /** + * Retrieves and collects members of this guild into a list. + *
    This will use the configured {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to decide which members to retain in cache. + * + *

    This requires the privileged GatewayIntent.GUILD_MEMBERS to be enabled! + * + *

    You MUST NOT use blocking operations such as {@link Task#get()}! + * The response handling happens on the event thread by default. + * + * @param roles + * Collection of all roles the members must have + * + * @throws IllegalArgumentException + * If null is provided + * @throws IllegalStateException + * If the {@link GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is not enabled + * + * @return {@link Task} - Type: {@link List} of {@link Member} + */ + @Nonnull + @CheckReturnValue + default Task> findMembersWithRoles(@Nonnull Collection roles) + { + Checks.noneNull(roles, "Roles"); + for (Role role : roles) + Checks.check(this.equals(role.getGuild()), "All roles must be from the same guild!"); + + if (isLoaded() || roles.isEmpty() || roles.contains(getPublicRole())) // Member#getRoles never contains the public role + { + CompletableFuture> future = CompletableFuture.completedFuture(getMembersWithRoles(roles)); + return new GatewayTask<>(future, () -> {}); + } + + return findMembers(member -> member.getRoles().containsAll(roles)); + } + + /** + * Retrieves and collects members of this guild into a list. + *
    This will use the configured {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} + * to decide which members to retain in cache. + * + *

    This requires the privileged GatewayIntent.GUILD_MEMBERS to be enabled! + * + *

    You MUST NOT use blocking operations such as {@link Task#get()}! + * The response handling happens on the event thread by default. + * + * @param roles + * All roles the members must have + * + * @throws IllegalArgumentException + * If null is provided + * @throws IllegalStateException + * If the {@link GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is not enabled + * + * @return {@link Task} - Type: {@link List} of {@link Member} + */ + @Nonnull + @CheckReturnValue + default Task> findMembersWithRoles(@Nonnull Role... roles) + { + Checks.noneNull(roles, "Roles"); + return findMembersWithRoles(Arrays.asList(roles)); + } + /** * Retrieves all members of this guild. *
    This will use the configured {@link net.dv8tion.jda.api.utils.MemberCachePolicy MemberCachePolicy} diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 998368519e..4424cc5741 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -885,6 +885,10 @@ public Task loadMembers(@Nonnull Consumer callback) MemberChunkManager chunkManager = getJDA().getClient().getChunkManager(); boolean includePresences = getJDA().isIntent(GatewayIntent.GUILD_PRESENCES); CompletableFuture handler = chunkManager.chunkGuild(this, includePresences, (last, list) -> list.forEach(callback)); + handler.exceptionally(ex -> { + WebSocketClient.LOG.error("Encountered exception trying to handle member chunk response", ex); + return null; + }); return new GatewayTask<>(handler, () -> handler.cancel(false)); } diff --git a/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java b/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java index 7453ef8164..5f1aae2c8a 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/MemberChunkManager.java @@ -210,8 +210,17 @@ private List toMembers(DataObject chunk) public void handleChunk(boolean last, DataObject chunk) { - if (!isCancelled()) - handler.accept(last, toMembers(chunk)); + try + { + if (!isDone()) + handler.accept(last, toMembers(chunk)); + } + catch (Throwable ex) + { + completeExceptionally(ex); + if (ex instanceof Error) + throw (Error) ex; + } } @Override From 74281e9df37f3bcf23565340b8184ac74daa4f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 22 Mar 2021 12:42:55 +0100 Subject: [PATCH 113/121] Remove thread-safe acquisition of managers (#1549) This means getManager() is not thread-safe anymore You can synchronize the object you call getManager on if you need --- .../net/dv8tion/jda/api/entities/Emote.java | 3 +++ .../net/dv8tion/jda/api/entities/Guild.java | 3 +++ .../jda/api/entities/GuildChannel.java | 3 +++ .../jda/api/entities/PermissionOverride.java | 3 +++ .../net/dv8tion/jda/api/entities/Role.java | 3 +++ .../dv8tion/jda/api/entities/SelfUser.java | 3 +++ .../net/dv8tion/jda/api/entities/Webhook.java | 3 +++ .../entities/AbstractChannelImpl.java | 18 +++---------- .../jda/internal/entities/EmoteImpl.java | 24 +++--------------- .../jda/internal/entities/EntityBuilder.java | 6 ++--- .../jda/internal/entities/GuildImpl.java | 25 ++++++------------- .../entities/PermissionOverrideImpl.java | 19 +++----------- .../jda/internal/entities/RoleImpl.java | 19 +++----------- .../jda/internal/entities/SelfUserImpl.java | 19 +++----------- .../jda/internal/entities/WebhookImpl.java | 20 +++------------ 15 files changed, 55 insertions(+), 116 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/Emote.java b/src/main/java/net/dv8tion/jda/api/entities/Emote.java index 9eed3f9249..8aca1e0ef5 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Emote.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Emote.java @@ -181,6 +181,9 @@ default boolean hasRoles() * properties of the emote like name and role restrictions. *
    You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * + *

    This is a lazy idempotent getter. The manager is retained after the first call. + * This getter is not thread-safe and would require guards by the user. + * * @throws IllegalStateException * if this emote is created from a message or the bot does not have access to the emote * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException 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 115b03d2cb..b01e6f773b 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -2135,6 +2135,9 @@ default RestAction retrieveBan(@Nonnull User bannedUser) * all properties and settings of the Guild. *
    You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * + *

    This is a lazy idempotent getter. The manager is retained after the first call. + * This getter is not thread-safe and would require guards by the user. + * * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_SERVER Permission.MANAGE_SERVER} * diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java index 3f4ae3495b..da17db1957 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java @@ -270,6 +270,9 @@ default ChannelAction createCopy() *
    In the ChannelManager, you can modify the name, topic and position of this GuildChannel. * You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * + *

    This is a lazy idempotent getter. The manager is retained after the first call. + * This getter is not thread-safe and would require guards by the user. + * * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_CHANNEL Permission.MANAGE_CHANNEL} * diff --git a/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java b/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java index be42dc7fd7..4ed90d17f1 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java +++ b/src/main/java/net/dv8tion/jda/api/entities/PermissionOverride.java @@ -176,6 +176,9 @@ public interface PermissionOverride extends ISnowflake *
    In the PermissionOverrideAction you can modify the permissions of the override. * You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * + *

    This is a lazy idempotent getter. The manager is retained after the first call. + * This getter is not thread-safe and would require guards by the user. + * * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_PERMISSIONS Permission.MANAGE_PERMISSIONS} * diff --git a/src/main/java/net/dv8tion/jda/api/entities/Role.java b/src/main/java/net/dv8tion/jda/api/entities/Role.java index bddae941cb..45226ed4bc 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Role.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Role.java @@ -228,6 +228,9 @@ default RoleAction createCopy() * In the RoleManager, you can modify all its values. *
    You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * + *

    This is a lazy idempotent getter. The manager is retained after the first call. + * This getter is not thread-safe and would require guards by the user. + * * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_ROLES Permission.MANAGE_ROLES} * @throws net.dv8tion.jda.api.exceptions.HierarchyException diff --git a/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java b/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java index 25b2c45341..016c305f7d 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java +++ b/src/main/java/net/dv8tion/jda/api/entities/SelfUser.java @@ -147,6 +147,9 @@ default String getPhoneNumber() *
    This can be used to atomically set account fields (like avatar/username) * You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * + *

    This is a lazy idempotent getter. The manager is retained after the first call. + * This getter is not thread-safe and would require guards by the user. + * * @return An AccountManager instance for the current account */ @Nonnull diff --git a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java index 4b8b6748b5..1a40f94cc6 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java @@ -207,6 +207,9 @@ public interface Webhook extends ISnowflake, IFakeable * The {@link WebhookManager WebhookManager} for this Webhook. *
    You can modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.api.requests.RestAction#queue() RestAction.queue()}. * + *

    This is a lazy idempotent getter. The manager is retained after the first call. + * This getter is not thread-safe and would require guards by the user. + * * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have {@link net.dv8tion.jda.api.Permission#MANAGE_WEBHOOKS Permission.MANAGE_WEBHOOKS} * diff --git a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java index 36b7638e52..259bdcb0a3 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/AbstractChannelImpl.java @@ -44,7 +44,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; public abstract class AbstractChannelImpl> implements GuildChannel @@ -54,8 +53,7 @@ public abstract class AbstractChannelImpl overrides = MiscUtil.newLongMap(); - protected final ReentrantLock mngLock = new ReentrantLock(); - protected volatile ChannelManager manager; + protected ChannelManager manager; protected GuildImpl guild; protected long parentId; @@ -188,17 +186,9 @@ public boolean isSynced() @Override public ChannelManager getManager() { - ChannelManager mng = manager; - if (mng == null) - { - mng = MiscUtil.locked(mngLock, () -> - { - if (manager == null) - manager = new ChannelManagerImpl(this); - return manager; - }); - } - return mng; + if (manager == null) + return manager = new ChannelManagerImpl(this); + return manager; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java index 910fc33503..37edb37fee 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EmoteImpl.java @@ -23,7 +23,6 @@ import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; import net.dv8tion.jda.api.managers.EmoteManager; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; -import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.managers.EmoteManagerImpl; import net.dv8tion.jda.internal.requests.Route; @@ -35,7 +34,6 @@ import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.locks.ReentrantLock; /** * Represents a Custom Emote. (Emoji in official Discord API terminology) @@ -48,8 +46,7 @@ public class EmoteImpl implements ListedEmote private final JDAImpl api; private final Set roles; - private final ReentrantLock mngLock = new ReentrantLock(); - private volatile EmoteManager manager = null; + private EmoteManager manager; private GuildImpl guild; private boolean managed = false; @@ -59,11 +56,6 @@ public class EmoteImpl implements ListedEmote private User user; public EmoteImpl(long id, GuildImpl guild) - { - this(id, guild, false); - } - - public EmoteImpl(long id, GuildImpl guild, boolean fake) { this.id = id; this.api = guild.getJDA(); @@ -163,17 +155,9 @@ public boolean hasUser() @Override public EmoteManager getManager() { - EmoteManager m = manager; - if (m == null) - { - m = MiscUtil.locked(mngLock, () -> - { - if (manager == null) - manager = new EmoteManagerImpl(this); - return manager; - }); - } - return m; + if (manager == null) + return manager = new EmoteManagerImpl(this); + return manager; } @Override diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index decced96a6..b66765fd04 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -144,7 +144,7 @@ private void createGuildEmotePass(GuildImpl guildObj, DataArray array) continue; } final long emoteId = object.getLong("id"); - emoteMap.put(emoteId, createEmote(guildObj, object, false)); + emoteMap.put(emoteId, createEmote(guildObj, object)); } } } @@ -781,14 +781,14 @@ public static Activity createActivity(DataObject gameJson) largeImageKey, largeImageText, smallImageKey, smallImageText); } - public EmoteImpl createEmote(GuildImpl guildObj, DataObject json, boolean fake) + public EmoteImpl createEmote(GuildImpl guildObj, DataObject json) { DataArray emoteRoles = json.optArray("roles").orElseGet(DataArray::empty); final long emoteId = json.getLong("id"); final User user = json.isNull("user") ? null : createUser(json.getObject("user")); EmoteImpl emoteObj = (EmoteImpl) guildObj.getEmoteById(emoteId); if (emoteObj == null) - emoteObj = new EmoteImpl(emoteId, guildObj, fake); + emoteObj = new EmoteImpl(emoteId, guildObj); Set roleSet = emoteObj.getRoleSet(); roleSet.clear(); diff --git a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java index 4424cc5741..de1a0570ad 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/GuildImpl.java @@ -35,7 +35,6 @@ import net.dv8tion.jda.api.requests.restaction.order.ChannelOrderAction; import net.dv8tion.jda.api.requests.restaction.order.RoleOrderAction; import net.dv8tion.jda.api.requests.restaction.pagination.AuditLogPaginationAction; -import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.api.utils.cache.MemberCacheView; import net.dv8tion.jda.api.utils.cache.SnowflakeCacheView; import net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView; @@ -68,7 +67,6 @@ import java.time.temporal.ChronoUnit; import java.util.*; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -87,8 +85,7 @@ public class GuildImpl implements Guild private final SnowflakeCacheViewImpl emoteCache = new SnowflakeCacheViewImpl<>(Emote.class, Emote::getName); private final MemberCacheViewImpl memberCache = new MemberCacheViewImpl(); - private final ReentrantLock mngLock = new ReentrantLock(); - private volatile GuildManager manager; + private GuildManager manager; private Member owner; private String name; @@ -559,7 +556,7 @@ public RestAction> retrieveEmotes() for (int i = 0; i < emotes.length(); i++) { DataObject emote = emotes.getObject(i); - list.add(builder.createEmote(GuildImpl.this, emote, true)); + list.add(builder.createEmote(GuildImpl.this, emote)); } return Collections.unmodifiableList(list); @@ -588,7 +585,7 @@ public RestAction retrieveEmoteById(@Nonnull String id) return new AuditableRestActionImpl<>(jda, route, (response, request) -> { EntityBuilder builder = GuildImpl.this.getJDA().getEntityBuilder(); - return builder.createEmote(GuildImpl.this, response.getObject(), true); + return builder.createEmote(GuildImpl.this, response.getObject()); }); }); } @@ -671,17 +668,9 @@ public TextChannel getDefaultChannel() @Override public GuildManager getManager() { - GuildManager mng = manager; - if (mng == null) - { - mng = MiscUtil.locked(mngLock, () -> - { - if (manager == null) - manager = new GuildManagerImpl(this); - return manager; - }); - } - return mng; + if (manager == null) + return manager = new GuildManagerImpl(this); + return manager; } @Nonnull @@ -1429,7 +1418,7 @@ public AuditableRestAction createEmote(@Nonnull String name, @Nonnull Ico return new AuditableRestActionImpl<>(jda, route, body, (response, request) -> { DataObject obj = response.getObject(); - return jda.getEntityBuilder().createEmote(this, obj, true); + return jda.getEntityBuilder().createEmote(this, obj); }); } diff --git a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java index 0a592c4c98..22ed8e3ecd 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/PermissionOverrideImpl.java @@ -23,7 +23,6 @@ import net.dv8tion.jda.api.exceptions.MissingAccessException; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction; -import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.requests.Route; import net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl; @@ -32,7 +31,6 @@ import javax.annotation.Nonnull; import java.util.EnumSet; import java.util.Objects; -import java.util.concurrent.locks.ReentrantLock; public class PermissionOverrideImpl implements PermissionOverride { @@ -41,8 +39,7 @@ public class PermissionOverrideImpl implements PermissionOverride private final JDAImpl api; private GuildChannel channel; - protected final ReentrantLock mngLock = new ReentrantLock(); - protected volatile PermissionOverrideAction manager; + protected PermissionOverrideAction manager; private long allow; private long deny; @@ -160,17 +157,9 @@ public PermissionOverrideAction getManager() throw new MissingAccessException(channel, Permission.VOICE_CONNECT); if (!selfMember.hasPermission(channel, Permission.MANAGE_PERMISSIONS)) throw new InsufficientPermissionException(channel, Permission.MANAGE_PERMISSIONS); - PermissionOverrideAction mng = manager; - if (mng == null) - { - mng = MiscUtil.locked(mngLock, () -> - { - if (manager == null) - manager = new PermissionOverrideActionImpl(this).setOverride(false); - return manager; - }); - } - return mng.reset(); + if (manager == null) + return manager = new PermissionOverrideActionImpl(this).setOverride(false); + return manager; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java index 6bd04fab40..849ee47d04 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/RoleImpl.java @@ -28,7 +28,6 @@ import net.dv8tion.jda.api.managers.RoleManager; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; import net.dv8tion.jda.api.requests.restaction.RoleAction; -import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.api.utils.cache.CacheFlag; import net.dv8tion.jda.api.utils.data.DataObject; import net.dv8tion.jda.internal.JDAImpl; @@ -45,7 +44,6 @@ import java.util.Collection; import java.util.EnumSet; import java.util.Objects; -import java.util.concurrent.locks.ReentrantLock; public class RoleImpl implements Role { @@ -53,8 +51,7 @@ public class RoleImpl implements Role private final JDAImpl api; private Guild guild; - private final ReentrantLock mngLock = new ReentrantLock(); - private volatile RoleManager manager; + private RoleManager manager; private RoleTagsImpl tags; private String name; @@ -298,17 +295,9 @@ public RoleAction createCopy(@Nonnull Guild guild) @Override public RoleManager getManager() { - RoleManager mng = manager; - if (mng == null) - { - mng = MiscUtil.locked(mngLock, () -> - { - if (manager == null) - manager = new RoleManagerImpl(this); - return manager; - }); - } - return mng; + if (manager == null) + return manager = new RoleManagerImpl(this); + return manager; } @Nonnull diff --git a/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java index 28e62f3346..cc2223fd5a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/SelfUserImpl.java @@ -20,17 +20,14 @@ import net.dv8tion.jda.api.entities.SelfUser; import net.dv8tion.jda.api.managers.AccountManager; import net.dv8tion.jda.api.requests.RestAction; -import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.JDAImpl; import net.dv8tion.jda.internal.managers.AccountManagerImpl; import javax.annotation.Nonnull; -import java.util.concurrent.locks.ReentrantLock; public class SelfUserImpl extends UserImpl implements SelfUser { - protected final ReentrantLock mngLock = new ReentrantLock(); - protected volatile AccountManager manager; + protected AccountManager manager; private boolean verified; private boolean mfaEnabled; @@ -90,17 +87,9 @@ public long getAllowedFileSize() @Override public AccountManager getManager() { - AccountManager mng = manager; - if (mng == null) - { - mng = MiscUtil.locked(mngLock, () -> - { - if (manager == null) - manager = new AccountManagerImpl(this); - return manager; - }); - } - return mng; + if (manager == null) + return manager = new AccountManagerImpl(this); + return manager; } public SelfUserImpl setVerified(boolean verified) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java index ea558b3aaa..d3ffdf2d6a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java @@ -22,7 +22,6 @@ import net.dv8tion.jda.api.exceptions.InsufficientPermissionException; import net.dv8tion.jda.api.managers.WebhookManager; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; -import net.dv8tion.jda.api.utils.MiscUtil; import net.dv8tion.jda.internal.managers.WebhookManagerImpl; import net.dv8tion.jda.internal.requests.Requester; import net.dv8tion.jda.internal.requests.Route; @@ -30,7 +29,6 @@ import net.dv8tion.jda.internal.utils.Checks; import javax.annotation.Nonnull; -import java.util.concurrent.locks.ReentrantLock; /** * The implementation for {@link net.dv8tion.jda.api.entities.Webhook Webhook} @@ -39,12 +37,10 @@ */ public class WebhookImpl implements Webhook { - protected volatile WebhookManager manager = null; - - private final ReentrantLock mngLock = new ReentrantLock(); private final TextChannel channel; private final long id; private final WebhookType type; + private WebhookManager manager; private Member owner; private User user; @@ -145,17 +141,9 @@ public AuditableRestAction delete(@Nonnull String token) @Override public WebhookManager getManager() { - WebhookManager mng = manager; - if (mng == null) - { - mng = MiscUtil.locked(mngLock, () -> - { - if (manager == null) - manager = new WebhookManagerImpl(this); - return manager; - }); - } - return mng; + if (manager == null) + return manager = new WebhookManagerImpl(this); + return manager; } @Override From 0fee1dd58b63b0d5c70e6ab3a7b3a64e9d6ec6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Mon, 22 Mar 2021 22:43:12 +0100 Subject: [PATCH 114/121] Implement TextChannel#follow and add source references (#1418) --- .../dv8tion/jda/api/entities/TextChannel.java | 105 +++++++++++ .../net/dv8tion/jda/api/entities/Webhook.java | 170 ++++++++++++++++++ .../jda/api/requests/ErrorResponse.java | 1 + .../jda/internal/entities/EntityBuilder.java | 27 ++- .../internal/entities/TextChannelImpl.java | 15 ++ .../jda/internal/entities/WebhookImpl.java | 60 ++++++- .../dv8tion/jda/internal/requests/Route.java | 1 + 7 files changed, 371 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java index edb1df2ee7..da7c1474ee 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java @@ -140,6 +140,9 @@ public interface TextChannel extends GuildChannel, MessageChannel, IMentionable * *

  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} *
    The {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL VIEW_CHANNEL} permission was removed
  • + * + *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MAX_WEBHOOKS MAX_WEBHOOKS} + *
    If the channel already has reached the maximum capacity for webhooks
  • * * * @param name @@ -158,6 +161,108 @@ public interface TextChannel extends GuildChannel, MessageChannel, IMentionable @CheckReturnValue WebhookAction createWebhook(@Nonnull String name); + /** + * Subscribes to the crossposted messages in this channel. + *
    This will create a {@link Webhook} of type {@link WebhookType#FOLLOWER FOLLOWER} in the target channel. + * + *

    Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} include: + *

      + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} + *
      If the target channel doesn't exist or is not visible to the currently logged in account
    • + * + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
      If the currently logged in account does not have {@link Permission#MANAGE_WEBHOOKS} in the target channel
    • + * + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MAX_WEBHOOKS MAX_WEBHOOKS} + *
      If the target channel already has reached the maximum capacity for webhooks
    • + *
    + * + * @param targetChannelId + * The target channel id + * + * @throws IllegalArgumentException + * If null is provided + * @throws IllegalStateException + * If this is not a news channels (See {@link #isNews()}) + * + * @return {@link RestAction} + */ + @Nonnull + @CheckReturnValue + RestAction follow(@Nonnull String targetChannelId); + + /** + * Subscribes to the crossposted messages in this channel. + *
    This will create a {@link Webhook} of type {@link WebhookType#FOLLOWER FOLLOWER} in the target channel. + * + *

    Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} include: + *

      + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} + *
      If the target channel doesn't exist or not visible to the currently logged in account
    • + * + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
      If the currently logged in account does not have {@link Permission#MANAGE_WEBHOOKS} in the target channel
    • + * + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MAX_WEBHOOKS MAX_WEBHOOKS} + *
      If the target channel already has reached the maximum capacity for webhooks
    • + *
    + * + * @param targetChannelId + * The target channel id + * + * @throws IllegalStateException + * If this is not a news channels (See {@link #isNews()}) + * + * @return {@link RestAction} + */ + @Nonnull + @CheckReturnValue + default RestAction follow(long targetChannelId) + { + return follow(Long.toUnsignedString(targetChannelId)); + } + + /** + * Subscribes to the crossposted messages in this channel. + *
    This will create a {@link Webhook} of type {@link WebhookType#FOLLOWER FOLLOWER} in the target channel. + * + *

    Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} include: + *

      + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} + *
      If the target channel doesn't exist or not visible to the currently logged in account
    • + * + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} + *
      If the currently logged in account does not have {@link Permission#MANAGE_WEBHOOKS} in the target channel
    • + * + *
    • {@link net.dv8tion.jda.api.requests.ErrorResponse#MAX_WEBHOOKS MAX_WEBHOOKS} + *
      If the target channel already has reached the maximum capacity for webhooks
    • + *
    + * + * @param targetChannel + * The target channel + * + * @throws InsufficientPermissionException + * If the currently logged in account does not have {@link Permission#MANAGE_WEBHOOKS} in the target channel. + * @throws IllegalArgumentException + * If null is provided + * @throws IllegalStateException + * If this is not a news channels (See {@link #isNews()}) + * + * @return {@link RestAction} + */ + @Nonnull + @CheckReturnValue + default RestAction follow(@Nonnull TextChannel targetChannel) + { + Checks.notNull(targetChannel, "Target Channel"); + Member selfMember = targetChannel.getGuild().getSelfMember(); + if (!selfMember.hasAccess(targetChannel)) + throw new MissingAccessException(targetChannel, Permission.VIEW_CHANNEL); + if (!selfMember.hasPermission(targetChannel, Permission.MANAGE_WEBHOOKS)) + throw new InsufficientPermissionException(targetChannel, Permission.MANAGE_WEBHOOKS); + return follow(targetChannel.getId()); + } + /** * Bulk deletes a list of messages. * This is not the same as calling {@link net.dv8tion.jda.api.entities.Message#delete()} in a loop. diff --git a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java index 1a40f94cc6..e01ad212d0 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Webhook.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Webhook.java @@ -18,7 +18,10 @@ import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.managers.WebhookManager; +import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.AuditableRestAction; +import net.dv8tion.jda.internal.requests.RestActionImpl; +import net.dv8tion.jda.internal.requests.Route; import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; @@ -52,11 +55,22 @@ public interface Webhook extends ISnowflake, IFakeable @Nonnull WebhookType getType(); + /** + * Whether this webhook cannot provide {@link #getChannel()} and {@link #getGuild()}. + *
    This means that the webhook is not local to this shard's cache and cannot provide full channel/guild references. + * + * @return True, if {@link #getChannel()} and {@link #getGuild()} would throw + */ + boolean isPartial(); + /** * The {@link net.dv8tion.jda.api.entities.Guild Guild} instance * for this Webhook. *
    This is a shortcut for {@link #getChannel()}.getGuild(). * + * @throws IllegalStateException + * If this webhooks {@link #isPartial() is partial} + * * @return The current Guild of this Webhook */ @Nonnull @@ -66,6 +80,9 @@ public interface Webhook extends ISnowflake, IFakeable * The {@link net.dv8tion.jda.api.entities.TextChannel TextChannel} instance * this Webhook is attached to. * + * @throws IllegalStateException + * If this webhooks {@link #isPartial() is partial} + * * @return The current TextChannel of this Webhook */ @Nonnull @@ -73,6 +90,7 @@ public interface Webhook extends ISnowflake, IFakeable /** * The owner of this Webhook. This will be null for some Webhooks, such as those retrieved from Audit Logs. + *
    This requires the member to be cached. You can use {@link #getOwnerAsUser()} to get a reference to the user instead. * * @return Possibly-null {@link net.dv8tion.jda.api.entities.Member Member} instance * representing the owner of this Webhook. @@ -80,6 +98,16 @@ public interface Webhook extends ISnowflake, IFakeable @Nullable Member getOwner(); + /** + * The owner of this Webhook. This will be null for some Webhooks, such as those retrieved from Audit Logs. + *
    This can be non-null even when {@link #getOwner()} is null. {@link #getOwner()} requires the webhook to be local to this shard and in cache. + * + * @return Possibly-null {@link net.dv8tion.jda.api.entities.User User} instance + * representing the owner of this Webhook. + */ + @Nullable + User getOwnerAsUser(); + /** * The default User for this Webhook. * @@ -142,6 +170,22 @@ public interface Webhook extends ISnowflake, IFakeable @Nonnull String getUrl(); + /** + * The source channel for a Webhook of type {@link WebhookType#FOLLOWER FOLLOWER}. + * + * @return {@link ChannelReference} + */ + @Nullable + ChannelReference getSourceChannel(); + + /** + * The source guild for a Webhook of type {@link WebhookType#FOLLOWER FOLLOWER}. + * + * @return {@link GuildReference} + */ + @Nullable + GuildReference getSourceGuild(); + /** * Deletes this Webhook. * @@ -217,4 +261,130 @@ public interface Webhook extends ISnowflake, IFakeable */ @Nonnull WebhookManager getManager(); + + /** + * Partial Webhook which can be {@link #resolve() resolved} to a {@link Webhook}. + * + * @see #resolve() + */ + class WebhookReference implements ISnowflake + { + private final JDA api; + private final long webhookId, channelId; + + public WebhookReference(JDA api, long webhookId, long channelId) + { + this.api = api; + this.webhookId = webhookId; + this.channelId = channelId; + } + + @Override + public long getIdLong() + { + return webhookId; + } + + /** + * The ID for the channel this webhook belongs to + * + * @return The ID for the channel this webhook belongs to + */ + @Nonnull + public String getChannelId() + { + return Long.toUnsignedString(channelId); + } + + /** + * The ID for the channel this webhook belongs to + * + * @return The ID for the channel this webhook belongs to + */ + public long getChannelIdLong() + { + return channelId; + } + + /** + * Resolves this reference to a {@link Webhook} instance. + *
    The resulting instance may not provide a {@link #getChannel()} and {@link #getGuild()} due to API limitation. + * + *

    The resulting webhook can also not be executed because the API does not provide a token. + * + * @return {@link RestAction} - Type: {@link Webhook} + */ + @Nonnull + @CheckReturnValue + public RestAction resolve() + { + Route.CompiledRoute route = Route.Webhooks.GET_WEBHOOK.compile(getId()); + return new RestActionImpl<>(api, route, + (response, request) -> request.getJDA().getEntityBuilder().createWebhook(response.getObject(), true)); + } + } + + /** + * Partial Channel which references the source channel for a follower webhook. + */ + class ChannelReference implements ISnowflake + { + private final long id; + private final String name; + + public ChannelReference(long id, String name) + { + this.id = id; + this.name = name; + } + + @Override + public long getIdLong() + { + return id; + } + + /** + * The source channel's name + * + * @return The channel name + */ + @Nonnull + public String getName() + { + return name; + } + } + + /** + * Partial Guild which references the source guild for a follower webhook. + */ + class GuildReference implements ISnowflake + { + private final long id; + private final String name; + + public GuildReference(long id, String name) + { + this.id = id; + this.name = name; + } + + @Override + public long getIdLong() + { + return id; + } + + /** + * The source guild's name + * + * @return The guild name + */ + @Nonnull + public String getName() + { + return name; + } + } } diff --git a/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java b/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java index 1b691dea0a..83847fec8d 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java +++ b/src/main/java/net/dv8tion/jda/api/requests/ErrorResponse.java @@ -67,6 +67,7 @@ public enum ErrorResponse MAX_MESSAGE_PINS( 30003, "Maximum number of pinned messages reached (50)"), MAX_USERS_PER_DM( 30004, "Maximum number of recipients reached. (10)"), MAX_ROLES_PER_GUILD( 30005, "Maximum number of guild roles reached (250)"), + MAX_WEBHOOKS( 30007, "Maximum number of webhooks reached (10)"), TOO_MANY_REACTIONS( 30010, "Maximum number of reactions reached (20)"), MAX_CHANNELS( 30013, "Maximum number of guild channels reached (500)"), MAX_INVITES( 30016, "Maximum number of invites reached (1000)"), diff --git a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java index b66765fd04..77ee67a71a 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/EntityBuilder.java @@ -1427,6 +1427,11 @@ public PermissionOverride createPermissionOverride(DataObject override, Abstract } public WebhookImpl createWebhook(DataObject object) + { + return createWebhook(object, false); + } + + public WebhookImpl createWebhook(DataObject object, boolean allowMissingChannel) { final long id = object.getLong("id"); final long guildId = object.getUnsignedLong("guild_id"); @@ -1435,7 +1440,7 @@ public WebhookImpl createWebhook(DataObject object) final WebhookType type = WebhookType.fromKey(object.getInt("type", -1)); TextChannel channel = getJDA().getTextChannelById(channelId); - if (channel == null) + if (channel == null && !allowMissingChannel) throw new NullPointerException(String.format("Tried to create Webhook for an un-cached TextChannel! WebhookId: %s ChannelId: %s GuildId: %s", id, channelId, guildId)); @@ -1464,11 +1469,25 @@ public WebhookImpl createWebhook(DataObject object) owner = createUser(json); } } - - return new WebhookImpl(channel, id, type) + + Member ownerMember = owner == null || channel == null ? null : channel.getGuild().getMember(owner); + WebhookImpl webhook = new WebhookImpl(channel, getJDA(), id, type) .setToken(token) - .setOwner(owner == null ? null : channel.getGuild().getMember(owner)) + .setOwner(ownerMember, owner) .setUser(defaultUser); + + if (!object.isNull("source_channel")) + { + DataObject source = object.getObject("source_channel"); + webhook.setSourceChannel(new Webhook.ChannelReference(source.getUnsignedLong("id"), source.getString("name"))); + } + if (!object.isNull("source_guild")) + { + DataObject source = object.getObject("source_guild"); + webhook.setSourceGuild(new Webhook.GuildReference(source.getUnsignedLong("id"), source.getString("name"))); + } + + return webhook; } public Invite createInvite(DataObject object) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java index bae56cf78d..b06805d5c3 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/TextChannelImpl.java @@ -117,6 +117,21 @@ public WebhookAction createWebhook(@Nonnull String name) return new WebhookActionImpl(getJDA(), this, name); } + @Nonnull + @Override + public RestAction follow(@Nonnull String targetChannelId) + { + Checks.notNull(targetChannelId, "Target Channel ID"); + if (!isNews()) + throw new IllegalStateException("Can only follow news channels!"); + Route.CompiledRoute route = Route.Channels.FOLLOW_CHANNEL.compile(getId()); + DataObject body = DataObject.empty().put("webhook_channel_id", targetChannelId); + return new RestActionImpl<>(getJDA(), route, body, (response, request) -> { + DataObject json = response.getObject(); + return new Webhook.WebhookReference(request.getJDA(), json.getUnsignedLong("webhook_id") , json.getUnsignedLong("channel_id")); + }); + } + @Nonnull @Override public RestAction deleteMessages(@Nonnull Collection messages) diff --git a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java index d3ffdf2d6a..7c5f102276 100644 --- a/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/entities/WebhookImpl.java @@ -41,14 +41,23 @@ public class WebhookImpl implements Webhook private final long id; private final WebhookType type; private WebhookManager manager; + private final JDA api; private Member owner; - private User user; + private User user, ownerUser; private String token; + private ChannelReference sourceChannel; + private GuildReference sourceGuild; public WebhookImpl(TextChannel channel, long id, WebhookType type) + { + this(channel, channel.getJDA(), id, type); + } + + public WebhookImpl(TextChannel channel, JDA api, long id, WebhookType type) { this.channel = channel; + this.api = api; this.id = id; this.type = type; } @@ -60,33 +69,51 @@ public WebhookType getType() return type; } + @Override + public boolean isPartial() + { + return channel == null; + } + @Nonnull @Override public JDA getJDA() { - return channel.getJDA(); + return api; } @Nonnull @Override public Guild getGuild() { - return channel.getGuild(); + if (channel == null) + throw new IllegalStateException("Cannot provide guild for this Webhook instance because it does not belong to this shard"); + return getChannel().getGuild(); } @Nonnull @Override public TextChannel getChannel() { + if (channel == null) + throw new IllegalStateException("Cannot provide channel for this Webhook instance because it does not belong to this shard"); return channel; } @Override public Member getOwner() { + if (owner == null && channel != null && ownerUser != null) + return getGuild().getMember(ownerUser); // maybe it exists later? return owner; } + @Override + public User getOwnerAsUser() + { + return ownerUser; + } + @Nonnull @Override public User getDefaultUser() @@ -114,6 +141,18 @@ public String getUrl() return Requester.DISCORD_API_PREFIX + "webhooks/" + getId() + (getToken() == null ? "" : "/" + getToken()); } + @Override + public ChannelReference getSourceChannel() + { + return sourceChannel; + } + + @Override + public GuildReference getSourceGuild() + { + return sourceGuild; + } + @Nonnull @Override public AuditableRestAction delete() @@ -161,9 +200,10 @@ public boolean isFake() /* -- Impl Setters -- */ - public WebhookImpl setOwner(Member member) + public WebhookImpl setOwner(Member member, User user) { this.owner = member; + this.ownerUser = user; return this; } @@ -179,6 +219,18 @@ public WebhookImpl setUser(User user) return this; } + public WebhookImpl setSourceGuild(GuildReference reference) + { + this.sourceGuild = reference; + return this; + } + + public WebhookImpl setSourceChannel(ChannelReference reference) + { + this.sourceChannel = reference; + return this; + } + /* -- Object Overrides -- */ @Override diff --git a/src/main/java/net/dv8tion/jda/internal/requests/Route.java b/src/main/java/net/dv8tion/jda/internal/requests/Route.java index 47a5848187..4ec2042b14 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/Route.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/Route.java @@ -182,6 +182,7 @@ public static class Channels public static final Route SEND_TYPING = new Route(POST, "channels/{channel_id}/typing"); public static final Route GET_PERMISSIONS = new Route(GET, "channels/{channel_id}/permissions"); public static final Route GET_PERM_OVERRIDE = new Route(GET, "channels/{channel_id}/permissions/{permoverride_id}"); + public static final Route FOLLOW_CHANNEL = new Route(POST, "channels/{channel_id}/followers"); // Client Only public static final Route GET_RECIPIENTS = new Route(GET, "channels/{channel_id}/recipients"); From 088fedea3fac0c31b83bae6db791fb4ba7ac833f Mon Sep 17 00:00:00 2001 From: Austin Keener Date: Fri, 26 Mar 2021 11:45:29 -0400 Subject: [PATCH 115/121] Changed maven publish repository to AWS S3 backed repository (#1554) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update buildscript to publish to S3 * Update opus-java dependency * Update README * Remove bintray plugin Co-authored-by: Florian Spieß --- README.md | 27 +++++++++------------ build.gradle.kts | 62 ++++++++++++++++++++++-------------------------- 2 files changed, 39 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 8025e8d7b8..e8b55ea1ca 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[version]: https://api.bintray.com/packages/dv8fromtheworld/maven/JDA/images/download.svg -[download]: https://bintray.com/dv8fromtheworld/maven/JDA/_latestVersion +[version]: https://shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fm2.dv8tion.net%2Freleases%2Fnet%2Fdv8tion%2FJDA%2Fmaven-metadata.xml&color=informational&label=Download +[download]: #download [discord-invite]: https://discord.gg/0hMr4ce0tIl3SLv5 [migration]: https://github.com/DV8FromTheWorld/JDA/wiki/0\)-Migrating-to-V4 [jenkins]: https://ci.dv8tion.net/job/JDA @@ -405,11 +405,10 @@ Be sure to replace the **VERSION** key below with the one of the versions shown ``` ```xml - jcenter - jcenter-bintray - https://jcenter.bintray.com + dv8tion + m2-dv8tion + https://m2.dv8tion.net/releases - ``` **Maven without Audio** @@ -434,7 +433,10 @@ dependencies { } repositories { - jcenter() + maven { + name 'm2-dv8tion' + url 'https://m2.dv8tion.net/releases' + } } ``` @@ -447,7 +449,7 @@ dependencies { } ``` -The builds are distributed using JCenter through Bintray [JDA JCenter Bintray](https://bintray.com/dv8fromtheworld/maven/JDA/) +The builds are distributed using a custom S3 instance. If you do not need any opus de-/encoding done by JDA (voice receive/send with PCM) you can exclude `opus-java` entirely. This can be done if you only send audio with an `AudioSendHandler` which only sends opus (`isOpus() = true`). (See [lavaplayer](https://github.com/sedmelluq/lavaplayer)) @@ -634,31 +636,24 @@ All dependencies are managed automatically by Gradle. * NV Websocket Client * Version: **2.14** * [Github](https://github.com/TakahikoKawasaki/nv-websocket-client) - * [JCenter Repository](https://bintray.com/bintray/jcenter/com.neovisionaries%3Anv-websocket-client/view) * OkHttp * Version: **3.13.0** * [Github](https://github.com/square/okhttp) - * [JCenter Repository](https://bintray.com/bintray/jcenter/com.squareup.okhttp3:okhttp) * Apache Commons Collections4 * Version: **4.1** * [Website](https://commons.apache.org/proper/commons-collections) - * [JCenter Repository](https://bintray.com/bintray/jcenter/org.apache.commons%3Acommons-collections4/view) * jackson * Version: **2.10.1** * [Github](https://github.com/FasterXML/jackson) - * [JCenter Repository](https://bintray.com/bintray/jcenter/com.fasterxml.jackson.core%3Ajackson-databind/view) * Trove4j * Version: **3.0.3** * [BitBucket](https://bitbucket.org/trove4j/trove) - * [JCenter Repository](https://bintray.com/bintray/jcenter/net.sf.trove4j%3Atrove4j/view) * slf4j-api * Version: **1.7.25** * [Website](https://www.slf4j.org/) - * [JCenter Repository](https://bintray.com/bintray/jcenter/org.slf4j%3Aslf4j-api/view) * opus-java (optional) - * Version: **1.0.4** + * Version: **1.1.0** * [GitHub](https://github.com/discord-java/opus-java) - * [JCenter Repository](https://bintray.com/minndevelopment/maven/opus-java) ## Related Projects diff --git a/build.gradle.kts b/build.gradle.kts index 04bce41ee9..9659e01fb2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,20 +15,16 @@ */ //to build everything: "gradlew build" -//to build and upload everything: "gradlew bintrayUpload" +//to build and upload everything: "gradlew publish" import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import com.jfrog.bintray.gradle.BintrayExtension -import com.jfrog.bintray.gradle.tasks.BintrayUploadTask import org.apache.tools.ant.filters.ReplaceTokens -import java.util.Date plugins { signing `java-library` `maven-publish` - id("com.jfrog.bintray") version "1.8.1" id("com.github.ben-manes.versions") version "0.19.0" id("com.github.johnrengelman.shadow") version "5.1.0" } @@ -39,6 +35,8 @@ project.group = "net.dv8tion" project.version = "$versionObj" val archivesBaseName = "JDA" +val s3PublishingUrl = "s3://m2.dv8tion.net/releases" + java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -52,8 +50,11 @@ configure { } } + repositories { - jcenter() + mavenLocal() + mavenCentral() + maven("https://m2.dv8tion.net/releases") } dependencies { @@ -71,7 +72,7 @@ dependencies { api("com.squareup.okhttp3:okhttp:3.13.0") //Opus library support - api("club.minnced:opus-java:1.0.4@pom") { + api("club.minnced:opus-java:1.1.0@pom") { isTransitive = true } @@ -96,7 +97,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter:5.4.0") } -val bintrayUpload: BintrayUploadTask by tasks val compileJava: JavaCompile by tasks val shadowJar: ShadowJar by tasks val javadoc: Javadoc by tasks @@ -251,16 +251,6 @@ build.apply { shadowJar.mustRunAfter(sourcesJar) } -bintrayUpload.apply { - dependsOn(clean) - dependsOn(build) - build.mustRunAfter(clean) - - onlyIf { getProjectProperty("bintrayUsername").isNotEmpty() } - onlyIf { getProjectProperty("bintrayApiKey").isNotEmpty() } - onlyIf { System.getenv("BUILD_NUMBER") != null } -} - test.apply { useJUnitPlatform() failFast = true @@ -268,7 +258,7 @@ test.apply { publishing { publications { - register("BintrayRelease", MavenPublication::class) { + create("S3Release") { from(components["java"]) artifactId = archivesBaseName @@ -277,25 +267,29 @@ publishing { artifact(javadocJar) artifact(sourcesJar) + + repositories { + maven { + url = uri(s3PublishingUrl) + credentials(AwsCredentials::class) { + accessKey = getProjectProperty("awsAccessKey") + secretKey = getProjectProperty("awsSecretKey") + } + } + } } } } -bintray { - user = getProjectProperty("bintrayUsername") - key = getProjectProperty("bintrayApiKey") - setPublications("BintrayRelease") - pkg(delegateClosureOf { - repo = "maven" - name = "JDA" - setLicenses("Apache-2.0") - vcsUrl = "https://github.com/DV8FromTheWorld/JDA.git" - publish = true - version(delegateClosureOf { - name = project.version as String - released = Date().toString() - }) - }) +val publishS3ReleasePublicationToMavenRepository: Task by tasks +publishS3ReleasePublicationToMavenRepository.apply { + onlyIf { getProjectProperty("awsAccessKey").isNotEmpty() } + onlyIf { getProjectProperty("awsSecretKey").isNotEmpty() } + onlyIf { System.getenv("BUILD_NUMBER") != null } + + dependsOn(clean) + dependsOn(build) + build.mustRunAfter(clean) } fun getProjectProperty(propertyName: String): String { From c6f4a9d8c6518cf6c48306c4808ee843153031ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Fri, 26 Mar 2021 19:42:41 +0100 Subject: [PATCH 116/121] Use MethodHandle for ListenerAdapter (#1551) This improves performance on ListenerAdapter --- .../jda/api/hooks/ListenerAdapter.java | 65 ++++++++++++++----- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java index 5bcb228445..40edcfad82 100644 --- a/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java +++ b/src/main/java/net/dv8tion/jda/api/hooks/ListenerAdapter.java @@ -86,8 +86,13 @@ import net.dv8tion.jda.internal.utils.ClassWalker; import javax.annotation.Nonnull; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.util.Collections; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; /** * An abstract implementation of {@link net.dv8tion.jda.api.hooks.EventListener EventListener} which divides {@link net.dv8tion.jda.api.events.Event Events} @@ -387,6 +392,20 @@ public void onGenericEmote(@Nonnull GenericEmoteEvent event) {} public void onGenericEmoteUpdate(@Nonnull GenericEmoteUpdateEvent event) {} public void onGenericPermissionOverride(@Nonnull GenericPermissionOverrideEvent event) {} + private static final MethodHandles.Lookup lookup = MethodHandles.lookup(); + private static final ConcurrentMap, MethodHandle> methods = new ConcurrentHashMap<>(); + private static final Set> unresolved; + static + { + unresolved = ConcurrentHashMap.newKeySet(); + Collections.addAll(unresolved, + Object.class, // Objects aren't events + Event.class, // onEvent is final and would never be found + UpdateEvent.class, // onGenericUpdate has already been called + GenericEvent.class // onGenericEvent has already been called + ); + } + @Override public final void onEvent(@Nonnull GenericEvent event) { @@ -400,26 +419,42 @@ public final void onEvent(@Nonnull GenericEvent event) else if (event instanceof ReconnectedEvent) onReconnect((ReconnectedEvent) event); - Class handle = ListenerAdapter.class; for (Class clazz : ClassWalker.range(event.getClass(), GenericEvent.class)) { - String name = clazz.getSimpleName(); + if (unresolved.contains(clazz)) + continue; + MethodHandle mh = methods.computeIfAbsent(clazz, ListenerAdapter::findMethod); + if (mh == null) + { + unresolved.add(clazz); + continue; + } + try { - name = "on" + name.substring(0, name.length() - "Event".length()); - Method method = handle.getDeclaredMethod(name, clazz); - method.invoke(this, event); + mh.invoke(this, event); } - catch (NoSuchMethodException | IllegalAccessException ignored) {} // this means this is probably a custom event! - catch (InvocationTargetException e) + catch (Throwable throwable) { - Throwable cause = e.getCause(); - if (cause instanceof RuntimeException) - throw (RuntimeException) cause; - if (cause instanceof Error) - throw (Error) cause; - throw new RuntimeException(cause); + if (throwable instanceof RuntimeException) + throw (RuntimeException) throwable; + if (throwable instanceof Error) + throw (Error) throwable; + throw new IllegalStateException(throwable); } } } + + private static MethodHandle findMethod(Class clazz) + { + String name = clazz.getSimpleName(); + MethodType type = MethodType.methodType(Void.TYPE, clazz); + try + { + name = "on" + name.substring(0, name.length() - "Event".length()); + return lookup.findVirtual(ListenerAdapter.class, name, type); + } + catch (NoSuchMethodException | IllegalAccessException ignored) {} // this means this is probably a custom event! + return null; + } } From d7f37f1bac236761c59a6621b2f3548311d5e8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sat, 27 Mar 2021 18:56:44 +0100 Subject: [PATCH 117/121] Fix deny/grant on override action (#1560) --- .../restaction/PermissionOverrideAction.java | 23 +++----- .../PermissionOverrideActionImpl.java | 55 +++++++++++++++---- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java index af8fda9b36..0fef4d47d5 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/PermissionOverrideAction.java @@ -322,10 +322,7 @@ default PermissionOverrideAction setAllow(@Nullable Permission... permissions) */ @Nonnull @CheckReturnValue - default PermissionOverrideAction grant(long allowBits) - { - return setAllow(getAllow() | allowBits); - } + PermissionOverrideAction grant(long allowBits); /** * Grants the specified permissions. @@ -346,7 +343,7 @@ default PermissionOverrideAction grant(long allowBits) @CheckReturnValue default PermissionOverrideAction grant(@Nonnull Collection permissions) { - return setAllow(getAllow() | Permission.getRaw(permissions)); + return grant(Permission.getRaw(permissions)); } /** @@ -368,7 +365,7 @@ default PermissionOverrideAction grant(@Nonnull Collection permissio @CheckReturnValue default PermissionOverrideAction grant(@Nonnull Permission... permissions) { - return setAllow(getAllow() | Permission.getRaw(permissions)); + return grant(Permission.getRaw(permissions)); } @@ -474,10 +471,7 @@ default PermissionOverrideAction setDeny(@Nullable Permission... permissions) */ @Nonnull @CheckReturnValue - default PermissionOverrideAction deny(long denyBits) - { - return setDeny(getDeny() | denyBits); - } + PermissionOverrideAction deny(long denyBits); /** * Denies the specified permissions. @@ -498,7 +492,7 @@ default PermissionOverrideAction deny(long denyBits) @CheckReturnValue default PermissionOverrideAction deny(@Nonnull Collection permissions) { - return setDeny(getDeny() | Permission.getRaw(permissions)); + return deny(Permission.getRaw(permissions)); } /** @@ -520,7 +514,7 @@ default PermissionOverrideAction deny(@Nonnull Collection permission @CheckReturnValue default PermissionOverrideAction deny(@Nonnull Permission... permissions) { - return setDeny(getDeny() | Permission.getRaw(permissions)); + return deny(Permission.getRaw(permissions)); } /** @@ -539,10 +533,7 @@ default PermissionOverrideAction deny(@Nonnull Permission... permissions) */ @Nonnull @CheckReturnValue - default PermissionOverrideAction clear(long inheritedBits) - { - return setDeny(getDeny() & ~inheritedBits).setAllow(getAllow() & ~inheritedBits); - } + PermissionOverrideAction clear(long inheritedBits); /** * Clears the provided {@link net.dv8tion.jda.api.Permission Permissions} bits diff --git a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java index 2236180922..dc7cca4647 100644 --- a/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java +++ b/src/main/java/net/dv8tion/jda/internal/requests/restaction/PermissionOverrideActionImpl.java @@ -118,7 +118,7 @@ public PermissionOverrideActionImpl deadline(long timestamp) @Override public PermissionOverrideAction resetAllow() { - allow = getCurrentAllow(); + allow = getOriginalAllow(); allowSet = false; return this; } @@ -127,7 +127,7 @@ public PermissionOverrideAction resetAllow() @Override public PermissionOverrideAction resetDeny() { - deny = getCurrentDeny(); + deny = getOriginalDeny(); denySet = false; return this; } @@ -186,25 +186,46 @@ public boolean isRole() @CheckReturnValue public PermissionOverrideActionImpl setAllow(long allowBits) { - checkPermissions(getCurrentAllow() ^ allowBits); + checkPermissions(getOriginalAllow() ^ allowBits); this.allow = allowBits; this.deny &= ~allowBits; allowSet = denySet = true; return this; } + @Nonnull + @Override + public PermissionOverrideAction grant(long allowBits) + { + return setAllow(getCurrentAllow() | allowBits); + } + @Nonnull @Override @CheckReturnValue public PermissionOverrideActionImpl setDeny(long denyBits) { - checkPermissions(getCurrentDeny() ^ denyBits); + checkPermissions(getOriginalDeny() ^ denyBits); this.deny = denyBits; this.allow &= ~denyBits; allowSet = denySet = true; return this; } + @Nonnull + @Override + public PermissionOverrideAction deny(long denyBits) + { + return setDeny(getCurrentDeny() | denyBits); + } + + @Nonnull + @Override + public PermissionOverrideAction clear(long inheritedBits) + { + return setAllow(getCurrentAllow() & ~inheritedBits).setDeny(getCurrentDeny() & ~inheritedBits); + } + protected void checkPermissions(long changed) { Member selfMember = getGuild().getSelfMember(); @@ -232,27 +253,37 @@ public PermissionOverrideActionImpl setPermissions(long allowBits, long denyBits private long getCurrentAllow() { - if (isOverride) - return 0; - PermissionOverride override = channel.getOverrideMap().get(id); - return override == null ? 0 : override.getAllowedRaw(); + if (allowSet) + return allow; + return isOverride ? 0 : getOriginalAllow(); } private long getCurrentDeny() { - if (isOverride) - return 0; + if (denySet) + return deny; + return isOverride ? 0 : getOriginalDeny(); + } + + private long getOriginalDeny() + { PermissionOverride override = channel.getOverrideMap().get(id); return override == null ? 0 : override.getDeniedRaw(); } + private long getOriginalAllow() + { + PermissionOverride override = channel.getOverrideMap().get(id); + return override == null ? 0 : override.getAllowedRaw(); + } + @Override protected RequestBody finalizeData() { DataObject object = DataObject.empty(); object.put("type", isRole() ? "role" : "member"); - object.put("allow", allowSet ? allow : getCurrentAllow()); - object.put("deny", denySet ? deny : getCurrentDeny()); + object.put("allow", getCurrentAllow()); + object.put("deny", getCurrentDeny()); reset(); return getRequestBody(object); } From 7fa6055541d70ef8f59f20063efc4ca185a30d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 28 Mar 2021 14:34:38 +0200 Subject: [PATCH 118/121] Add missing message types (#1559) --- .../dv8tion/jda/api/entities/MessageType.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageType.java b/src/main/java/net/dv8tion/jda/api/entities/MessageType.java index b05d605eb4..d99c7339e1 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/MessageType.java +++ b/src/main/java/net/dv8tion/jda/api/entities/MessageType.java @@ -88,11 +88,27 @@ public enum MessageType */ CHANNEL_FOLLOW_ADD(12), + /** + * System message related to discovery qualifications. + */ + GUILD_DISCOVERY_DISQUALIFIED(14), + + /** + * System message related to discovery qualifications. + */ + GUILD_DISCOVERY_REQUALIFIED(15), + /** * Reply to another message. This usually comes with a {@link Message#getReferencedMessage() referenced message}. */ INLINE_REPLY(19), + /** + * This message was created by an interaction. Usually in combination with Slash Commands. + *
    Most commonly this type will appear as a {@link Message#getReferencedMessage() referenced message}. + */ + APPLICATION_COMMAND(20), + /** * Unknown MessageType. */ From 1da0d00464f379214be037c2adbfe58ab62b0b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 28 Mar 2021 14:37:09 +0200 Subject: [PATCH 119/121] Bump version to 4.2.1 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9659e01fb2..7f29985818 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,7 +29,7 @@ plugins { id("com.github.johnrengelman.shadow") version "5.1.0" } -val versionObj = Version(major = "4", minor = "2", revision = "0") +val versionObj = Version(major = "4", minor = "2", revision = "1") project.group = "net.dv8tion" project.version = "$versionObj" From 8a623dd2e11163926f65e120ea7c8cdc7b6d84e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Sun, 28 Mar 2021 16:25:16 +0200 Subject: [PATCH 120/121] Add @since tags to new features --- .../net/dv8tion/jda/api/GatewayEncoding.java | 2 ++ .../java/net/dv8tion/jda/api/JDABuilder.java | 6 ++++-- .../dv8tion/jda/api/entities/Activity.java | 4 ++++ .../net/dv8tion/jda/api/entities/Emote.java | 2 ++ .../net/dv8tion/jda/api/entities/Guild.java | 8 ++++++++ .../jda/api/entities/GuildChannel.java | 2 ++ .../net/dv8tion/jda/api/entities/Member.java | 2 ++ .../net/dv8tion/jda/api/entities/Message.java | 20 +++++++++++++++++++ .../net/dv8tion/jda/api/entities/Role.java | 4 ++++ .../dv8tion/jda/api/entities/TextChannel.java | 12 +++++++++++ .../net/dv8tion/jda/api/entities/User.java | 4 ++++ .../jda/api/entities/VanityInvite.java | 2 ++ .../update/TextChannelUpdateNewsEvent.java | 2 ++ .../guild/member/GuildMemberUpdateEvent.java | 2 ++ .../update/GuildMemberUpdatePendingEvent.java | 2 ++ .../guild/update/GuildUpdateLocaleEvent.java | 2 ++ .../GenericGuildMessageReactionEvent.java | 6 ++++++ .../react/GenericMessageReactionEvent.java | 6 ++++++ .../update/UserUpdateActivitiesEvent.java | 2 ++ .../jda/api/managers/ChannelManager.java | 2 ++ .../dv8tion/jda/api/requests/RestAction.java | 18 +++++++++++++++++ .../requests/restaction/ChannelAction.java | 2 ++ .../requests/restaction/MessageAction.java | 10 ++++++++++ .../sharding/DefaultShardManagerBuilder.java | 2 ++ .../net/dv8tion/jda/api/utils/Result.java | 2 ++ .../dv8tion/jda/api/utils/data/DataArray.java | 4 ++++ .../jda/api/utils/data/DataObject.java | 4 ++++ .../jda/api/utils/data/etf/ExTermDecoder.java | 2 ++ .../jda/api/utils/data/etf/ExTermEncoder.java | 2 ++ .../jda/api/utils/data/etf/ExTermTag.java | 2 ++ .../jda/api/utils/data/etf/package-info.java | 2 ++ 31 files changed, 140 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java b/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java index ec383a9e37..56b418a18d 100644 --- a/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java +++ b/src/main/java/net/dv8tion/jda/api/GatewayEncoding.java @@ -31,6 +31,8 @@ public enum GatewayEncoding * Erlang External Term Format (binary). This is an optimized format which encodes all payloads * in a binary stream. * + * @since 4.2.1 + * * @see Erlang -- External Term Format */ ETF diff --git a/src/main/java/net/dv8tion/jda/api/JDABuilder.java b/src/main/java/net/dv8tion/jda/api/JDABuilder.java index 2ed388f9be..9c7f328a84 100644 --- a/src/main/java/net/dv8tion/jda/api/JDABuilder.java +++ b/src/main/java/net/dv8tion/jda/api/JDABuilder.java @@ -555,6 +555,8 @@ private JDABuilder setDisabledCache(EnumSet flags) * If null is provided * * @return The JDABuilder instance. Useful for chaining. + * + * @since 4.2.1 */ @Nonnull public JDABuilder setGatewayEncoding(@Nonnull GatewayEncoding encoding) @@ -1181,7 +1183,7 @@ public JDABuilder setEventPool(@Nullable ExecutorService executor, boolean autom * * @return The JDABuilder instance. Useful for chaining. * - * @since 4.2.1 + * @since 4.2.1 */ @Nonnull public JDABuilder setAudioPool(@Nullable ScheduledExecutorService pool) @@ -1203,7 +1205,7 @@ public JDABuilder setAudioPool(@Nullable ScheduledExecutorService pool) * * @return The JDABuilder instance. Useful for chaining. * - * @since 4.2.1 + * @since 4.2.1 */ @Nonnull public JDABuilder setAudioPool(@Nullable ScheduledExecutorService pool, boolean automaticShutdown) diff --git a/src/main/java/net/dv8tion/jda/api/entities/Activity.java b/src/main/java/net/dv8tion/jda/api/entities/Activity.java index 0a8f45f88e..8c2aac1640 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Activity.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Activity.java @@ -216,6 +216,8 @@ static Activity watching(@Nonnull String name) * If the specified name is null, empty, blank or longer than 128 characters * * @return A valid Activity instance with the provided name with {@link net.dv8tion.jda.api.entities.Activity.ActivityType#COMPETING} + * + * @since 4.2.1 */ @Nonnull static Activity competing(@Nonnull String name) @@ -337,6 +339,8 @@ enum ActivityType /** * Used to indicate that the {@link Activity Activity} should display * as {@code Competing in...} in the official client. + * + * @since 4.2.1 */ COMPETING(5); diff --git a/src/main/java/net/dv8tion/jda/api/entities/Emote.java b/src/main/java/net/dv8tion/jda/api/entities/Emote.java index 8aca1e0ef5..674f71c378 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Emote.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Emote.java @@ -138,6 +138,8 @@ default boolean hasRoles() * as long as the BoostTier stays above the required level. * * @return True, if this emote is available + * + * @since 4.2.1 */ boolean isAvailable(); 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 b01e6f773b..699d2ff635 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Guild.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Guild.java @@ -413,6 +413,8 @@ default String getVanityUrl() * If the currently logged in account does not have {@link Permission#MANAGE_SERVER Permission.MANAGE_SERVER} * * @return {@link RestAction} - Type: {@link VanityInvite} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -438,6 +440,8 @@ default String getVanityUrl() *
    Default: {@link Locale#US} * * @return The preferred {@link Locale} for this guild + * + * @since 4.2.1 */ @Nonnull Locale getLocale(); @@ -2486,6 +2490,8 @@ default Task> findMembers(@Nonnull Predicate filter * If the {@link GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is not enabled * * @return {@link Task} - Type: {@link List} of {@link Member} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -2523,6 +2529,8 @@ default Task> findMembersWithRoles(@Nonnull Collection roles) * If the {@link GatewayIntent#GUILD_MEMBERS GatewayIntent.GUILD_MEMBERS} is not enabled * * @return {@link Task} - Type: {@link List} of {@link Member} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java index da17db1957..37de80d5e5 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/GuildChannel.java @@ -187,6 +187,8 @@ public interface GuildChannel extends ISnowflake, Comparable *
    {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disables this CacheFlag by default. * * @return True, if this channel is synced with its parent category + * + * @since 4.2.1 */ boolean isSynced(); 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 4502163a44..f216766313 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Member.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Member.java @@ -311,6 +311,8 @@ public interface Member extends IMentionable, IPermissionHolder, IFakeable * @incubating Discord is still trying to figure this out * * @return True, if this member hasn't passed the guild's Membership Screening requirements + * + * @since 4.2.1 */ @Incubating boolean isPending(); 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 fbb5fd87b7..b1c2e64179 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Message.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Message.java @@ -982,6 +982,8 @@ default boolean isFromGuild() * The content of the reply message * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1003,6 +1005,8 @@ default MessageAction reply(@Nonnull CharSequence content) * The content of the reply message * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1024,6 +1028,8 @@ default MessageAction reply(@Nonnull MessageEmbed content) * The content of the reply message * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1047,6 +1053,8 @@ default MessageAction reply(@Nonnull Message content) * The arguments for your format * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1070,6 +1078,8 @@ default MessageAction replyFormat(@Nonnull String format, @Nonnull Object... arg * Possible options to apply to this attachment, such as marking it as spoiler image * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1095,6 +1105,8 @@ default MessageAction reply(@Nonnull File file, @Nonnull AttachmentOption... opt * Possible options to apply to this attachment, such as marking it as spoiler image * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1120,6 +1132,8 @@ default MessageAction reply(@Nonnull File data, @Nonnull String name, @Nonnull A * Possible options to apply to this attachment, such as marking it as spoiler image * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1145,6 +1159,8 @@ default MessageAction reply(@Nonnull InputStream data, @Nonnull String name, @No * Possible options to apply to this attachment, such as marking it as spoiler image * * @return {@link MessageAction} Providing the {@link Message} created from this upload. + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1984,6 +2000,8 @@ default MessageAction reply(@Nonnull byte[] data, @Nonnull String name, @Nonnull * or if this message is from another user and we don't have {@link Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE}. * * @return {@link net.dv8tion.jda.api.requests.RestAction} - Type: {@link Message} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -2563,6 +2581,8 @@ public boolean isVideo() * based on {@link #getFileName()}. * * @return True if this attachment is marked as spoiler + * + * @since 4.2.1 */ public boolean isSpoiler() { diff --git a/src/main/java/net/dv8tion/jda/api/entities/Role.java b/src/main/java/net/dv8tion/jda/api/entities/Role.java index 45226ed4bc..47fea2bbc5 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/Role.java +++ b/src/main/java/net/dv8tion/jda/api/entities/Role.java @@ -285,12 +285,16 @@ default RoleAction createCopy() * See {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) JDABuilder.enableCache(...)}. * * @return {@link RoleTags} + * + * @since 4.2.1 */ @Nonnull RoleTags getTags(); /** * Tags associated with this role. + * + * @since 4.2.1 */ interface RoleTags { diff --git a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java index da7c1474ee..2c5e9f874e 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java +++ b/src/main/java/net/dv8tion/jda/api/entities/TextChannel.java @@ -85,6 +85,8 @@ public interface TextChannel extends GuildChannel, MessageChannel, IMentionable *
    These channels can be used to crosspost messages to other guilds by using a follower type webhook. * * @return True, if this is considered a news channel + * + * @since 4.2.1 */ boolean isNews(); @@ -186,6 +188,8 @@ public interface TextChannel extends GuildChannel, MessageChannel, IMentionable * If this is not a news channels (See {@link #isNews()}) * * @return {@link RestAction} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -214,6 +218,8 @@ public interface TextChannel extends GuildChannel, MessageChannel, IMentionable * If this is not a news channels (See {@link #isNews()}) * * @return {@link RestAction} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -249,6 +255,8 @@ default RestAction follow(long targetChannelId) * If this is not a news channels (See {@link #isNews()}) * * @return {@link RestAction} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -917,6 +925,8 @@ default RestAction removeReactionById(long messageId, @Nonnull Emote emote * {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL Permission.VIEW_CHANNEL} in this channel. * * @return {@link net.dv8tion.jda.api.requests.RestAction} - Type: {@link Message} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -968,6 +978,8 @@ default RestAction crosspostMessageById(@Nonnull String messageId) * {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL Permission.VIEW_CHANNEL} in this channel. * * @return {@link net.dv8tion.jda.api.requests.RestAction} - Type: {@link Message} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue 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 6104baf717..f7ec213589 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/User.java +++ b/src/main/java/net/dv8tion/jda/api/entities/User.java @@ -92,6 +92,8 @@ public interface User extends IMentionable, IFakeable * @return A user instance * * @see JDA#retrieveUserById(long) + * + * @since 4.2.1 */ @Nonnull static User fromId(long id) @@ -112,6 +114,8 @@ static User fromId(long id) * @return A user instance * * @see JDA#retrieveUserById(String) + * + * @since 4.2.1 */ @Nonnull static User fromId(@Nonnull String id) diff --git a/src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java b/src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java index d20c704786..62993106b2 100644 --- a/src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java +++ b/src/main/java/net/dv8tion/jda/api/entities/VanityInvite.java @@ -21,6 +21,8 @@ /** * Meta data for the vanity invite of a guild + * + * @since 4.2.1 */ public class VanityInvite { diff --git a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java index df8fba2155..f8a910eede 100644 --- a/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/channel/text/update/TextChannelUpdateNewsEvent.java @@ -28,6 +28,8 @@ *

    Can be used to detect when a TextChannel becomes a news channel. * *

    Identifier: {@code news} + * + * @since 4.2.1 */ @SuppressWarnings("ConstantConditions") public class TextChannelUpdateNewsEvent extends GenericTextChannelUpdateEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java index b57321c69c..9ea9b16abf 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/GuildMemberUpdateEvent.java @@ -35,6 +35,8 @@ *

    This event requires the {@link net.dv8tion.jda.api.requests.GatewayIntent#GUILD_MEMBERS GUILD_MEMBERS} intent to be enabled. *
    {@link net.dv8tion.jda.api.JDABuilder#createDefault(String) createDefault(String)} and * {@link net.dv8tion.jda.api.JDABuilder#createLight(String) createLight(String)} disable this by default! + * + * @since 4.2.1 */ public class GuildMemberUpdateEvent extends GenericGuildMemberEvent { diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java index 26e8117499..68b0853fc0 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/member/update/GuildMemberUpdatePendingEvent.java @@ -41,6 +41,8 @@ * need to have the old member cached to compare against. * * @incubating Discord is still trying to figure this out + * + * @since 4.2.1 */ @Incubating public class GuildMemberUpdatePendingEvent extends GenericGuildMemberUpdateEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java index a07e16adad..d543975ad2 100644 --- a/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/guild/update/GuildUpdateLocaleEvent.java @@ -28,6 +28,8 @@ *

    Can be used to detect when a Locale changes and retrieve the old one * *

    Identifier: {@code locale} + * + * @since 4.2.1 */ @SuppressWarnings("ConstantConditions") public class GuildUpdateLocaleEvent extends GenericGuildUpdateEvent diff --git a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java index 35ad47b3d5..63dffbd67b 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/guild/react/GenericGuildMessageReactionEvent.java @@ -126,6 +126,8 @@ public MessageReaction.ReactionEmote getReactionEmote() *
    If a user is known, this will return {@link #getUser()}. * * @return {@link RestAction} - Type: {@link User} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -145,6 +147,8 @@ public RestAction retrieveUser() * should be the failure result. * * @return {@link RestAction} - Type: {@link Member} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -163,6 +167,8 @@ public RestAction retrieveMember() * To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}. * * @return {@link RestAction} - Type: {@link Message} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java index 71b351f260..3d93e5227d 100644 --- a/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/message/react/GenericMessageReactionEvent.java @@ -141,6 +141,8 @@ public MessageReaction.ReactionEmote getReactionEmote() *
    If a user is known, this will return {@link #getUser()}. * * @return {@link RestAction} - Type: {@link User} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -164,6 +166,8 @@ public RestAction retrieveUser() * If this event is not from a guild * * @return {@link RestAction} - Type: {@link Member} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -182,6 +186,8 @@ public RestAction retrieveMember() * To retrieve the member you can use {@code getGuild().retrieveMember(message.getAuthor())}. * * @return {@link RestAction} - Type: {@link Message} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java index fb57bd881a..6286046bf9 100644 --- a/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java +++ b/src/main/java/net/dv8tion/jda/api/events/user/update/UserUpdateActivitiesEvent.java @@ -47,6 +47,8 @@ * *

    This also requires {@link net.dv8tion.jda.api.utils.cache.CacheFlag#ACTIVITY CacheFlag.ACTIVITY} to be enabled. * You can enable the cache flag with {@link net.dv8tion.jda.api.JDABuilder#enableCache(CacheFlag, CacheFlag...) enableCache(CacheFlag.ACTIVITY)}. + * + * @since 4.2.1 */ public class UserUpdateActivitiesEvent extends GenericUserUpdateEvent> implements GenericUserPresenceEvent { diff --git a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java index ace39ca479..80cfc35a85 100644 --- a/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java +++ b/src/main/java/net/dv8tion/jda/api/managers/ChannelManager.java @@ -486,6 +486,8 @@ default ChannelManager sync() * * @see net.dv8tion.jda.api.entities.Guild#getFeatures() * @see net.dv8tion.jda.api.entities.TextChannel#isNews() + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/api/requests/RestAction.java b/src/main/java/net/dv8tion/jda/api/requests/RestAction.java index 475b21d5b1..f156b38a1a 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/RestAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/RestAction.java @@ -282,6 +282,8 @@ static Consumer getDefaultSuccess() * * @see #and(RestAction, BiFunction) * @see #zip(RestAction, RestAction[]) + * + * @since 4.2.1 */ @Nonnull @SafeVarargs @@ -313,6 +315,8 @@ static RestAction> allOf(@Nonnull RestAction first, @No * * @see #and(RestAction, BiFunction) * @see #zip(RestAction, RestAction[]) + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -344,6 +348,8 @@ static RestAction> allOf(@Nonnull Collection RestAction accumulate(@Nonnull Collection submit() * You should use {@link Result#onFailure(Consumer)}, {@link Result#getFailure()}, or {@link Result#expect(Predicate)}! * * @return RestAction - Type: {@link Result} + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1002,6 +1014,8 @@ default RestAction flatMap(@Nullable Predicate condition, @Non * If null is provided or you tried to combine an action with itself * * @return Combined RestAction + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1027,6 +1041,8 @@ default RestAction and(@Nonnull RestAction other, @Nonnull BiFuncti * If null is provided or you tried to combine an action with itself * * @return Combined RestAction with empty result + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -1053,6 +1069,8 @@ default RestAction and(@Nonnull RestAction other) * * @see #allOf(RestAction, RestAction[]) * @see #and(RestAction, BiFunction) + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java index e8e3be5159..47de8e3af1 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/ChannelAction.java @@ -205,6 +205,8 @@ public interface ChannelAction extends AuditableRestActi * @return The current ChannelAction, for chaining convenience * * @see net.dv8tion.jda.api.entities.TextChannel#isNews() + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java index f8a05068bd..1e68e0c0de 100644 --- a/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java +++ b/src/main/java/net/dv8tion/jda/api/requests/restaction/MessageAction.java @@ -256,6 +256,8 @@ static boolean isDefaultFailOnInvalidReply() * If the provided message is from a {@link MessageBuilder} * * @return Updated MessageAction for chaining convenience + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -280,6 +282,8 @@ static boolean isDefaultFailOnInvalidReply() * If the provided message is from a {@link MessageBuilder} * * @return Updated MessageAction for chaining convenience + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -307,6 +311,8 @@ default MessageAction referenceById(@Nonnull String messageId) * If the provided message is from a {@link MessageBuilder} * * @return Updated MessageAction for chaining convenience + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -326,6 +332,8 @@ default MessageAction reference(@Nonnull Message message) * True, to mention the author if the referenced message * * @return Updated MessageAction for chaining convenience + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue @@ -341,6 +349,8 @@ default MessageAction reference(@Nonnull Message message) * True, to throw a exception if the referenced message does not exist * * @return Updated MessageAction for chaining convenience + * + * @since 4.2.1 */ @Nonnull @CheckReturnValue diff --git a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java index 5c9f4c18b0..e86164d4ce 100644 --- a/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java +++ b/src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManagerBuilder.java @@ -531,6 +531,8 @@ private DefaultShardManagerBuilder setDisabledCache(EnumSet flags) * If null is provided * * @return The DefaultShardManagerBuilder instance. Useful for chaining. + * + * @since 4.2.1 */ @Nonnull public DefaultShardManagerBuilder setGatewayEncoding(@Nonnull GatewayEncoding encoding) diff --git a/src/main/java/net/dv8tion/jda/api/utils/Result.java b/src/main/java/net/dv8tion/jda/api/utils/Result.java index 30b5268c10..694e3234a3 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/Result.java +++ b/src/main/java/net/dv8tion/jda/api/utils/Result.java @@ -34,6 +34,8 @@ * * @param * The success type + * + * @since 4.2.1 */ public class Result { diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java b/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java index f122911002..64cc134fae 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/DataArray.java @@ -184,6 +184,8 @@ public static DataArray fromJson(@Nonnull Reader json) * If the provided ETF payload is incorrectly formatted or an I/O error occurred * * @return A DataArray instance for the provided payload + * + * @since 4.2.1 */ @Nonnull public static DataArray fromETF(@Nonnull byte[] data) @@ -661,6 +663,8 @@ public byte[] toJson() * Serializes this object as ETF LIST term. * * @return byte array containing the encoded ETF term + * + * @since 4.2.1 */ @Nonnull public byte[] toETF() diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java b/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java index b87f871644..5a999c8a42 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/DataObject.java @@ -194,6 +194,8 @@ public static DataObject fromJson(@Nonnull Reader stream) * If the provided ETF payload is incorrectly formatted or an I/O error occurred * * @return A DataObject instance for the provided payload + * + * @since 4.2.1 */ @Nonnull public static DataObject fromETF(@Nonnull byte[] data) @@ -701,6 +703,8 @@ public byte[] toJson() * Serializes this object as ETF MAP term. * * @return byte array containing the encoded ETF term + * + * @since 4.2.1 */ @Nonnull public byte[] toETF() diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java index a5ee57ca25..c5f7b40064 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermDecoder.java @@ -33,6 +33,8 @@ * @see #unpack(ByteBuffer) * @see #unpackMap(ByteBuffer) * @see #unpackList(ByteBuffer) + * + * @since 4.2.1 */ public class ExTermDecoder { diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java index 26e4f62cf7..80c65765ec 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermEncoder.java @@ -29,6 +29,8 @@ * Encodes an object into a binary ETF representation. * * @see #pack(Object) + * + * @since 4.2.1 */ public class ExTermEncoder { diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java index 65e736df4f..0b75a62ba9 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/ExTermTag.java @@ -19,6 +19,8 @@ /** * Tags used for encoding and decoding for external terms. *
    This list in incomplete as not all tags are used by this library. + * + * @since 4.2.1 */ public class ExTermTag { diff --git a/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java b/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java index 1e7b93a398..fbeea34bc5 100644 --- a/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java +++ b/src/main/java/net/dv8tion/jda/api/utils/data/etf/package-info.java @@ -18,5 +18,7 @@ * Utility classes to decode and encode Erlang External Term Format (ETF) * * @see Erlang -- External Term Format + * + * @since 4.2.1 */ package net.dv8tion.jda.api.utils.data.etf; From 6db50520365eb64d68b805e0582e764980eb4e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Spie=C3=9F?= Date: Thu, 1 Apr 2021 15:15:36 +0200 Subject: [PATCH 121/121] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e8b55ea1ca..b2dfa4d69d 100644 --- a/README.md +++ b/README.md @@ -433,6 +433,7 @@ dependencies { } repositories { + mavenCentral() // for transitive dependencies maven { name 'm2-dv8tion' url 'https://m2.dv8tion.net/releases'