Skip to content

Commit 33dd04a

Browse files
committed
dsu 1.2.10
2 parents 544552e + e133adb commit 33dd04a

File tree

20 files changed

+112
-240
lines changed

20 files changed

+112
-240
lines changed

build.gradle

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
2424
plugins {
2525
id 'java'
2626
id 'maven-publish'
27-
id 'com.github.johnrengelman.shadow' version '6.1.0'
27+
id 'com.github.johnrengelman.shadow' version '7.1.2'
2828
}
2929
compileJava.options.encoding 'UTF-8'
3030
build.finalizedBy shadowJar
@@ -36,10 +36,10 @@ allprojects {
3636
url = uri('https://repo.citizensnpcs.co')
3737
}
3838
maven {
39-
url = uri('https://nexus.vankka.dev/repository/maven-public/')
39+
url = uri('https://nexus.scarsz.me/repository/maven-public/')
4040
}
4141
maven {
42-
url = uri('http://repo.extendedclip.com/content/repositories/placeholderapi/')
42+
url = uri('https://repo.extendedclip.com/content/repositories/placeholderapi/')
4343
}
4444

4545
maven {
@@ -50,10 +50,6 @@ allprojects {
5050
url = uri('https://repo.codemc.org/repository/maven-public')
5151
}
5252

53-
maven {
54-
url = uri('https://ci.ender.zone/plugin/repository/everything/')
55-
}
56-
5753
maven {
5854
url = uri('https://papermc.io/repo/repository/maven-public/')
5955
}
@@ -85,6 +81,8 @@ allprojects {
8581
maven { url "https://mvn-repo.arim.space/affero-gpl3" }
8682
maven { url "https://mvn-repo.arim.space/gpl3" }
8783
maven { url "https://mvn-repo.arim.space/lesser-gpl3" }
84+
maven { url "https://repo.dmulloy2.net/repository/public/" }
85+
maven { url "https://repo.essentialsx.net/releases/" }
8886
}
8987
}
9088

@@ -107,7 +105,6 @@ def commit = project.properties['commit'] == null ? "NONE" : project.properties[
107105
System.out.println("Commit Hash is " + commit)
108106
subprojects {
109107
apply plugin: 'java'
110-
apply plugin: 'maven'
111108
apply plugin: 'maven-publish'
112109
project.jar {
113110
archivesBaseName = 'DiscordSRVUtils-' + project.name
@@ -123,7 +120,7 @@ subprojects {
123120
}
124121

125122
}
126-
123+
tasks.withType(Copy).all { duplicatesStrategy 'INCLUDE' }
127124
}
128125
shadowJar {
129126
classifier ''

bukkit/build.gradle

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ plugins {
2424
id 'java'
2525
id 'maven-publish'
2626
}
27-
apply plugin: 'maven'
2827
apply plugin: 'maven-publish'
2928
publishing {
3029
publications {
@@ -47,21 +46,26 @@ def urlFile = { url, name ->
4746
}
4847

4948
dependencies {
50-
implementation 'org.bstats:bstats-bukkit:2.2.1'
49+
implementation 'org.bstats:bstats-bukkit:3.0.0'
5150
compileOnly 'org.spigotmc:spigot-api:1.16.3-R0.1-SNAPSHOT'
5251
compileOnly 'com.gitlab.ruany:LiteBansAPI:0.3.4'
5352
compileOnly 'space.arim.libertybans:bans-api:0.8.0'
54-
compileOnly 'com.github.LeonMangler:SuperVanish:6.2.6-2'
53+
compileOnly 'com.github.LeonMangler:SuperVanish:6.2.12'
5554
compileOnly 'com.github.DevLeoko:AdvancedBan:b4bbb6a'
56-
compileOnly 'me.clip:placeholderapi:2.9.2'
55+
compileOnly 'me.clip:placeholderapi:2.11.2'
5756
compileOnly urlFile("https://github.com/Zrips/CMI-API/releases/download/8.7.8.2/CMIAPI8.7.8.2.jar", "CMI-API")
58-
compileOnly 'net.lapismc:AFKPlus:3.3.13'
57+
compileOnly 'net.lapismc:AFKPlus:3.3.15'
5958
implementation project(":core")
60-
compileOnly('com.discordsrv:discordsrv:1.25.0')
61-
compileOnly 'net.ess3:EssentialsX:2.17.2'
59+
compileOnly('com.discordsrv:discordsrv:1.26.0')
60+
implementation 'org.jooq:jooq:3.14.16'
61+
compileOnly 'net.essentialsx:EssentialsX:2.19.0'
6262
}
6363

6464

6565
test {
6666
useJUnitPlatform()
67+
}
68+
69+
repositories {
70+
mavenCentral()
6771
}

bukkit/src/main/java/tk/bluetree242/discordsrvutils/bukkit/BukkitDebugger.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ public String run(String stacktrace) throws Exception {
128128
int aesBits = 256;
129129
String key = RandomStringUtils.randomAlphanumeric(aesBits == 256 ? 32 : 16);
130130
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("data", Utils.b64Encode(encrypt(key.getBytes(), data.toString()))).build();
131-
Request request = new Request.Builder().post(body).url("https://mcdebug.bluetree242.tk/api/v1/createDebug").build();
131+
Request request = new Request.Builder().post(body).url("https://mcdebug.bluetree242.ml/api/v1/createDebug").build();
132132
Response response = client.newCall(request).execute();
133133

134134
JSONObject bdy = new JSONObject(response.body().string());
135135
response.close();
136136
if (response.code() != 200) {
137137
return "ERROR: INVALID RESPONSE CODE " + response.code();
138138
}
139-
return "https://mcdebug.bluetree242.tk" + "/" + bdy.getString("id") + "#" + key;
139+
return "https://mcdebug.bluetree242.ml" + "/" + bdy.getString("id") + "#" + key;
140140

141141

142142
}
@@ -236,7 +236,7 @@ private String getActiveConfig() {
236236
Iterator<Dynamic> iterator = activeConfig.allChildren().iterator();
237237
while (iterator.hasNext()) {
238238
Dynamic child = iterator.next();
239-
if (child.allChildren().count() == 0) {
239+
if (!child.allChildren().findAny().isPresent()) {
240240
stringBuilder.append(child.key().asObject()).append(": ").append(child.asObject());
241241
} else {
242242
StringJoiner childJoiner = new StringJoiner(", ");

bukkit/src/main/java/tk/bluetree242/discordsrvutils/bukkit/DiscordSRVUtilsBukkit.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@
2323
package tk.bluetree242.discordsrvutils.bukkit;
2424

2525
import github.scarsz.discordsrv.DiscordSRV;
26+
import lombok.Getter;
2627
import org.bstats.bukkit.Metrics;
2728
import org.bstats.charts.AdvancedPie;
2829
import org.bstats.charts.SimplePie;
2930
import org.bukkit.plugin.java.JavaPlugin;
3031
import tk.bluetree242.discordsrvutils.DiscordSRVUtils;
31-
import tk.bluetree242.discordsrvutils.bukkit.listeners.jda.CustomDiscordAccountLinkListener;
32+
import tk.bluetree242.discordsrvutils.bukkit.discordsrv.SlashCommandProvider;
3233

3334
import java.util.HashMap;
3435
import java.util.Map;
3536

3637
public class DiscordSRVUtilsBukkit extends JavaPlugin {
38+
@Getter
3739
private DiscordSRVUtils core = null;
3840

3941
public void onEnable() {
@@ -49,6 +51,7 @@ public void onEnable() {
4951
((BukkitPlugin) core.getPlatform()).setDiscordSRVUtils(core);
5052
}
5153
core.onEnable();
54+
if (!isEnabled()) return;
5255
//bstats stuff
5356
Metrics metrics = new Metrics(this, 9456);
5457
metrics.addCustomChart(new AdvancedPie("features", () -> {
@@ -69,6 +72,9 @@ public void onEnable() {
6972
}));
7073
metrics.addCustomChart(new SimplePie("discordsrv_versions", () -> DiscordSRV.getPlugin().getDescription().getVersion()));
7174
metrics.addCustomChart(new SimplePie("admins", () -> core.getJdaManager().getAdminIds().size() + ""));
75+
76+
//discordsrv slash commands api
77+
DiscordSRV.api.addSlashCommandProvider(new SlashCommandProvider(this));
7278
}
7379

7480
public void onDisable() {
@@ -85,7 +91,6 @@ public void onLoad() {
8591
if (getServer().getPluginManager().getPlugin("DiscordSRV") != null) {
8692
core = new DiscordSRVUtils(new BukkitPlugin(this));
8793
((BukkitPlugin) core.getPlatform()).setDiscordSRVUtils(core);
88-
core.getJdaManager().getListeners().add(new CustomDiscordAccountLinkListener(core));
8994
}
9095
}
9196

core/src/main/java/tk/bluetree242/discordsrvutils/systems/commandmanagement/CommandListener.java renamed to bukkit/src/main/java/tk/bluetree242/discordsrvutils/bukkit/discordsrv/SlashCommandProvider.java

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,54 @@
2020
* END
2121
*/
2222

23-
package tk.bluetree242.discordsrvutils.systems.commandmanagement;
23+
package tk.bluetree242.discordsrvutils.bukkit.discordsrv;
2424

25+
import github.scarsz.discordsrv.DiscordSRV;
26+
import github.scarsz.discordsrv.api.commands.PluginSlashCommand;
27+
import github.scarsz.discordsrv.api.commands.SlashCommand;
2528
import github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel;
2629
import github.scarsz.discordsrv.dependencies.jda.api.events.interaction.SlashCommandEvent;
2730
import github.scarsz.discordsrv.dependencies.jda.api.exceptions.InsufficientPermissionException;
28-
import github.scarsz.discordsrv.dependencies.jda.api.hooks.ListenerAdapter;
31+
import github.scarsz.discordsrv.dependencies.jda.api.interactions.commands.build.CommandData;
2932
import lombok.RequiredArgsConstructor;
30-
import org.jetbrains.annotations.NotNull;
3133
import tk.bluetree242.discordsrvutils.DiscordSRVUtils;
34+
import tk.bluetree242.discordsrvutils.bukkit.DiscordSRVUtilsBukkit;
3235
import tk.bluetree242.discordsrvutils.embeds.Embed;
36+
import tk.bluetree242.discordsrvutils.systems.commandmanagement.Command;
37+
import tk.bluetree242.discordsrvutils.systems.commandmanagement.CommandEvent;
38+
import tk.bluetree242.discordsrvutils.systems.commandmanagement.CommandManager;
3339

3440
import java.sql.SQLException;
41+
import java.util.HashSet;
42+
import java.util.Set;
3543

3644
@RequiredArgsConstructor
37-
public class CommandListener extends ListenerAdapter {
38-
private final DiscordSRVUtils core;
45+
public class SlashCommandProvider implements github.scarsz.discordsrv.api.commands.SlashCommandProvider {
46+
private final DiscordSRVUtilsBukkit core;
47+
@Override
48+
public Set<PluginSlashCommand> getSlashCommands() {
49+
Set<PluginSlashCommand> commands = new HashSet<>();
50+
if (core.getCore() == null || !core.getCore().isEnabled() || !core.getCore().getMainConfig().register_slash()) return commands;
51+
CommandManager manager = core.getCore().getCommandManager();
52+
for (Command command : manager.getCommands()) {
53+
if (!command.isEnabled()) continue;
54+
commands.add(getCmd(command.getCmd(), command));
55+
for (String alias : command.getAliases()) {
56+
commands.add(getCmd(alias, command));
57+
}
58+
}
59+
return commands;
60+
}
3961

4062

41-
public void onSlashCommand(@NotNull SlashCommandEvent e) {
63+
private PluginSlashCommand getCmd(String alias, Command cmd) {
64+
return new PluginSlashCommand(core, new CommandData(alias, cmd.getDescription()).addOptions(cmd.getOptions()), DiscordSRV.getPlugin().getMainGuild().getId());
65+
}
66+
67+
@SlashCommand(path = "*")
68+
public void onCommand(SlashCommandEvent e) {
69+
DiscordSRVUtils core = this.core.getCore();
4270
if (core.getMainConfig().bungee_mode()) return;
43-
core.getAsyncManager().executeAsync(() -> {
4471
String cmd = e.getName();
4572
Command executor = core.getCommandManager().getCommandHashMap().get(cmd);
4673
if (executor == null || !executor.isEnabled()) return;
@@ -49,7 +76,7 @@ public void onSlashCommand(@NotNull SlashCommandEvent e) {
4976
if (executor.getRequiredPermission() != null) {
5077
if (e.getChannel() instanceof TextChannel) {
5178
if (!e.getMember().hasPermission(executor.getRequiredPermission())) {
52-
e.replyEmbeds(Embed.error("You don't have permission to use this command.", "Required: " + executor.getRequiredPermission().toString())).queue();
79+
e.replyEmbeds(Embed.error("You don't have permission to use this command.", "Required: " + executor.getRequiredPermission())).queue();
5380
return;
5481
}
5582
}
@@ -84,7 +111,6 @@ public void onSlashCommand(@NotNull SlashCommandEvent e) {
84111
core.getErrorHandler().defaultHandle(throwables);
85112
}
86113
}
87-
});
88114

89115
}
90116
}

bukkit/src/main/java/tk/bluetree242/discordsrvutils/bukkit/listeners/jda/CustomDiscordAccountLinkListener.java

Lines changed: 0 additions & 73 deletions
This file was deleted.

core/build.gradle

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ import nu.studer.gradle.jooq.JooqEdition
2626
plugins {
2727
id 'java'
2828
id 'maven-publish'
29-
id 'nu.studer.jooq' version '7.1.1'
29+
id 'nu.studer.jooq' version '5.2.2'
3030
id "org.flywaydb.flyway" version "8.5.3"
3131
}
32-
apply plugin: 'maven'
3332
apply plugin: 'maven-publish'
3433
publishing {
3534
publications {
@@ -70,19 +69,18 @@ dependencies {
7069
implementation 'com.zaxxer:HikariCP:3.4.5'
7170
implementation 'org.hsqldb:hsqldb:2.4.1'
7271
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.0'
73-
compileOnly('com.discordsrv:discordsrv:1.25.0')
72+
compileOnly('com.discordsrv:discordsrv:1.26.0')
7473
implementation "org.flywaydb:flyway-core:7.5.3"
7574
implementation group: 'org.json', name: 'json', version: '20210307'
7675
implementation 'com.github.ben-manes.caffeine:caffeine:2.9.1'
7776
compileOnly 'org.apache.logging.log4j:log4j-core:2.0-beta9'
7877
implementation 'commons-io:commons-io:2.6'
7978

8079
//related to jooq
81-
implementation 'org.jooq:jooq:3.16.6'
80+
implementation 'org.jooq:jooq:3.14.16'
8281
//using h2 database for code generation as it doesnt uppercase the table/column names, without it, we get into unfixable issues
83-
testImplementation 'com.h2database:h2:2.1.210'
84-
jooqGenerator 'com.h2database:h2:2.1.210'
85-
82+
testImplementation 'com.h2database:h2:1.4.197'
83+
jooqGenerator 'com.h2database:h2:1.4.197'
8684
}
8785

8886

@@ -98,7 +96,7 @@ afterEvaluate { evaluated ->
9896
}
9997
}
10098
flyway {
101-
url = "jdbc:h2:file:${project.buildDir}/migration;MODE=Mysql;DATABASE_TO_UPPER=false;DATABASE_TO_LOWER=false"
99+
url = "jdbc:h2:file:${project.buildDir}/migration;MODE=Mysql;DATABASE_TO_UPPER=false"
102100
user = 'SA'
103101
password = ''
104102
validateMigrationNaming = true
@@ -107,7 +105,7 @@ flyway {
107105
}
108106

109107
jooq {
110-
version = '3.16.6' // default (can be omitted)
108+
version = '3.14.16' // default (can be omitted)
111109
edition = JooqEdition.OSS // default (can be omitted)
112110

113111
configurations {
@@ -169,3 +167,7 @@ jooq {
169167
}
170168
}
171169

170+
repositories {
171+
mavenCentral()
172+
}
173+

0 commit comments

Comments
 (0)