diff --git a/pom.xml b/pom.xml
index 379160b..8ebd18f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
net.mattlabs.mauvelist
MauveList
- 3.0.3
+ 3.0.4
Greylist plugin for deleting user data files/adding new members
@@ -76,20 +76,20 @@
io.papermc.paper
paper-api
- 1.19-R0.1-SNAPSHOT
+ 1.20.4-R0.1-SNAPSHOT
provided
co.aikar
acf-paper
- 0.5.0-SNAPSHOT
+ 0.5.1-SNAPSHOT
com.github.MilkBowl
VaultAPI
- 1.7
+ 1.7.1
provided
@@ -102,30 +102,30 @@
net.kyori
adventure-api
- 4.11.0
+ 4.15.0
net.kyori
adventure-platform-bukkit
- 4.1.2
+ 4.3.2
net.kyori
adventure-text-minimessage
- 4.11.0
+ 4.15.0
com.discordsrv
discordsrv
- 1.25.0
+ 1.27.0
provided
net.dv8tion
JDA
- 5.0.0-alpha.2
+ 5.0.0-beta.19
@@ -163,10 +163,10 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.3
+ 3.8.1
-
- 1.8
+
+ 17
${project.build.sourceEncoding}
@@ -183,7 +183,7 @@
org.apache.maven.plugins
maven-shade-plugin
- 3.2.4
+ 3.5.0
${project.build.directory}/dependency-reduced-pom.xml
@@ -197,6 +197,11 @@
co.aikar.locales
net.mattlabs.mauvelist.locales
+
+
+ org.spongepowered.configurate
+ net.mattlabs.mauvelist.configurate
+
net.mattlabs.configmanager
@@ -259,7 +264,7 @@
org.apache.maven.plugins
maven-antrun-plugin
- 1.8
+ 3.1.0
copy
diff --git a/src/main/java/net/mattlabs/mauvelist/Config.java b/src/main/java/net/mattlabs/mauvelist/Config.java
index 476b270..3f43877 100644
--- a/src/main/java/net/mattlabs/mauvelist/Config.java
+++ b/src/main/java/net/mattlabs/mauvelist/Config.java
@@ -117,7 +117,7 @@ public String getApplicationIntroduction() {
}
@Comment("\nThe application questions (\"What is your Minecraft username?\" is asked by default and does not need to be added here)")
- private ArrayList questions = new ArrayList(Arrays.asList("Question one?", "Question two?", "Question three?"));
+ private ArrayList questions = new ArrayList<>(Arrays.asList("Question one?", "Question two?", "Question three?"));
public ArrayList getQuestions() {
ArrayList allQuestions = new ArrayList<>(questions);
diff --git a/src/main/java/net/mattlabs/mauvelist/MauveList.java b/src/main/java/net/mattlabs/mauvelist/MauveList.java
index 14294fe..a117360 100644
--- a/src/main/java/net/mattlabs/mauvelist/MauveList.java
+++ b/src/main/java/net/mattlabs/mauvelist/MauveList.java
@@ -20,7 +20,6 @@
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
-import javax.security.auth.login.LoginException;
import java.io.File;
import java.util.List;
import java.util.logging.Level;
@@ -94,7 +93,7 @@ public void onEnable() {
// Set Up JDA
try {
jda = JDABuilder.createDefault(config.getBotToken()).setStatus(getOnlineStatusFromString(config.getBotStatus())).build();
- } catch (LoginException e) {
+ } catch (Exception e) {
e.printStackTrace();
this.setEnabled(false);
}
diff --git a/src/main/java/net/mattlabs/mauvelist/commands/MauveListCommand.java b/src/main/java/net/mattlabs/mauvelist/commands/MauveListCommand.java
index 1998fd5..30e656d 100644
--- a/src/main/java/net/mattlabs/mauvelist/commands/MauveListCommand.java
+++ b/src/main/java/net/mattlabs/mauvelist/commands/MauveListCommand.java
@@ -3,9 +3,9 @@
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.dv8tion.jda.api.EmbedBuilder;
-import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.interactions.components.ActionRow;
-import net.dv8tion.jda.api.interactions.components.Button;
+import net.dv8tion.jda.api.interactions.components.buttons.Button;
+import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder;
import net.mattlabs.mauvelist.MauveList;
import net.mattlabs.mauvelist.util.PlayerManager;
import net.mattlabs.mauvelist.util.PlayerUtils;
@@ -46,12 +46,12 @@ public void onAdd(CommandSender commandSender, String name, String discordID) {
@Description("Sends the application message to the relavent channel.")
public void onApplyButton() {
if (mauveList.getConfigML().isEnableDiscord()) {
- MessageBuilder builder = new MessageBuilder();
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle(mauveList.getConfigML().getApplyTitle())
.setDescription(mauveList.getConfigML().getApplyBody())
.setColor(2664261)
.build());
- builder.setActionRows(ActionRow.of(Button.success("apply", "Apply")));
+ builder.setComponents(ActionRow.of(Button.success("apply", "Apply")));
mauveList.getJda().getTextChannelById(mauveList.getConfigML().getApplyChannel()).sendMessage(builder.build()).queue();
mauveList.getLogger().info("Apply message has been sent.");
}
diff --git a/src/main/java/net/mattlabs/mauvelist/listeners/JDAListener.java b/src/main/java/net/mattlabs/mauvelist/listeners/JDAListener.java
index fede773..483a3c3 100644
--- a/src/main/java/net/mattlabs/mauvelist/listeners/JDAListener.java
+++ b/src/main/java/net/mattlabs/mauvelist/listeners/JDAListener.java
@@ -1,8 +1,8 @@
package net.mattlabs.mauvelist.listeners;
-import net.dv8tion.jda.api.entities.ChannelType;
-import net.dv8tion.jda.api.events.interaction.ButtonClickEvent;
+import net.dv8tion.jda.api.entities.channel.ChannelType;
+import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.mattlabs.mauvelist.MauveList;
@@ -13,7 +13,7 @@ public class JDAListener extends ListenerAdapter {
private ApplicationManager applicationManager = MauveList.getInstance().getApplicationManager();
@Override
- public void onButtonClick(ButtonClickEvent event) {
+ public void onButtonInteraction(ButtonInteractionEvent event) {
if (event.getButton().getId().equals("apply")) {
event.deferEdit().queue();
applicationManager.create(event.getUser(), event.getInteraction());
diff --git a/src/main/java/net/mattlabs/mauvelist/messaging/Messages.java b/src/main/java/net/mattlabs/mauvelist/messaging/Messages.java
index cb3f8d7..7478eae 100644
--- a/src/main/java/net/mattlabs/mauvelist/messaging/Messages.java
+++ b/src/main/java/net/mattlabs/mauvelist/messaging/Messages.java
@@ -1,11 +1,11 @@
package net.mattlabs.mauvelist.messaging;
import net.dv8tion.jda.api.EmbedBuilder;
-import net.dv8tion.jda.api.MessageBuilder;
-import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.interactions.components.ActionRow;
-import net.dv8tion.jda.api.interactions.components.Button;
+import net.dv8tion.jda.api.interactions.components.buttons.Button;
+import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder;
+import net.dv8tion.jda.api.utils.messages.MessageCreateData;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
@@ -81,46 +81,46 @@ public Component reloaded() {
// Discord Messages
- public Message applicationUserIntro() {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationUserIntro() {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle(mauveList.getConfigML().getApplyTitle())
.setDescription(mauveList.getConfigML().getApplicationIntroduction())
.setColor(2664261)
.build());
- builder.setActionRows(ActionRow.of(Button.success("applicationStart", "Start Application"), Button.danger("cancel", "Cancel")));
+ builder.setComponents(ActionRow.of(Button.success("applicationStart", "Start Application"), Button.danger("cancel", "Cancel")));
return builder.build();
}
- public Message applicationUserQuestion(String question) {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationUserQuestion(String question) {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle(question)
.setColor(161240)
.build());
return builder.build();
}
- public Message applicationUserSkin(String username) {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationUserSkin(String username) {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle("Your Minecraft username is: `" + username + "`")
.setDescription("Is the skin below your Minecraft skin?")
.setImage("https://crafatar.com/renders/body/" + Bukkit.getOfflinePlayer(username).getUniqueId() + "?overlay")
.setFooter("Please choose an option below.")
.setColor(161240)
.build());
- builder.setActionRows(ActionRow.of(Button.success("acceptSkin", "This is me"), Button.danger("rejectSkin", "This is not me")));
+ builder.setComponents(ActionRow.of(Button.success("acceptSkin", "This is me"), Button.danger("rejectSkin", "This is not me")));
return builder.build();
}
- public Message applicationError(String message) {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationError(String message) {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle("*" + message + "*")
.setColor(14242639)
.build());
return builder.build();
}
- public Message applicationUserComplete() {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationUserComplete() {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle(mauveList.getConfigML().getApplyTitle())
.setDescription(mauveList.getConfigML().getApplicationCompletion())
.setColor(2664261)
@@ -128,8 +128,8 @@ public Message applicationUserComplete() {
return builder.build();
}
- public Message application(User user, ArrayList answers) {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData application(User user, ArrayList answers) {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
long epoch = System.currentTimeMillis() / 1000;
String description = "**@here, " + user.getName() + " has applied for the server. Here is their application:**\n\n" +
@@ -150,13 +150,13 @@ public Message application(User user, ArrayList answers) {
.setColor(161240)
.build());
- builder.setActionRows(ActionRow.of(Button.primary("applicationAccept:" + user.getId(), "Accept"), Button.secondary("applicationReject:" + user.getId(), "Reject")));
+ builder.setComponents(ActionRow.of(Button.primary("applicationAccept:" + user.getId(), "Accept"), Button.secondary("applicationReject:" + user.getId(), "Reject")));
return builder.build();
}
- public Message applicationAccepted(User user, String minecraftUsername, User acceptor) {
+ public MessageCreateData applicationAccepted(User user, String minecraftUsername, User acceptor) {
long epoch = System.currentTimeMillis() / 1000;
- MessageBuilder builder = new MessageBuilder();
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setAuthor("Application accepted for " + user.getName() + " ✅", null, user.getAvatarUrl())
.setDescription("`" + minecraftUsername + "` is now a member.\n\n" +
"Accepted by " + acceptor.getAsMention() + " on *()*.")
@@ -165,18 +165,18 @@ public Message applicationAccepted(User user, String minecraftUsername, User acc
return builder.build();
}
- public Message applicationRejectReason(User user) {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationRejectReason(User user) {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setAuthor("What is the reason for rejecting " + user.getName() + "?", null, user.getAvatarUrl())
.setColor(14242639)
.build());
- builder.setActionRows(ActionRow.of(Button.secondary("rejectNoReason:" + user.getId(), "No Reason")));
+ builder.setComponents(ActionRow.of(Button.secondary("rejectNoReason:" + user.getId(), "No Reason")));
return builder.build();
}
- public Message applicationRejected(User user, String minecraftUsername, User rejector, String reason) {
+ public MessageCreateData applicationRejected(User user, String minecraftUsername, User rejector, String reason) {
long epoch = System.currentTimeMillis() / 1000;
- MessageBuilder builder = new MessageBuilder();
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setAuthor("Application rejected for " + user.getName() + " ⛔", null, user.getAvatarUrl())
.setDescription("`" + minecraftUsername + "` will not be added as a member, application discarded.\n\n" +
"Reason: " + reason + "\n\n" +
@@ -186,8 +186,8 @@ public Message applicationRejected(User user, String minecraftUsername, User rej
return builder.build();
}
- public Message applicationUserAccepted() {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationUserAccepted() {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle(mauveList.getConfigML().getApplyTitle())
.setDescription(mauveList.getConfigML().getAccepted())
.setColor(2664261)
@@ -195,8 +195,8 @@ public Message applicationUserAccepted() {
return builder.build();
}
- public Message applicationUserRejected(String reason) {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationUserRejected(String reason) {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle(mauveList.getConfigML().getApplyTitle())
.setDescription(mauveList.getConfigML().getRejected() +
"\n\nReason: " + reason)
@@ -205,8 +205,8 @@ public Message applicationUserRejected(String reason) {
return builder.build();
}
- public Message applicationFailed(String reason) {
- MessageBuilder builder = new MessageBuilder();
+ public MessageCreateData applicationFailed(String reason) {
+ MessageCreateBuilder builder = new MessageCreateBuilder();
builder.setEmbeds(new EmbedBuilder().setTitle("Application failed")
.setDescription("Reason: " + reason)
.setColor(14242639)
diff --git a/src/main/java/net/mattlabs/mauvelist/util/ApplicationManager.java b/src/main/java/net/mattlabs/mauvelist/util/ApplicationManager.java
index 404bbb0..7267cf4 100644
--- a/src/main/java/net/mattlabs/mauvelist/util/ApplicationManager.java
+++ b/src/main/java/net/mattlabs/mauvelist/util/ApplicationManager.java
@@ -5,9 +5,9 @@
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
-import net.dv8tion.jda.api.interactions.Interaction;
import net.dv8tion.jda.api.interactions.components.ActionRow;
-import net.dv8tion.jda.api.interactions.components.Button;
+import net.dv8tion.jda.api.interactions.components.buttons.Button;
+import net.dv8tion.jda.api.interactions.components.buttons.ButtonInteraction;
import net.mattlabs.mauvelist.Config;
import net.mattlabs.mauvelist.MauveList;
import net.mattlabs.mauvelist.messaging.Messages;
@@ -34,7 +34,7 @@ public class ApplicationManager {
private final Map applications = new HashMap<>();
// Add a new Discord user to the applications map
- public void create(User user, Interaction interaction) {
+ public void create(User user, ButtonInteraction interaction) {
// Check if user has application
if (!hasApplication(user)) {
// Check if user has linked MC account in members group
diff --git a/src/main/java/net/mattlabs/mauvelist/util/ConfigurateManager.java b/src/main/java/net/mattlabs/mauvelist/util/ConfigurateManager.java
index 095de81..a222eb2 100644
--- a/src/main/java/net/mattlabs/mauvelist/util/ConfigurateManager.java
+++ b/src/main/java/net/mattlabs/mauvelist/util/ConfigurateManager.java
@@ -79,6 +79,7 @@ public T load(String fileName) {
}
catch (IOException e) {
MauveList.getInstance().getLogger().severe("Failed to load \"" + fileName + "\" - using a default!");
+ e.printStackTrace();
}
return t;
}