Skip to content

Commit

Permalink
Added gateway intents to allow the plugin to keep working when Discor…
Browse files Browse the repository at this point in the history
…d's new policies are put into effect
  • Loading branch information
TheDutchMC committed Sep 29, 2020
1 parent 2778ed9 commit 449dc32
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
25 changes: 24 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
compile 'org.json:json:20200518'

//JDA
implementation ('net.dv8tion:JDA:4.2.0_168') {
compile ('net.dv8tion:JDA:4.2.0_168') {
exclude module: 'opus-java'
}

Expand All @@ -59,3 +59,26 @@ shadowJar() {
classifier = ''
relocate 'net.dv8tion.jda', 'nl.thedutchmc.libs.jda'
}

task testJar(type: ShadowJar) {

relocate 'net.dv8tion.jda', 'nl.thedutchmc.libs.jda'


description 'Build a test Jar'
archiveClassifier = 'DEV'
from sourceSets.main.output
configurations = [project.configurations.runtime]
destinationDirectory = file("$rootDir/server/plugins")
}

task releaseJar(type: ShadowJar) {

relocate 'net.dv8tion.jda', 'nl.thedutchmc.libs.jda'

description 'Build a release Jar'
archiveClassifier = 'RELEASE'
from sourceSets.main.output
configurations = [project.configurations.runtime]
destinationDirectory = file("$rootDir/releases")
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pluginVersion = 1.0.1
pluginVersion = 1.1
pluginGroup = nl.thedutchmc
pluginName = SkinFixer
pluginAuthor = TheDutchMC
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rootProject.name = pluginName
include ':Spigot_1_16_R1'
include ':Spigot_1_16_R2'
include ':Spigot_1_16_R2'
13 changes: 11 additions & 2 deletions src/main/java/nl/thedutchmc/SkinFixer/JdaHandler.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package nl.thedutchmc.SkinFixer;

import java.util.ArrayList;
import java.util.List;

import javax.security.auth.login.LoginException;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.requests.GatewayIntent;
import nl.thedutchmc.SkinFixer.discordEvents.MessageReceivedEventListener;
import nl.thedutchmc.SkinFixer.fileHandlers.ConfigurationHandler;

Expand All @@ -14,10 +18,15 @@ public class JdaHandler {
private static MessageChannel channel;

public void setupJda() {
JDABuilder jdaBuilder = JDABuilder.createDefault(ConfigurationHandler.token);

List<GatewayIntent> intents = new ArrayList<>();
intents.add(GatewayIntent.GUILD_MESSAGES);

try {
jda = jdaBuilder.build();
jda = JDABuilder.createDefault(ConfigurationHandler.token)
.enableIntents(intents)
.build();

jda.awaitReady();

} catch (LoginException e) {
Expand Down

0 comments on commit 449dc32

Please sign in to comment.