Skip to content

Commit

Permalink
dsu 1.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueTree242 committed Sep 20, 2022
2 parents 544552e + e133adb commit 33dd04a
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 240 deletions.
15 changes: 6 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
compileJava.options.encoding 'UTF-8'
build.finalizedBy shadowJar
Expand All @@ -36,10 +36,10 @@ allprojects {
url = uri('https://repo.citizensnpcs.co')
}
maven {
url = uri('https://nexus.vankka.dev/repository/maven-public/')
url = uri('https://nexus.scarsz.me/repository/maven-public/')
}
maven {
url = uri('http://repo.extendedclip.com/content/repositories/placeholderapi/')
url = uri('https://repo.extendedclip.com/content/repositories/placeholderapi/')
}

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

maven {
url = uri('https://ci.ender.zone/plugin/repository/everything/')
}

maven {
url = uri('https://papermc.io/repo/repository/maven-public/')
}
Expand Down Expand Up @@ -85,6 +81,8 @@ allprojects {
maven { url "https://mvn-repo.arim.space/affero-gpl3" }
maven { url "https://mvn-repo.arim.space/gpl3" }
maven { url "https://mvn-repo.arim.space/lesser-gpl3" }
maven { url "https://repo.dmulloy2.net/repository/public/" }
maven { url "https://repo.essentialsx.net/releases/" }
}
}

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

}

tasks.withType(Copy).all { duplicatesStrategy 'INCLUDE' }
}
shadowJar {
classifier ''
Expand Down
18 changes: 11 additions & 7 deletions bukkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ plugins {
id 'java'
id 'maven-publish'
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
publishing {
publications {
Expand All @@ -47,21 +46,26 @@ def urlFile = { url, name ->
}

dependencies {
implementation 'org.bstats:bstats-bukkit:2.2.1'
implementation 'org.bstats:bstats-bukkit:3.0.0'
compileOnly 'org.spigotmc:spigot-api:1.16.3-R0.1-SNAPSHOT'
compileOnly 'com.gitlab.ruany:LiteBansAPI:0.3.4'
compileOnly 'space.arim.libertybans:bans-api:0.8.0'
compileOnly 'com.github.LeonMangler:SuperVanish:6.2.6-2'
compileOnly 'com.github.LeonMangler:SuperVanish:6.2.12'
compileOnly 'com.github.DevLeoko:AdvancedBan:b4bbb6a'
compileOnly 'me.clip:placeholderapi:2.9.2'
compileOnly 'me.clip:placeholderapi:2.11.2'
compileOnly urlFile("https://github.com/Zrips/CMI-API/releases/download/8.7.8.2/CMIAPI8.7.8.2.jar", "CMI-API")
compileOnly 'net.lapismc:AFKPlus:3.3.13'
compileOnly 'net.lapismc:AFKPlus:3.3.15'
implementation project(":core")
compileOnly('com.discordsrv:discordsrv:1.25.0')
compileOnly 'net.ess3:EssentialsX:2.17.2'
compileOnly('com.discordsrv:discordsrv:1.26.0')
implementation 'org.jooq:jooq:3.14.16'
compileOnly 'net.essentialsx:EssentialsX:2.19.0'
}


test {
useJUnitPlatform()
}

repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ public String run(String stacktrace) throws Exception {
int aesBits = 256;
String key = RandomStringUtils.randomAlphanumeric(aesBits == 256 ? 32 : 16);
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("data", Utils.b64Encode(encrypt(key.getBytes(), data.toString()))).build();
Request request = new Request.Builder().post(body).url("https://mcdebug.bluetree242.tk/api/v1/createDebug").build();
Request request = new Request.Builder().post(body).url("https://mcdebug.bluetree242.ml/api/v1/createDebug").build();
Response response = client.newCall(request).execute();

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


}
Expand Down Expand Up @@ -236,7 +236,7 @@ private String getActiveConfig() {
Iterator<Dynamic> iterator = activeConfig.allChildren().iterator();
while (iterator.hasNext()) {
Dynamic child = iterator.next();
if (child.allChildren().count() == 0) {
if (!child.allChildren().findAny().isPresent()) {
stringBuilder.append(child.key().asObject()).append(": ").append(child.asObject());
} else {
StringJoiner childJoiner = new StringJoiner(", ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@
package tk.bluetree242.discordsrvutils.bukkit;

import github.scarsz.discordsrv.DiscordSRV;
import lombok.Getter;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.AdvancedPie;
import org.bstats.charts.SimplePie;
import org.bukkit.plugin.java.JavaPlugin;
import tk.bluetree242.discordsrvutils.DiscordSRVUtils;
import tk.bluetree242.discordsrvutils.bukkit.listeners.jda.CustomDiscordAccountLinkListener;
import tk.bluetree242.discordsrvutils.bukkit.discordsrv.SlashCommandProvider;

import java.util.HashMap;
import java.util.Map;

public class DiscordSRVUtilsBukkit extends JavaPlugin {
@Getter
private DiscordSRVUtils core = null;

public void onEnable() {
Expand All @@ -49,6 +51,7 @@ public void onEnable() {
((BukkitPlugin) core.getPlatform()).setDiscordSRVUtils(core);
}
core.onEnable();
if (!isEnabled()) return;
//bstats stuff
Metrics metrics = new Metrics(this, 9456);
metrics.addCustomChart(new AdvancedPie("features", () -> {
Expand All @@ -69,6 +72,9 @@ public void onEnable() {
}));
metrics.addCustomChart(new SimplePie("discordsrv_versions", () -> DiscordSRV.getPlugin().getDescription().getVersion()));
metrics.addCustomChart(new SimplePie("admins", () -> core.getJdaManager().getAdminIds().size() + ""));

//discordsrv slash commands api
DiscordSRV.api.addSlashCommandProvider(new SlashCommandProvider(this));
}

public void onDisable() {
Expand All @@ -85,7 +91,6 @@ public void onLoad() {
if (getServer().getPluginManager().getPlugin("DiscordSRV") != null) {
core = new DiscordSRVUtils(new BukkitPlugin(this));
((BukkitPlugin) core.getPlatform()).setDiscordSRVUtils(core);
core.getJdaManager().getListeners().add(new CustomDiscordAccountLinkListener(core));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,54 @@
* END
*/

package tk.bluetree242.discordsrvutils.systems.commandmanagement;
package tk.bluetree242.discordsrvutils.bukkit.discordsrv;

import github.scarsz.discordsrv.DiscordSRV;
import github.scarsz.discordsrv.api.commands.PluginSlashCommand;
import github.scarsz.discordsrv.api.commands.SlashCommand;
import github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel;
import github.scarsz.discordsrv.dependencies.jda.api.events.interaction.SlashCommandEvent;
import github.scarsz.discordsrv.dependencies.jda.api.exceptions.InsufficientPermissionException;
import github.scarsz.discordsrv.dependencies.jda.api.hooks.ListenerAdapter;
import github.scarsz.discordsrv.dependencies.jda.api.interactions.commands.build.CommandData;
import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.NotNull;
import tk.bluetree242.discordsrvutils.DiscordSRVUtils;
import tk.bluetree242.discordsrvutils.bukkit.DiscordSRVUtilsBukkit;
import tk.bluetree242.discordsrvutils.embeds.Embed;
import tk.bluetree242.discordsrvutils.systems.commandmanagement.Command;
import tk.bluetree242.discordsrvutils.systems.commandmanagement.CommandEvent;
import tk.bluetree242.discordsrvutils.systems.commandmanagement.CommandManager;

import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;

@RequiredArgsConstructor
public class CommandListener extends ListenerAdapter {
private final DiscordSRVUtils core;
public class SlashCommandProvider implements github.scarsz.discordsrv.api.commands.SlashCommandProvider {
private final DiscordSRVUtilsBukkit core;
@Override
public Set<PluginSlashCommand> getSlashCommands() {
Set<PluginSlashCommand> commands = new HashSet<>();
if (core.getCore() == null || !core.getCore().isEnabled() || !core.getCore().getMainConfig().register_slash()) return commands;
CommandManager manager = core.getCore().getCommandManager();
for (Command command : manager.getCommands()) {
if (!command.isEnabled()) continue;
commands.add(getCmd(command.getCmd(), command));
for (String alias : command.getAliases()) {
commands.add(getCmd(alias, command));
}
}
return commands;
}


public void onSlashCommand(@NotNull SlashCommandEvent e) {
private PluginSlashCommand getCmd(String alias, Command cmd) {
return new PluginSlashCommand(core, new CommandData(alias, cmd.getDescription()).addOptions(cmd.getOptions()), DiscordSRV.getPlugin().getMainGuild().getId());
}

@SlashCommand(path = "*")
public void onCommand(SlashCommandEvent e) {
DiscordSRVUtils core = this.core.getCore();
if (core.getMainConfig().bungee_mode()) return;
core.getAsyncManager().executeAsync(() -> {
String cmd = e.getName();
Command executor = core.getCommandManager().getCommandHashMap().get(cmd);
if (executor == null || !executor.isEnabled()) return;
Expand All @@ -49,7 +76,7 @@ public void onSlashCommand(@NotNull SlashCommandEvent e) {
if (executor.getRequiredPermission() != null) {
if (e.getChannel() instanceof TextChannel) {
if (!e.getMember().hasPermission(executor.getRequiredPermission())) {
e.replyEmbeds(Embed.error("You don't have permission to use this command.", "Required: " + executor.getRequiredPermission().toString())).queue();
e.replyEmbeds(Embed.error("You don't have permission to use this command.", "Required: " + executor.getRequiredPermission())).queue();
return;
}
}
Expand Down Expand Up @@ -84,7 +111,6 @@ public void onSlashCommand(@NotNull SlashCommandEvent e) {
core.getErrorHandler().defaultHandle(throwables);
}
}
});

}
}

This file was deleted.

20 changes: 11 additions & 9 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ import nu.studer.gradle.jooq.JooqEdition
plugins {
id 'java'
id 'maven-publish'
id 'nu.studer.jooq' version '7.1.1'
id 'nu.studer.jooq' version '5.2.2'
id "org.flywaydb.flyway" version "8.5.3"
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
publishing {
publications {
Expand Down Expand Up @@ -70,19 +69,18 @@ dependencies {
implementation 'com.zaxxer:HikariCP:3.4.5'
implementation 'org.hsqldb:hsqldb:2.4.1'
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.0'
compileOnly('com.discordsrv:discordsrv:1.25.0')
compileOnly('com.discordsrv:discordsrv:1.26.0')
implementation "org.flywaydb:flyway-core:7.5.3"
implementation group: 'org.json', name: 'json', version: '20210307'
implementation 'com.github.ben-manes.caffeine:caffeine:2.9.1'
compileOnly 'org.apache.logging.log4j:log4j-core:2.0-beta9'
implementation 'commons-io:commons-io:2.6'

//related to jooq
implementation 'org.jooq:jooq:3.16.6'
implementation 'org.jooq:jooq:3.14.16'
//using h2 database for code generation as it doesnt uppercase the table/column names, without it, we get into unfixable issues
testImplementation 'com.h2database:h2:2.1.210'
jooqGenerator 'com.h2database:h2:2.1.210'

testImplementation 'com.h2database:h2:1.4.197'
jooqGenerator 'com.h2database:h2:1.4.197'
}


Expand All @@ -98,7 +96,7 @@ afterEvaluate { evaluated ->
}
}
flyway {
url = "jdbc:h2:file:${project.buildDir}/migration;MODE=Mysql;DATABASE_TO_UPPER=false;DATABASE_TO_LOWER=false"
url = "jdbc:h2:file:${project.buildDir}/migration;MODE=Mysql;DATABASE_TO_UPPER=false"
user = 'SA'
password = ''
validateMigrationNaming = true
Expand All @@ -107,7 +105,7 @@ flyway {
}

jooq {
version = '3.16.6' // default (can be omitted)
version = '3.14.16' // default (can be omitted)
edition = JooqEdition.OSS // default (can be omitted)

configurations {
Expand Down Expand Up @@ -169,3 +167,7 @@ jooq {
}
}

repositories {
mavenCentral()
}

Loading

0 comments on commit 33dd04a

Please sign in to comment.