Skip to content

Commit

Permalink
Release 4.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment authored Apr 2, 2021
2 parents 3a9fcd0 + 6db5052 commit fa8a40a
Show file tree
Hide file tree
Showing 578 changed files with 7,882 additions and 2,343 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
49 changes: 17 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -416,11 +405,10 @@ Be sure to replace the **VERSION** key below with the one of the versions shown
```
```xml
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
<id>dv8tion</id>
<name>m2-dv8tion</name>
<url>https://m2.dv8tion.net/releases</url>
</repository>

```

**Maven without Audio**
Expand All @@ -445,7 +433,11 @@ dependencies {
}
repositories {
jcenter()
mavenCentral() // for transitive dependencies
maven {
name 'm2-dv8tion'
url 'https://m2.dv8tion.net/releases'
}
}
```

Expand All @@ -458,7 +450,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))
Expand Down Expand Up @@ -643,33 +635,26 @@ version was by looking at the [release page](https://github.com/DV8FromTheWorld/
This project requires **Java 8+**.<br>
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
* 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

Expand Down
68 changes: 31 additions & 37 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,30 +15,28 @@
*/

//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.*

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"
}

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"
val archivesBaseName = "JDA"

val s3PublishingUrl = "s3://m2.dv8tion.net/releases"

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -52,8 +50,11 @@ configure<SourceSetContainer> {
}
}


repositories {
jcenter()
mavenLocal()
mavenCentral()
maven("https://m2.dv8tion.net/releases")
}

dependencies {
Expand All @@ -67,11 +68,11 @@ 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.14")
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
}

Expand All @@ -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
Expand Down Expand Up @@ -251,24 +251,14 @@ 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
}

publishing {
publications {
register("BintrayRelease", MavenPublication::class) {
create<MavenPublication>("S3Release") {
from(components["java"])

artifactId = archivesBaseName
Expand All @@ -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<BintrayExtension.PackageConfig> {
repo = "maven"
name = "JDA"
setLicenses("Apache-2.0")
vcsUrl = "https://github.com/DV8FromTheWorld/JDA.git"
publish = true
version(delegateClosureOf<BintrayExtension.VersionConfig> {
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 {
Expand Down
6 changes: 3 additions & 3 deletions src/examples/java/AudioEchoExample.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/examples/java/LRUCachePolicy.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/examples/java/MessageListenerExample.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/net/dv8tion/jda/annotations/ForRemoval.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -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";
}
2 changes: 1 addition & 1 deletion src/main/java/net/dv8tion/jda/annotations/Incubating.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/dv8tion/jda/annotations/ReplaceWith.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/dv8tion/jda/api/AccountType.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/net/dv8tion/jda/api/EmbedBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
* Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -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
Expand All @@ -589,6 +592,7 @@ public EmbedBuilder setAuthor(@Nullable String name)
*
* @throws java.lang.IllegalArgumentException
* <ul>
* <li>If the length of {@code name} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#AUTHOR_MAX_LENGTH}.</li>
* <li>If the length of {@code url} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#URL_MAX_LENGTH}.</li>
* <li>If the provided {@code url} is not a properly formatted http or https url.</li>
* </ul>
Expand Down Expand Up @@ -631,6 +635,7 @@ public EmbedBuilder setAuthor(@Nullable String name, @Nullable String url)
*
* @throws java.lang.IllegalArgumentException
* <ul>
* <li>If the length of {@code name} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#AUTHOR_MAX_LENGTH}.</li>
* <li>If the length of {@code url} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#URL_MAX_LENGTH}.</li>
* <li>If the provided {@code url} is not a properly formatted http or https url.</li>
* <li>If the length of {@code iconUrl} is longer than {@link net.dv8tion.jda.api.entities.MessageEmbed#URL_MAX_LENGTH}.</li>
Expand All @@ -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);
Expand Down
Loading

0 comments on commit fa8a40a

Please sign in to comment.