From cf6c4cc872c2f53d8df75f747ab18c113453a21f Mon Sep 17 00:00:00 2001 From: TechStreet Date: Fri, 8 Apr 2022 08:35:40 +0100 Subject: [PATCH 01/27] Add node 6 & 7 to helpbot --- .../helpbot/bot/command/impl/stats/plot/PlotLocCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotLocCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotLocCommand.java index ee94dcf8..604fabc1 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotLocCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotLocCommand.java @@ -41,7 +41,7 @@ public ArgumentSet compileArguments() { .addArgument("z", new IntegerArgument()) .addArgument("node", - new SingleArgumentContainer<>(new DefinedObjectArgument<>(1, 2, 3, 4, 5)).optional(null)); + new SingleArgumentContainer<>(new DefinedObjectArgument<>(1, 2, 3, 4, 5, 6, 7)).optional(null)); } @Override From 2413380f955ddd8831e207b0c604619b046db45f Mon Sep 17 00:00:00 2001 From: ki <53353034+uhki@users.noreply.github.com> Date: Wed, 13 Jul 2022 05:17:06 +0300 Subject: [PATCH 02/27] Fixed the chest paramater emoji for ?code command (currently using DF's :c_chest: chest emoji) (#83) --- .../df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java index 457ea27b..60bf79ff 100644 --- a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java +++ b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java @@ -70,6 +70,6 @@ private void generateParameters(CodeObject data, EmbedBuilder builder) { params.append("(None)"); } - builder.addField("<:chest:789269855886901288> Parameters", params.toString(), false); + builder.addField("<:c_chest:988240071960461402> Parameters", params.toString(), false); } } From 96a9a1eac14a6da4ee8f58d2bd7ad6191539ab77 Mon Sep 17 00:00:00 2001 From: Reasonless <28310208+Reasonlesss@users.noreply.github.com> Date: Wed, 13 Jul 2022 03:17:25 +0100 Subject: [PATCH 03/27] Update CowsayCommand.java (#82) * Update CowsayCommand.java * forgor :skull: --- .../helpbot/bot/command/impl/other/fun/CowsayCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/CowsayCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/CowsayCommand.java index 704904a5..d9d069c4 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/CowsayCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/CowsayCommand.java @@ -6,6 +6,7 @@ import com.diamondfire.helpbot.bot.command.impl.Command; import com.diamondfire.helpbot.bot.command.permissions.Permission; import com.diamondfire.helpbot.bot.events.CommandEvent; +import com.diamondfire.helpbot.util.StringUtil; import net.dv8tion.jda.api.EmbedBuilder; public class CowsayCommand extends Command { @@ -63,7 +64,7 @@ public void run(CommandEvent event) { EmbedBuilder builder = new EmbedBuilder() .setTitle("The cow says") - .appendDescription("```\n" + bubbleBuilder.toString() + cowBuilder.toString() + "\n```"); + .appendDescription("```\n" + StringUtil.display(bubbleBuilder.toString() + cowBuilder.toString()) + "\n```"); event.getMessage().getChannel().sendMessageEmbeds(builder.build()).queue(); } From 16cdee7ea8697330bfe6629903c9b2189dc3c478 Mon Sep 17 00:00:00 2001 From: Daedalus <16168171+RedDaedalus@users.noreply.github.com> Date: Tue, 12 Jul 2022 20:28:35 -0600 Subject: [PATCH 04/27] feat: Implement role toggle for bao polls (#84) --- .../java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java b/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java index 60f670e2..a0ee3946 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java +++ b/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java @@ -9,7 +9,8 @@ public enum ReactRole { PROMOTIONS("\uD83D\uDC64", 761779521937735711L), SALES("\uD83C\uDFF7", 761779623322320916L), APP_UPDATES("\uD83D\uDCD4", 770062219362435113L, "Staff Applications"), - MEDIA("\uD83D\uDCF7", 821811669918416897L); + MEDIA("\uD83D\uDCF7", 821811669918416897L), + POLLS("\uD83D\uDCCA", 995746459964166154L, "Bao Polls"); private static final Map roleMap = new HashMap<>(); private final String emoji; From 8e0da9cbc5b1de6222bf1c5640442b341a54ed28 Mon Sep 17 00:00:00 2001 From: Daedalus <16168171+RedDaedalus@users.noreply.github.com> Date: Tue, 12 Jul 2022 22:14:37 -0600 Subject: [PATCH 05/27] bao polls -> polls --- .../java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java b/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java index a0ee3946..c478d89c 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java +++ b/src/main/java/com/diamondfire/helpbot/sys/rolereact/ReactRole.java @@ -10,7 +10,7 @@ public enum ReactRole { SALES("\uD83C\uDFF7", 761779623322320916L), APP_UPDATES("\uD83D\uDCD4", 770062219362435113L, "Staff Applications"), MEDIA("\uD83D\uDCF7", 821811669918416897L), - POLLS("\uD83D\uDCCA", 995746459964166154L, "Bao Polls"); + POLLS("\uD83D\uDCCA", 995746459964166154L); private static final Map roleMap = new HashMap<>(); private final String emoji; From 99d517b2605f22f5386e3f12741ae9e6c238ff81 Mon Sep 17 00:00:00 2001 From: Reasonless <28310208+Reasonlesss@users.noreply.github.com> Date: Sat, 23 Jul 2022 08:39:29 +0100 Subject: [PATCH 06/27] Fix Dictionaries in ?code (#85) --- .../helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java index 65b96915..4f8bbfc4 100644 --- a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java +++ b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java @@ -62,6 +62,7 @@ enum ParamConverter { POTION("Potion"), VARIABLE("Variable"), LIST("List"), + DICT("Dictionary"), ITEM("Item"), PROJECTILE("Projectile"), SPAWN_EGG("Spawn Egg"), From 1d700a0edc38135d51568a5fd114cb20ddaf93b2 Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Tue, 9 Aug 2022 09:50:31 -0400 Subject: [PATCH 07/27] Yourkit --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 014e40e4..8a2caae4 100644 --- a/README.md +++ b/README.md @@ -61,3 +61,13 @@ After setting up the config, you will need to paste the following into the swear ] } ``` + +## Special Thanks To + +![YourKit Logo](https://www.yourkit.com/images/yklogo.png) + +YourKit supports open source projects with innovative and intelligent tools +for monitoring and profiling Java and .NET applications. +YourKit is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), +[YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/), +and [YourKit YouMonitor](ttps://www.yourkit.com/youmonitor/). From 6c5b42556b5ea8d9ca1db4c39be74d2f3c1a0c46 Mon Sep 17 00:00:00 2001 From: Daedalus <16168171+RedDaedalus@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:10:19 -0600 Subject: [PATCH 08/27] Delete ?query command (#86) * Delete QueryCommand.java * Unregister command --- .../helpbot/bot/HelpBotInstance.java | 1 - .../command/impl/other/dev/QueryCommand.java | 91 ------------------- 2 files changed, 92 deletions(-) delete mode 100644 src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index d36a5ab2..b55eeaa2 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -67,7 +67,6 @@ public static void initialize() throws LoginException { new DisableCommand(), new ImageDumpCommand(), new SoundListCommand(), - new QueryCommand(), new RulesCommand(), new BulkExecuteCommand(), new PermUnlocksCommand(), diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java deleted file mode 100644 index 0e85f3c6..00000000 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.diamondfire.helpbot.bot.command.impl.other.dev; - -import com.diamondfire.helpbot.bot.command.argument.ArgumentSet; -import com.diamondfire.helpbot.bot.command.argument.impl.parsing.types.MessageArgument; -import com.diamondfire.helpbot.bot.command.help.*; -import com.diamondfire.helpbot.bot.command.impl.Command; -import com.diamondfire.helpbot.bot.command.permissions.Permission; -import com.diamondfire.helpbot.bot.events.CommandEvent; -import com.diamondfire.helpbot.sys.database.impl.DatabaseQuery; -import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; -import com.diamondfire.helpbot.util.StringUtil; -import net.dv8tion.jda.api.EmbedBuilder; - -import java.io.*; -import java.sql.ResultSet; -import java.util.*; - - -public class QueryCommand extends Command { - - @Override - public String getName() { - return "query"; - } - - @Override - public HelpContext getHelpContext() { - return new HelpContext() - .description("Executes given query.") - .category(CommandCategory.OTHER) - .addArgument( - new HelpContextArgument() - .name("query") - ); - } - - @Override - public ArgumentSet compileArguments() { - return new ArgumentSet() - .addArgument("query", new MessageArgument()); - } - - @Override - public Permission getPermission() { - return Permission.BOT_DEVELOPER; - } - - @SuppressWarnings("LanguageMismatch") - @Override - public void run(CommandEvent event) { - String query = event.getArgument("query"); - EmbedBuilder builder = new EmbedBuilder(); - builder.setTitle("SQL Result"); - - try { - new DatabaseQuery() - .query(new BasicQuery(query)) - .compile() - .run((set) -> { - int width = set.getResult().getMetaData().getColumnCount(); - List objects = new ArrayList<>(); - for (ResultSet resultSet : set) { - HashMap entries = new HashMap<>(); - for (int i = 1; i <= width; i++) { - String columnName = resultSet.getMetaData().getColumnName(i); - entries.put(columnName, String.valueOf(resultSet.getObject(i))); - } - objects.add(StringUtil.asciidocStyle(entries)); - } - - for (int i = 0; i < objects.size(); i++) { - if (i > 25) { - break; - } - builder.addField("Row: " + (i + 1), String.format("```asciidoc\n%s```", objects.get(i)), false); - } - - event.getReplyHandler().reply(builder); - }); - } catch (IllegalStateException e) { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String sStackTrace = sw.toString(); - builder.setTitle("Query failed! " + e.getClass().getName()); - event.getChannel().sendMessageEmbeds(builder.build()).queue(); - event.getChannel().sendMessage(String.format("```%s```", sStackTrace.length() >= 1500 ? sStackTrace.substring(0, 1500) : sStackTrace)).queue(); - } - - } - -} From b003593aefa6635e19cf519c49f3d66d8063f889 Mon Sep 17 00:00:00 2001 From: Daedalus <16168171+RedDaedalus@users.noreply.github.com> Date: Sat, 1 Oct 2022 12:17:21 -0600 Subject: [PATCH 09/27] chore: Move to gradle Kotlin DSL (groovy sucks nobody likes it) (#88) --- build.gradle => build.gradle.kts | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) rename build.gradle => build.gradle.kts (52%) diff --git a/build.gradle b/build.gradle.kts similarity index 52% rename from build.gradle rename to build.gradle.kts index afd46332..7bd7392a 100644 --- a/build.gradle +++ b/build.gradle.kts @@ -1,3 +1,53 @@ +plugins { + java + application + id("com.github.johnrengelman.shadow") version "7.1.2" +} + +application { + mainClass.set("com.diamondfire.helpbot.HelpBot") +} + +group = "com.diamondfire.helpbot" + +repositories { + mavenCentral() + maven(url = "https://jitpack.io") + maven(url = "https://m2.dv8tion.net/releases") +} + +dependencies { + implementation("net.dv8tion:JDA:4.3.0_305") { + exclude(module = "opus-java") + } + + implementation("club.minnced:discord-webhooks:0.5.8") + implementation("ch.qos.logback:logback-classic:1.2.5") + implementation("com.google.code.gson:gson:2.8.6") + implementation("com.github.Steveice10:MCProtocolLib:c5e4b66") + implementation("mysql:mysql-connector-java:5.1.13") + implementation("org.codehaus.groovy:groovy-jsr223:3.0.8") +} + +tasks { + compileJava { + options.encoding = "UTF-8" + } + + jar { + manifest { + attributes["Main-Class"] = "com.diamondfire.helpbot.HelpBot" + } + } + + build { + dependsOn(shadowJar) + } +} + + + +/* plugins { id 'java' id 'application' @@ -43,3 +93,5 @@ build { shadowJar } } + + */ \ No newline at end of file From eec5d687cbb3b8b952c675348cd9ff5eca07d612 Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Sat, 1 Oct 2022 14:45:28 -0400 Subject: [PATCH 10/27] Update gradle settings + remove old commented config (#89) --- build.gradle.kts | 53 +-------------------------------------------- settings.gradle | 2 -- settings.gradle.kts | 2 ++ 3 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 7bd7392a..e6669d82 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,55 +43,4 @@ tasks { build { dependsOn(shadowJar) } -} - - - -/* -plugins { - id 'java' - id 'application' - id 'com.github.johnrengelman.shadow' version '7.0.0' -} -mainClassName = 'com.diamondfire.helpbot.HelpBot' -group 'com.diamondfire.helpbot' - -repositories { - mavenCentral() - maven { url 'https://jitpack.io' } - maven { - name 'm2-dv8tion' - url 'https://m2.dv8tion.net/releases' - } -} - -dependencies { - implementation ("net.dv8tion:JDA:4.3.0_305") { - exclude module: 'opus-java' - } - implementation 'club.minnced:discord-webhooks:0.5.8' - implementation 'ch.qos.logback:logback-classic:1.2.5' - implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6' - implementation 'com.github.Steveice10:MCProtocolLib:c5e4b66' - implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.13' - implementation group: 'org.codehaus.groovy', name: 'groovy-jsr223', version: '3.0.8' -} - -compileJava.options.encoding = 'UTF-8' -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -jar { - manifest { - attributes("Main-Class": "com.diamondfire.helpbot.HelpBot") - } -} - -build { - dependsOn { - shadowJar - } -} - - */ \ No newline at end of file +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 4dc9ef82..00000000 --- a/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = 'DFHelpBot' - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..73b2f357 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,2 @@ +rootProject.name = "DFHelpBot" + From 61d13331fc2d64c499da0f628ff47e7394b8615f Mon Sep 17 00:00:00 2001 From: Daedalus <16168171+RedDaedalus@users.noreply.github.com> Date: Sat, 1 Oct 2022 13:21:39 -0600 Subject: [PATCH 11/27] fix: Rename Expert to SrHelper (#90) --- .../helpbot/bot/command/impl/other/tag/AddTagSubCommand.java | 2 +- .../helpbot/bot/command/impl/other/tag/EditTagSubCommand.java | 2 +- .../bot/command/impl/other/tag/RemoveTagSubCommand.java | 2 +- .../bot/command/impl/other/util/BulkExecuteCommand.java | 2 +- .../helpbot/bot/command/impl/stats/StaffListCommand.java | 4 ++-- .../bot/command/impl/stats/support/ExcusedStaffCommand.java | 2 +- .../bot/command/impl/stats/support/JoinBadCommand.java | 2 +- .../impl/stats/support/SupportBannedPlayersCommand.java | 2 +- .../helpbot/bot/command/permissions/Permission.java | 2 +- src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java | 2 +- .../helpbot/sys/tasks/impl/SupportUnexcuseTask.java | 4 ++-- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/AddTagSubCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/AddTagSubCommand.java index d4bd27b4..c644965a 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/AddTagSubCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/AddTagSubCommand.java @@ -46,7 +46,7 @@ protected ArgumentSet compileArguments() { @Override public Permission getPermission() { - return Permission.EXPERT + return Permission.SR_HELPER .setOverrides(this, 808966728201666620L); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/EditTagSubCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/EditTagSubCommand.java index 8b596a97..754def3b 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/EditTagSubCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/EditTagSubCommand.java @@ -46,7 +46,7 @@ protected ArgumentSet compileArguments() { @Override public Permission getPermission() { - return Permission.EXPERT + return Permission.SR_HELPER .setOverrides(this, 808966728201666620L); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/RemoveTagSubCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/RemoveTagSubCommand.java index 67f2581c..6b018ae9 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/RemoveTagSubCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/tag/RemoveTagSubCommand.java @@ -39,7 +39,7 @@ protected ArgumentSet compileArguments() { @Override public Permission getPermission() { - return Permission.EXPERT + return Permission.SR_HELPER .setOverrides(this, 808966728201666620L); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/BulkExecuteCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/BulkExecuteCommand.java index 5f57a99b..80e2135a 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/BulkExecuteCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/BulkExecuteCommand.java @@ -58,7 +58,7 @@ public ArgumentSet compileArguments() { @Override public Permission getPermission() { - return Permission.EXPERT; + return Permission.SR_HELPER; } @Override diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/StaffListCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/StaffListCommand.java index b86bfd7b..53e3fa5b 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/StaffListCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/StaffListCommand.java @@ -60,7 +60,7 @@ public void run(CommandEvent event) { registerRank(ranks, Rank.JRHELPER, Rank.HELPER, - Rank.EXPERT, + Rank.SR_HELPER, Rank.JRMOD, Rank.MOD, Rank.SR_MOD, @@ -85,7 +85,7 @@ public void run(CommandEvent event) { } EmbedBuilder supportPage = new EmbedBuilder(); - EmbedUtil.addFields(supportPage, ranks.get(Rank.EXPERT), "", "Experts"); + EmbedUtil.addFields(supportPage, ranks.get(Rank.SR_HELPER), "", "SrHelpers"); EmbedUtil.addFields(supportPage, ranks.get(Rank.HELPER), "", "Helpers"); EmbedUtil.addFields(supportPage, ranks.get(Rank.JRHELPER), "", "JrHelpers"); builder.addPage("Support", supportPage); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java index 76da174d..a2279402 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java @@ -37,7 +37,7 @@ public ArgumentSet compileArguments() { @Override public Permission getPermission() { - return Permission.EXPERT; + return Permission.SR_HELPER; } @Override diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/JoinBadCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/JoinBadCommand.java index 1e68e442..7b0da837 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/JoinBadCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/JoinBadCommand.java @@ -47,7 +47,7 @@ public ArgumentSet compileArguments() { @Override public Permission getPermission() { - return Permission.EXPERT; + return Permission.SR_HELPER; } @Override diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/SupportBannedPlayersCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/SupportBannedPlayersCommand.java index 9b32e30e..092445c0 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/SupportBannedPlayersCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/SupportBannedPlayersCommand.java @@ -35,7 +35,7 @@ public ArgumentSet compileArguments() { @Override public Permission getPermission() { - return Permission.EXPERT; + return Permission.SR_HELPER; } @Override diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java index 8f69f446..a4afcbba 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java @@ -12,7 +12,7 @@ public enum Permission { // Ask DragonSlasher, not me. ADMINISTRATOR(180794313494495233L, 666), MODERATION(180794061429538816L, 5), - EXPERT(299109861696995329L, 4), + SR_HELPER(299109861696995329L, 4), SUPPORT(180794530398732288L, 3), RETIRED_SUPPORT(235159617108181003L, 2), USER(349434193517740033L, 1); diff --git a/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java b/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java index 8628606e..64c0658d 100644 --- a/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java +++ b/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java @@ -18,7 +18,7 @@ public enum Rank { // Support JRHELPER("JrHelper", 1, RankBranch.SUPPORT, "S_JrHelper"), HELPER("Helper", 2, RankBranch.SUPPORT, "Helper"), - EXPERT("Expert", 3, RankBranch.SUPPORT, "S_Expert"), + SR_HELPER("SrHelper", 3, RankBranch.SUPPORT, "S_Expert"), // Moderation JRMOD("JrMod", 1, RankBranch.MODERATION, "JrModerator"), MOD("Mod", 2, RankBranch.MODERATION, "Moderator"), diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java index 04515a1b..dd59273c 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java @@ -18,7 +18,7 @@ public class SupportUnexcuseTask implements OneTimeTask { - private static final long EXPERT_CHAT = 467729470539694091L; + private static final long SR_HELPER_CHAT = 467729470539694091L; private static final Command[] commandsToRun = new Command[]{ new StatsCommand(), new LastJoinedCommand(), @@ -41,7 +41,7 @@ public long getExecution() { @Override public void run() { PresetBuilder builder = new PresetBuilder(); - TextChannel channel = HelpBotInstance.getJda().getTextChannelById(EXPERT_CHAT); + TextChannel channel = HelpBotInstance.getJda().getTextChannelById(SR_HELPER_CHAT); new DatabaseQuery() .query(new BasicQuery("SELECT * FROM players WHERE players.uuid = ?", (statement) -> statement.setString(1, uuid))) From 85bf9489fc494a6a4e2083a3f8763acb5258eebe Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Sat, 1 Oct 2022 16:11:17 -0400 Subject: [PATCH 12/27] Remove some old + generally outdated stuff (#91) --- build.gradle.kts | 2 +- .../helpbot/bot/HelpBotInstance.java | 11 +- .../impl/other/fun/SamQuotesCommand.java | 468 +----------------- .../impl/other/mod/ChannelMuteCommand.java | 2 +- .../impl/other/mod/DiscussionMuteCommand.java | 103 ---- .../command/impl/other/mod/UnmuteCommand.java | 10 +- .../stats/individualized/HistoryCommand.java | 18 +- .../sys/tasks/impl/MuteExpireTask.java | 25 +- 8 files changed, 30 insertions(+), 609 deletions(-) delete mode 100644 src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/DiscussionMuteCommand.java diff --git a/build.gradle.kts b/build.gradle.kts index e6669d82..eb98c31c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,7 +17,7 @@ repositories { } dependencies { - implementation("net.dv8tion:JDA:4.3.0_305") { + implementation("net.dv8tion:JDA:4.4.0_350") { exclude(module = "opus-java") } diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index b55eeaa2..380d2007 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -54,7 +54,7 @@ public static void initialize() throws LoginException { new FetchDataCommand(), new InfoCommand(), new EvalCommand(), - new GarfieldCommand(), + // new GarfieldCommand(), - Dead new HelpCommand(), new RestartCommand(), new ActionDumpCommand(), @@ -74,10 +74,10 @@ public static void initialize() throws LoginException { new MutedCommand(), new UnmuteCommand(), new VerifyCommand(), - new PollCommand(), + // new PollCommand(), - Unused new IdeaCommand(), new StoreCommand(), - new ChannelMuteCommand(), + // new ChannelMuteCommand(), - not finished // statsbot new StatsCommand(), new SupportBadCommand(), @@ -103,7 +103,7 @@ public static void initialize() throws LoginException { new QueueCommand(), new WhoHelpedCommand(), new HelpedByCommand(), - new NamesCommand(), + // new NamesCommand(), - Dead new PlayerJoinGraphCommand(), //new CpCommand(), //new CpRequirementsCommand(), @@ -121,11 +121,10 @@ public static void initialize() throws LoginException { new ExcuseStaffCommand(), new ExcusedStaffCommand(), new SupportBannedPlayersCommand(), - new DiscussionMuteCommand(), new NbsCommand(), new DailySessionsCommand(), new EightBallCommand(), - new OcrCommand(), + // new OcrCommand(), - Dead new JoinsCommand(), new TagCommand(), new PurgeCommand() diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java index 5345536e..8bfc9488 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java @@ -35,18 +35,7 @@ public String getName() { public HelpContext getHelpContext() { return new HelpContext() .description("Gets a quote from Sam the Man.") - .category(CommandCategory.OTHER) - .addArgument( - new HelpContextArgument() - .name("get"), - new HelpContextArgument() - .name("submit (beginning word)"), - new HelpContextArgument() - .name("generate"), - new HelpContextArgument() - .name("reload"), - new HelpContextArgument() - .name("count")); + .category(CommandCategory.OTHER); } @Override @@ -56,459 +45,20 @@ public Permission getPermission() { @Override public void run(CommandEvent event) { + String[] strings = ExternalFiles.SAM_DIR.list(); - if (event.getArgument("action") == null) { + File file = new File(ExternalFiles.SAM_DIR, strings[random.nextInt(strings.length)]); + EmbedBuilder builder = new EmbedBuilder(); + builder.setTitle("Sam Quote"); + builder.setImage("attachment://quote.png"); + builder.setColor(new Color(87, 177, 71)); - String[] strings = ExternalFiles.SAM_DIR.list(); - File file = new File(ExternalFiles.SAM_DIR, strings[random.nextInt(strings.length)]); - EmbedBuilder builder = new EmbedBuilder(); - builder.setTitle("Sam Quote"); - builder.setImage("attachment://quote.png"); - builder.setColor(new Color(87, 177, 71)); - - event.getChannel().sendMessageEmbeds(builder.build()).addFile(file, "quote.png").queue(); - - } else if (event.getArgument("action").equals("submit")) { - - String[] message = event.getMessage().getContentRaw().split("/"); - - if(message.length != 7 || message[5] == null || message[6] == null || message[5].length() != 18 || message[6].length() != 18) { - - PresetBuilder error = new PresetBuilder(); - - error.withPreset( - new InformativeReply(InformativeReplyType.ERROR, "This is not a samquote!") - ); - - event.reply(error); - - return; - } - - long channelID = Long.parseLong(message[5]); - long messageID = Long.parseLong(message[6]); - - event.getGuild().getTextChannelById(channelID).retrieveMessageById(messageID).queue((messageText) -> { - - if(messageText.getAuthor().getIdLong() == 132092551782989824L) { - - try { - - BufferedImage samPfp = ImageIO.read(ExternalFiles.SAMMAN); - - String text = " " + messageText.getContentRaw().replaceAll("[^a-zA-Z0-9 ]", ""); - - int pfpWidth = samPfp.getWidth() * 10; - - //crop pfp into a circle - - BufferedImage circleBuffer = new BufferedImage(pfpWidth, pfpWidth, BufferedImage.TYPE_INT_ARGB); - Graphics2D g2 = circleBuffer.createGraphics(); - - g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - g2.setClip(new Ellipse2D.Float(0, 0, pfpWidth, pfpWidth)); - g2.drawImage(samPfp, 0, 0, pfpWidth, pfpWidth, null); - - //convert text into image - - BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); - - Graphics2D g2d = img.createGraphics(); - - Font font = new Font("Whitney", Font.PLAIN, 140); - g2d.setFont(font); - FontMetrics fm = g2d.getFontMetrics(); - - int width = fm.stringWidth(text); - int height = fm.getHeight() * 2; - - g2d.dispose(); - - img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - - g2d = img.createGraphics(); - - g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); - g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); - g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); - g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); - - g2d.setFont(font); - g2d.setColor(Color.WHITE); - g2d.drawString(text, 0, fm.getAscent() * 2.2f); - - g2d.dispose(); - - //convert SamMan_ into image - - BufferedImage img2 = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); - - Graphics2D g2d2 = img2.createGraphics(); - - Font font2 = new Font("Whitney", Font.BOLD, 140); - g2d2.setFont(font2); - FontMetrics fm2 = g2d2.getFontMetrics(); - - int width2 = fm2.stringWidth(" SamMan_"); - int height2 = fm2.getHeight(); - - g2d2.dispose(); - - img2 = new BufferedImage(width2, height2, BufferedImage.TYPE_INT_ARGB); - - g2d2 = img2.createGraphics(); - - g2d2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); - g2d2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); - g2d2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); - g2d2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); - g2d2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2d2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - g2d2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); - - g2d2.setFont(font); - Color nameColor = new Color(45, 102, 212); - g2d2.setColor(nameColor); - g2d2.drawString(" SamMan_", 0, fm2.getAscent()); - - g2d2.dispose(); - - //create background image - - BufferedImage combined = new BufferedImage(Math.max(img.getWidth(), img2.getWidth()) + 10, img.getHeight() + 10, BufferedImage.TYPE_INT_ARGB); - - Graphics g = combined.getGraphics(); - - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - - Color bgColor = new Color(54,57,63); - - BufferedImage bg = new BufferedImage(Math.max(img.getWidth(), img2.getWidth()) + 30, height + 30, BufferedImage.TYPE_INT_ARGB); - Graphics2D bgg = bg.createGraphics(); - bgg.setPaint (bgColor); - bgg.fillRect (0, 0, bg.getWidth(), bg.getHeight()); - bgg.dispose(); - - //combine images - - g.drawImage(bg, 0, 0, bgColor, null); - g.drawImage(img, 5, 5, bgColor, null); - g.drawImage(img2, 5, 5, bgColor, null); - g.drawImage(circleBuffer, 5, 5, height, height, bgColor, null); - - //save image - - File imageFile = new File(ExternalFiles.SAM_DIR, messageText.getContentRaw().replaceAll("[^a-zA-Z0-9]", "") + ".png"); - ImageIO.write(combined, "PNG", imageFile); - - PresetBuilder success = new PresetBuilder(); - - success.withPreset( - new InformativeReply(InformativeReplyType.SUCCESS, "Your SamQuote has been added!") - ); - - event.reply(success); - - addSamquote(messageText.getContentRaw().replaceAll("[^a-zA-Z0-9]", "")); - - } catch (IOException e) { - - e.printStackTrace(); - - } - - } else { - - PresetBuilder error = new PresetBuilder(); - - error.withPreset( - new InformativeReply(InformativeReplyType.ERROR, "This is not a samquote!") - ); - - event.reply(error); - - } - - }); - } else if (event.getArgument("action").equals("generate")) { - - File file = new File("samquotes.txt"); - - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(file)); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - - ArrayList startingTexts = new ArrayList<>(); - - String line = null; - while (true) { - try { - if ((line = br.readLine()) == null) break; - } catch (IOException e) { - e.printStackTrace(); - } - - startingTexts.add(line.split(" ")[0]); - } - - String word; - - if (event.getMessage().getContentRaw().split(" ").length == 2) { - - word = startingTexts.get((int) Math.rint(Math.random() * startingTexts.size())); - } else { - - if (startingTexts.contains(event.getMessage().getContentRaw().split(" ")[2])) { - - word = event.getMessage().getContentRaw().split(" ")[2]; - - } else { - - PresetBuilder error = new PresetBuilder(); - - error.withPreset( - new InformativeReply(InformativeReplyType.ERROR, "Sam has never started a message with this word before!") - ); - - return; - } - } - String string = ""; - for (int i = 0; i < 50; i++) { - - if (word == null || word.equals(".")) break; - string += word + " "; - try { - word = getNextWord(word); - } catch (IOException e) { - e.printStackTrace(); - } - } - - BufferedImage samPfp = null; - try { - samPfp = ImageIO.read(ExternalFiles.SAMMAN); - } catch (IOException e) { - e.printStackTrace(); - } - - String text = " " + string; - - int pfpWidth = samPfp.getWidth() * 10; - - //crop pfp into a circle - - BufferedImage circleBuffer = new BufferedImage(pfpWidth, pfpWidth, BufferedImage.TYPE_INT_ARGB); - - Graphics2D g2 = circleBuffer.createGraphics(); - - g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - - g2.setClip(new Ellipse2D.Float(0, 0, pfpWidth, pfpWidth)); - g2.drawImage(samPfp, 0, 0, pfpWidth, pfpWidth, null); - - //convert text into image - - BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); - - Graphics2D g2d = img.createGraphics(); - - Font font = new Font("Whitney", Font.PLAIN, 140); - g2d.setFont(font); - FontMetrics fm = g2d.getFontMetrics(); - - int width = fm.stringWidth(text); - int height = fm.getHeight() * 2; - - g2d.dispose(); - - img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - - g2d = img.createGraphics(); - - g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); - g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); - g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); - g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); - - g2d.setFont(font); - g2d.setColor(Color.WHITE); - g2d.drawString(text, 0, fm.getAscent() * 2.2f); - - g2d.dispose(); - - //convert SamMan_ into image - - BufferedImage img2 = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); - - Graphics2D g2d2 = img2.createGraphics(); - - Font font2 = new Font("Whitney", Font.BOLD, 140); - g2d2.setFont(font2); - FontMetrics fm2 = g2d2.getFontMetrics(); - - int width2 = fm2.stringWidth(" SamMan_"); - int height2 = fm2.getHeight(); - - g2d2.dispose(); - - img2 = new BufferedImage(width2, height2, BufferedImage.TYPE_INT_ARGB); - - g2d2 = img2.createGraphics(); - - g2d2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); - g2d2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); - g2d2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); - g2d2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); - g2d2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2d2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - g2d2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); - - g2d2.setFont(font); - - double colorChance = Math.random(); - - - Color nameColor; - - if (colorChance < 0.1) { - - nameColor = new Color(255, 153, 227); - - } else if (colorChance < 0.3) { - - nameColor = new Color(255, 225, 76); - - } else if (colorChance < 0.6) { - - nameColor = new Color(35, 255, 38); - - } else { - - nameColor = new Color(45, 102, 212); - } - - g2d2.setColor(nameColor); - g2d2.drawString(" SamMan_", 0, fm2.getAscent()); - - g2d2.dispose(); - - //create background image - - BufferedImage combined = new BufferedImage(Math.max(img.getWidth(), img2.getWidth()) + 10, img.getHeight() + 10, BufferedImage.TYPE_INT_ARGB); - - Graphics g = combined.getGraphics(); - - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - - Color bgColor = new Color(54,57,63); - - BufferedImage bg = new BufferedImage(Math.max(img.getWidth(), img2.getWidth()) + 30, height + 30, BufferedImage.TYPE_INT_ARGB); - Graphics2D bgg = bg.createGraphics(); - bgg.setPaint (bgColor); - bgg.fillRect (0, 0, bg.getWidth(), bg.getHeight()); - bgg.dispose(); - - //combine images - - g.drawImage(bg, 0, 0, bgColor, null); - g.drawImage(img, 5, 5, bgColor, null); - g.drawImage(img2, 5, 5, bgColor, null); - g.drawImage(circleBuffer, 5, 5, height, height, bgColor, null); - - File samQuote = new File(ExternalFiles.OTHER_CACHE_DIR, "quote.png"); - try { - ImageIO.write(combined, "PNG", samQuote); - } catch (IOException e) { - e.printStackTrace(); - } - EmbedBuilder builder = new EmbedBuilder(); - builder.setTitle("Sam Quote"); - builder.setImage("attachment://quote.png"); - builder.setColor(new Color(87, 177, 71)); - - event.getChannel().sendMessageEmbeds(builder.build()).addFile(samQuote, "quote.png").queue(); - - } else if (event.getArgument("action").equals("reload")) { - - try { - cacheData(); - } catch (IOException e) { - e.printStackTrace(); - } - - } else if (event.getArgument("action").equals("count")) { - - String[] strings = ExternalFiles.SAM_DIR.list(); - - EmbedBuilder builder = new EmbedBuilder(); - builder.setTitle("Total Sam Quotes:"); - builder.setDescription("" + strings.length); - builder.setColor(new Color(87, 177, 71)); - - event.getChannel().sendMessageEmbeds(builder.build()).queue(); - - } else { - - String[] strings = ExternalFiles.SAM_DIR.list(); - File file = new File(ExternalFiles.SAM_DIR, strings[random.nextInt(strings.length)]); - EmbedBuilder builder = new EmbedBuilder(); - builder.setTitle("Sam Quote"); - builder.setImage("attachment://quote.png"); - builder.setColor(new Color(87, 177, 71)); - - event.getChannel().sendMessageEmbeds(builder.build()).addFile(file, "quote.png").queue(); - - } - + event.getChannel().sendMessageEmbeds(builder.build()).addFile(file, "quote.png").queue(); } @Override public ArgumentSet compileArguments() { - return new ArgumentSet() - .addArgument("action", - new SingleArgumentContainer<>(new DefinedObjectArgument<>("submit", "generate", "get", "reload", "count")).optional(null)); - } - - private void addSamquote(String samquote) { - - try { - - File file = new File("samquotes.txt"); - BufferedReader br = new BufferedReader(new FileReader(file)); - - String line; - String newFile = ""; - - while ((line = br.readLine()) != null) { - - if (line != samquote) { newFile += line + "\n"; } - } - - newFile += samquote; - - FileWriter fileWriter = new FileWriter("samquotes.txt"); - fileWriter.write(newFile); - fileWriter.close(); - - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } + return new ArgumentSet(); } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java index 33d90d2d..96491723 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java @@ -89,7 +89,7 @@ public void run(CommandEvent event) { textChannel.putPermissionOverride(member).deny(net.dv8tion.jda.api.Permission.MESSAGE_ADD_REACTION, net.dv8tion.jda.api.Permission.MESSAGE_WRITE).queue(); }); - HelpBotInstance.getScheduler().schedule(new MuteExpireTask(user, finalDuration, false)); + HelpBotInstance.getScheduler().schedule(new MuteExpireTask(user, finalDuration)); event.reply(builder); }, (error) -> { builder.withPreset( diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/DiscussionMuteCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/DiscussionMuteCommand.java deleted file mode 100644 index 610af367..00000000 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/DiscussionMuteCommand.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.diamondfire.helpbot.bot.command.impl.other.mod; - -import com.diamondfire.helpbot.bot.HelpBotInstance; -import com.diamondfire.helpbot.bot.command.argument.ArgumentSet; -import com.diamondfire.helpbot.bot.command.argument.impl.parsing.types.SingleArgumentContainer; -import com.diamondfire.helpbot.bot.command.argument.impl.types.*; -import com.diamondfire.helpbot.bot.command.help.*; -import com.diamondfire.helpbot.bot.command.impl.Command; -import com.diamondfire.helpbot.bot.command.permissions.Permission; -import com.diamondfire.helpbot.bot.command.reply.PresetBuilder; -import com.diamondfire.helpbot.bot.command.reply.feature.informative.*; -import com.diamondfire.helpbot.bot.events.CommandEvent; -import com.diamondfire.helpbot.sys.database.impl.DatabaseQuery; -import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; -import com.diamondfire.helpbot.sys.tasks.impl.MuteExpireTask; -import com.diamondfire.helpbot.util.*; -import net.dv8tion.jda.api.entities.*; - -import java.time.*; -import java.time.temporal.TemporalAdjusters; -import java.util.Date; - -public class DiscussionMuteCommand extends Command { - - public static final long DISCUSSION_CHANNEL = HelpBotInstance.getConfig().getDiscussionChannel(); - - @Override - public String getName() { - return "discussionmute"; - } - - @Override - public String[] getAliases() { - return new String[]{"weeklymute", "weekmute", "discmute"}; - } - - @Override - public HelpContext getHelpContext() { - return new HelpContext() - .description("Mutes a player from discussion till the next Monday 6PM EST.") - .category(CommandCategory.OTHER) - .addArgument( - new HelpContextArgument() - .name("user"), - new HelpContextArgument() - .name("duration") - ); - } - - @Override - protected ArgumentSet compileArguments() { - LocalDate nextMonday = LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.MONDAY)); - - return new ArgumentSet() - .addArgument("user", - new DiscordUserArgument()) - .addArgument("duration", - new SingleArgumentContainer<>(new TimeOffsetArgument()).optional(DateUtil.toDate(nextMonday))); - } - - @Override - public Permission getPermission() { - return Permission.MODERATION; - } - - @Override - public void run(CommandEvent event) { - PresetBuilder builder = new PresetBuilder(); - long user = event.getArgument("user"); - Date duration = event.getArgument("duration"); - long timeLeft = duration.toInstant().minusSeconds(Instant.now().getEpochSecond()).toEpochMilli(); - - event.getGuild().retrieveMemberById(user).queue((msg) -> { - new DatabaseQuery() - .query(new BasicQuery("INSERT INTO owen.muted_members (member,muted_by,muted_at,muted_till,reason) VALUES (?,?,CURRENT_TIMESTAMP(),?,'Weekly Discussion Mute')", (statement) -> { - statement.setLong(1, user); - statement.setLong(2, event.getAuthor().getIdLong()); - statement.setTimestamp(3, DateUtil.toTimeStamp(duration)); - - })) - .compile(); - - builder.withPreset( - new InformativeReply(InformativeReplyType.SUCCESS, "Muted!", String.format("Player will be muted for ``%s``.", FormatUtil.formatMilliTime(timeLeft))) - ); - Guild guild = event.getGuild(); - TextChannel channel = guild.getTextChannelById(DISCUSSION_CHANNEL); - guild.retrieveMemberById(user).queue((member) -> { - channel.putPermissionOverride(member).deny(net.dv8tion.jda.api.Permission.MESSAGE_ADD_REACTION, net.dv8tion.jda.api.Permission.MESSAGE_WRITE).queue(); - }); - - HelpBotInstance.getScheduler().schedule(new MuteExpireTask(user, duration, true)); - event.reply(builder); - }, (error) -> { - builder.withPreset( - new InformativeReply(InformativeReplyType.ERROR, "Discord user was not found!") - ); - - event.reply(builder); - }); - - } -} diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java index fa2fc488..935f2a3e 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java @@ -71,16 +71,8 @@ public void run(CommandEvent event) { } else { Guild guild = event.getGuild(); - ResultSet set = result.getResult(); - boolean special = "Weekly Discussion Mute".equals(set.getString("reason")); - if (special) { - TextChannel channel = guild.getTextChannelById(DiscussionMuteCommand.DISCUSSION_CHANNEL); - channel.getPermissionOverride(member).delete().queue(); - - } else { - guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue(); - } + guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue(); new DatabaseQuery() .query(new BasicQuery("UPDATE owen.muted_members SET handled = true WHERE member = ?", (statement) -> statement.setLong(1, member.getIdLong()))) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java index 6a1e5cac..c9219821 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java @@ -114,18 +114,18 @@ protected void execute(CommandEvent event, Player player) { warningReq = 6 - warnings; } - if (duration != null) { - embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more active %s, you will receive a **%s** tempban!", warningReq, StringUtil.sCheck("warning", warningReq), duration), false); - } +// if (duration != null) { +// embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more active %s, you will receive a **%s** tempban!", warningReq, StringUtil.sCheck("warning", warningReq), duration), false); +// } } else if (punishments.size() == 0) { embed.setDescription("No punishments here, keep up the good work!"); } - - if (yearlyWarnings > 10) { - embed.setColor(Color.RED); - embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more %s this year, you will receive a **45** day tempban!", 20 - yearlyWarnings, StringUtil.sCheck("warning", 20 - yearlyWarnings)), false); - } +// +// if (yearlyWarnings > 10) { +// embed.setColor(Color.RED); +// embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more %s this year, you will receive a **45** day tempban!", 20 - yearlyWarnings, StringUtil.sCheck("warning", 20 - yearlyWarnings)), false); +// } msgs.add(privateChannel.sendMessageEmbeds(embed.build())); } @@ -145,7 +145,7 @@ protected void execute(CommandEvent event, Player player) { EmbedUtil.addFields(presetBuilder, punishmentStrings, "", "", true); if (punishmentStrings.size() == 0) { } else if (presetBuilder.isValidLength()) { - msgs.add(privateChannel.sendMessage(presetBuilder.build())); + msgs.add(privateChannel.sendMessageEmbeds(presetBuilder.build())); } else { try { File sendFile = ExternalFileUtil.generateFile("history.txt"); diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java index 4ba55a70..bd71dbaa 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java @@ -15,18 +15,10 @@ public class MuteExpireTask implements OneTimeTask { private final long ms; private final long member; - private final boolean discussionMute; public MuteExpireTask(long member, Date date) { this.ms = Duration.between(Instant.now(), date.toInstant()).toMillis(); this.member = member; - this.discussionMute = false; - } - - public MuteExpireTask(long member, Date date, boolean discussionMute) { - this.ms = Duration.between(Instant.now(), date.toInstant()).toMillis(); - this.member = member; - this.discussionMute = discussionMute; } @Override @@ -37,16 +29,8 @@ public long getExecution() { @Override public void run() { Guild guild = HelpBotInstance.getJda().getGuildById(HelpBotInstance.DF_GUILD); - - if (discussionMute) { - TextChannel channel = guild.getTextChannelById(DiscussionMuteCommand.DISCUSSION_CHANNEL); - guild.retrieveMemberById(member).queue((member) -> { - channel.getPermissionOverride(member).delete().queue(); - }); - - } else { - guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue(); - } + + guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue(); new DatabaseQuery() .query(new BasicQuery("UPDATE owen.muted_members SET handled = true WHERE member = ?", (statement) -> statement.setLong(1, member))) @@ -62,9 +46,8 @@ public static void prepare() { for (ResultSet set : result) { Timestamp date = set.getTimestamp("muted_till"); long member = set.getLong("member"); - boolean special = "Weekly Discussion Mute".equals(set.getString("reason")); - - HelpBotInstance.getScheduler().schedule(new MuteExpireTask(member, date, special)); + + HelpBotInstance.getScheduler().schedule(new MuteExpireTask(member, date)); } }); } From 25c698ec97d6b67ece700612195431a6750c997f Mon Sep 17 00:00:00 2001 From: tk2217 Date: Sun, 2 Oct 2022 18:18:08 -0500 Subject: [PATCH 13/27] refactor: move permissions to config --- .../helpbot/bot/HelpBotInstance.java | 320 +++++++++--------- .../minecraft/MojangPlayerUUIDArgument.java | 83 ++--- .../bot/command/permissions/Permission.java | 139 ++++---- .../helpbot/bot/config/Config.java | 204 +++++------ 4 files changed, 370 insertions(+), 376 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index 380d2007..64b2eecc 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -1,161 +1,159 @@ -package com.diamondfire.helpbot.bot; - -import com.diamondfire.helpbot.bot.command.CommandHandler; -import com.diamondfire.helpbot.bot.command.impl.codeblock.*; -import com.diamondfire.helpbot.bot.command.impl.other.StoreCommand; -import com.diamondfire.helpbot.bot.command.impl.other.dev.*; -import com.diamondfire.helpbot.bot.command.impl.other.dumps.*; -import com.diamondfire.helpbot.bot.command.impl.other.fun.*; -import com.diamondfire.helpbot.bot.command.impl.other.info.*; -import com.diamondfire.helpbot.bot.command.impl.other.mod.*; -import com.diamondfire.helpbot.bot.command.impl.other.tag.TagCommand; -import com.diamondfire.helpbot.bot.command.impl.other.util.*; -import com.diamondfire.helpbot.bot.command.impl.stats.*; -import com.diamondfire.helpbot.bot.command.impl.stats.graph.*; -import com.diamondfire.helpbot.bot.command.impl.stats.individualized.*; -import com.diamondfire.helpbot.bot.command.impl.stats.metrics.*; -import com.diamondfire.helpbot.bot.command.impl.stats.plot.*; -import com.diamondfire.helpbot.bot.command.impl.stats.support.*; -import com.diamondfire.helpbot.bot.command.impl.stats.top.*; -import com.diamondfire.helpbot.bot.config.Config; -import com.diamondfire.helpbot.bot.events.*; -import com.diamondfire.helpbot.sys.tasks.TaskRegistry; -import net.dv8tion.jda.api.*; -import net.dv8tion.jda.api.entities.Activity; -import net.dv8tion.jda.api.requests.GatewayIntent; -import net.dv8tion.jda.api.utils.MemberCachePolicy; -import net.dv8tion.jda.api.utils.cache.CacheFlag; -import okhttp3.OkHttpClient; - -import javax.security.auth.login.LoginException; - -public class HelpBotInstance { - - private static final Config config = new Config(); - public static final long DF_GUILD = config.getGuild(); - public static final long LOG_CHANNEL = config.getLogChannel(); - public static final OkHttpClient HTTP_CLIENT = new OkHttpClient(); - - private static JDA jda; - private static final TaskRegistry loop = new TaskRegistry(); - - public static void initialize() throws LoginException { - - CommandHandler.getInstance().register( - // codeblock commands - new CodeCommand(), - new RankCommand(), - new BlockCommand(), - new SearchCommand(), - new TagsCommand(), - // others - new CowsayCommand(), - new MimicCommand(), - new FetchDataCommand(), - new InfoCommand(), - new EvalCommand(), - // new GarfieldCommand(), - Dead - new HelpCommand(), - new RestartCommand(), - new ActionDumpCommand(), - new RawCommand(), - new SamQuotesCommand(), - new PolicyCommand(), - new SkinCommand(), - new DisableCommand(), - new EnableCommand(), - new DisableCommand(), - new ImageDumpCommand(), - new SoundListCommand(), - new RulesCommand(), - new BulkExecuteCommand(), - new PermUnlocksCommand(), - new MuteCommand(), - new MutedCommand(), - new UnmuteCommand(), - new VerifyCommand(), - // new PollCommand(), - Unused - new IdeaCommand(), - new StoreCommand(), - // new ChannelMuteCommand(), - not finished - // statsbot - new StatsCommand(), - new SupportBadCommand(), - new JoinBadCommand(), - new PlotCommand(), - new ProfileCommand(), - new ActivePlotsCommand(), - new TrendingPlotsCommand(), - new PlotsCommand(), - //new CpTopCommand(), - new RetiredListCommand(), - new StaffListCommand(), - new SessionTopCommand(), - new LastJoinedCommand(), - new SupporteeStatsCommand(), - new NewPlayersCommand(), - new StatsGraphCommand(), - new NewJoinGraphCommand(), - new PlayersCommand(), - new BoostersCommand(), - new DiscordBoostersCommand(), - new TimeTopCommand(), - new QueueCommand(), - new WhoHelpedCommand(), - new HelpedByCommand(), - // new NamesCommand(), - Dead - new PlayerJoinGraphCommand(), - //new CpCommand(), - //new CpRequirementsCommand(), - new VoteGivenLeaderboard(), - new PlotVoteGraphCommand(), - new JoinDataCommand(), - new TotalStatsCommand(), - new TokenTopCommand(), - new HistoryCommand(), - new UuidCommand(), - new PlotLocCommand(), - new FindSupporteeNamesCommand(), - new SessionsCommand(), - new SupporteeSessionsCommand(), - new ExcuseStaffCommand(), - new ExcusedStaffCommand(), - new SupportBannedPlayersCommand(), - new NbsCommand(), - new DailySessionsCommand(), - new EightBallCommand(), - // new OcrCommand(), - Dead - new JoinsCommand(), - new TagCommand(), - new PurgeCommand() - ); - - JDABuilder builder = JDABuilder.createDefault(config.getToken()) - .enableIntents(GatewayIntent.GUILD_MEMBERS) - .setStatus(OnlineStatus.ONLINE) - .setMemberCachePolicy(MemberCachePolicy.NONE) - .setActivity(Activity.watching("for " + getConfig().getPrefix() + "help")) - .setGatewayEncoding(GatewayEncoding.ETF) - .disableCache(CacheFlag.ACTIVITY, CacheFlag.VOICE_STATE, CacheFlag.CLIENT_STATUS) - .addEventListeners(new MessageEvent(), new ReadyEvent(), new GuildJoinEvent(), new ButtonEvent(), new MessageEditEvent()); - - jda = builder.build(); - CommandHandler.getInstance().initialize(); - } - - public static JDA getJda() { - return jda; - } - - public static OkHttpClient getHttpClient() { - return HTTP_CLIENT; - } - - public static Config getConfig() { - return config; - } - - public static TaskRegistry getScheduler() { - return loop; - } -} +package com.diamondfire.helpbot.bot; + +import com.diamondfire.helpbot.bot.command.CommandHandler; +import com.diamondfire.helpbot.bot.command.impl.codeblock.*; +import com.diamondfire.helpbot.bot.command.impl.other.StoreCommand; +import com.diamondfire.helpbot.bot.command.impl.other.dev.*; +import com.diamondfire.helpbot.bot.command.impl.other.dumps.*; +import com.diamondfire.helpbot.bot.command.impl.other.fun.*; +import com.diamondfire.helpbot.bot.command.impl.other.info.*; +import com.diamondfire.helpbot.bot.command.impl.other.mod.*; +import com.diamondfire.helpbot.bot.command.impl.other.tag.TagCommand; +import com.diamondfire.helpbot.bot.command.impl.other.util.*; +import com.diamondfire.helpbot.bot.command.impl.stats.*; +import com.diamondfire.helpbot.bot.command.impl.stats.graph.*; +import com.diamondfire.helpbot.bot.command.impl.stats.individualized.*; +import com.diamondfire.helpbot.bot.command.impl.stats.metrics.*; +import com.diamondfire.helpbot.bot.command.impl.stats.plot.*; +import com.diamondfire.helpbot.bot.command.impl.stats.support.*; +import com.diamondfire.helpbot.bot.command.impl.stats.top.*; +import com.diamondfire.helpbot.bot.config.Config; +import com.diamondfire.helpbot.bot.events.*; +import com.diamondfire.helpbot.sys.tasks.TaskRegistry; +import com.google.gson.Gson; +import net.dv8tion.jda.api.*; +import net.dv8tion.jda.api.entities.Activity; +import net.dv8tion.jda.api.requests.GatewayIntent; +import net.dv8tion.jda.api.utils.MemberCachePolicy; +import net.dv8tion.jda.api.utils.cache.CacheFlag; +import okhttp3.OkHttpClient; + +import javax.security.auth.login.LoginException; + +public class HelpBotInstance { + + private static final Config config = new Config(); + public static final long DF_GUILD = config.getGuild(); + public static final long LOG_CHANNEL = config.getLogChannel(); + + public static final Gson GSON = new Gson(); + + private static JDA jda; + private static final TaskRegistry loop = new TaskRegistry(); + + public static void initialize() throws LoginException { + + CommandHandler.getInstance().register( + // codeblock commands + new CodeCommand(), + new RankCommand(), + new BlockCommand(), + new SearchCommand(), + new TagsCommand(), + // others + new CowsayCommand(), + new MimicCommand(), + new FetchDataCommand(), + new InfoCommand(), + new EvalCommand(), + // new GarfieldCommand(), - Dead + new HelpCommand(), + new RestartCommand(), + new ActionDumpCommand(), + new RawCommand(), + new SamQuotesCommand(), + new PolicyCommand(), + new SkinCommand(), + new DisableCommand(), + new EnableCommand(), + new DisableCommand(), + new ImageDumpCommand(), + new SoundListCommand(), + new RulesCommand(), + new BulkExecuteCommand(), + new PermUnlocksCommand(), + new MuteCommand(), + new MutedCommand(), + new UnmuteCommand(), + new VerifyCommand(), + // new PollCommand(), - Unused + new IdeaCommand(), + new StoreCommand(), + // new ChannelMuteCommand(), - not finished + // statsbot + new StatsCommand(), + new SupportBadCommand(), + new JoinBadCommand(), + new PlotCommand(), + new ProfileCommand(), + new ActivePlotsCommand(), + new TrendingPlotsCommand(), + new PlotsCommand(), + //new CpTopCommand(), + new RetiredListCommand(), + new StaffListCommand(), + new SessionTopCommand(), + new LastJoinedCommand(), + new SupporteeStatsCommand(), + new NewPlayersCommand(), + new StatsGraphCommand(), + new NewJoinGraphCommand(), + new PlayersCommand(), + new BoostersCommand(), + new DiscordBoostersCommand(), + new TimeTopCommand(), + new QueueCommand(), + new WhoHelpedCommand(), + new HelpedByCommand(), + // new NamesCommand(), - Dead + new PlayerJoinGraphCommand(), + //new CpCommand(), + //new CpRequirementsCommand(), + new VoteGivenLeaderboard(), + new PlotVoteGraphCommand(), + new JoinDataCommand(), + new TotalStatsCommand(), + new TokenTopCommand(), + new HistoryCommand(), + new UuidCommand(), + new PlotLocCommand(), + new FindSupporteeNamesCommand(), + new SessionsCommand(), + new SupporteeSessionsCommand(), + new ExcuseStaffCommand(), + new ExcusedStaffCommand(), + new SupportBannedPlayersCommand(), + new NbsCommand(), + new DailySessionsCommand(), + new EightBallCommand(), + // new OcrCommand(), - Dead + new JoinsCommand(), + new TagCommand(), + new PurgeCommand() + ); + + JDABuilder builder = JDABuilder.createDefault(config.getToken()) + .enableIntents(GatewayIntent.GUILD_MEMBERS) + .setStatus(OnlineStatus.ONLINE) + .setMemberCachePolicy(MemberCachePolicy.NONE) + .setActivity(Activity.watching("for " + getConfig().getPrefix() + "help")) + .setGatewayEncoding(GatewayEncoding.ETF) + .disableCache(CacheFlag.ACTIVITY, CacheFlag.VOICE_STATE, CacheFlag.CLIENT_STATUS) + .addEventListeners(new MessageEvent(), new ReadyEvent(), new GuildJoinEvent(), new ButtonEvent(), new MessageEditEvent()); + + jda = builder.build(); + CommandHandler.getInstance().initialize(); + } + + public static JDA getJda() { + return jda; + } + + public static Config getConfig() { + return config; + } + + public static TaskRegistry getScheduler() { + return loop; + } +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java b/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java index d1509aa2..f9fbaee5 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java @@ -1,47 +1,36 @@ -package com.diamondfire.helpbot.bot.command.argument.impl.types.minecraft; - -import com.diamondfire.helpbot.bot.HelpBotInstance; -import com.diamondfire.helpbot.bot.command.argument.impl.parsing.exceptions.ArgumentException; -import com.diamondfire.helpbot.bot.command.argument.impl.types.AbstractSimpleValueArgument; -import com.diamondfire.helpbot.bot.events.CommandEvent; -import com.diamondfire.helpbot.util.Util; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import okhttp3.Request; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.util.UUID; - -// TODO: Player -public class MojangPlayerUUIDArgument extends AbstractSimpleValueArgument { - - @Override - protected UUID parse(@NotNull String argument, CommandEvent event) throws ArgumentException { - if (argument.length() > 16) { - return Util.toUuid(argument); - } else { - JsonObject responseObject = null; - ResponseBody res = null; - Request request = new Request.Builder().url("https://api.mojang.com/users/profiles/minecraft/" + argument).get().build(); - try { - res = HelpBotInstance.getHttpClient().newCall(request).execute().body(); - } catch (IOException e) { - e.printStackTrace(); - } - - try { - responseObject = JsonParser.parseString(res.string()).getAsJsonObject(); - } catch (IOException e) { - e.printStackTrace(); - } - - if (responseObject.has("id")) { - return Util.toUuid(responseObject.get("id").getAsString()); - } else { - return null; - } - } - } -} +package com.diamondfire.helpbot.bot.command.argument.impl.types.minecraft; + +import com.diamondfire.helpbot.bot.command.argument.impl.parsing.exceptions.ArgumentException; +import com.diamondfire.helpbot.bot.command.argument.impl.types.AbstractSimpleValueArgument; +import com.diamondfire.helpbot.bot.events.CommandEvent; +import com.diamondfire.helpbot.util.*; +import com.google.gson.JsonObject; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.util.UUID; + +// TODO: Player +public class MojangPlayerUUIDArgument extends AbstractSimpleValueArgument { + + @Override + protected UUID parse(@NotNull String argument, CommandEvent event) throws ArgumentException { + if (argument.length() > 16) { + return Util.toUuid(argument); + } else { + JsonObject responseObject = null; + + try { + responseObject = WebUtil.getJson("https://api.mojang.com/users/profiles/minecraft/" + argument).getAsJsonObject(); + } catch (IOException e) { + e.printStackTrace(); + } + + if (responseObject.has("id")) { + return Util.toUuid(responseObject.get("id").getAsString()); + } else { + return null; + } + } + } +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java index a4afcbba..93b728f6 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java @@ -1,69 +1,70 @@ -package com.diamondfire.helpbot.bot.command.permissions; - -import com.diamondfire.helpbot.bot.command.impl.Command; -import net.dv8tion.jda.api.entities.Member; - -import java.util.*; -import java.util.stream.Collectors; - -public enum Permission { - BOT_DEVELOPER(589238520145510400L, 999), - DEVELOPER(519740942861860874L, 999), - // Ask DragonSlasher, not me. - ADMINISTRATOR(180794313494495233L, 666), - MODERATION(180794061429538816L, 5), - SR_HELPER(299109861696995329L, 4), - SUPPORT(180794530398732288L, 3), - RETIRED_SUPPORT(235159617108181003L, 2), - USER(349434193517740033L, 1); - - private static final HashMap roleMap = new HashMap<>(); - private static final HashMap> overrides = new HashMap<>(); - - static { - for (Permission perm : values()) { - roleMap.put(perm.getRole(), perm); - } - } - - private final long role; - private final int permissionLevel; - - Permission(long roleID, int permissionLevel) { - this.role = roleID; - this.permissionLevel = permissionLevel; - } - - public static Permission fromRole(long roleID) { - Permission perm = roleMap.get(roleID); - if (perm == null) { - return USER; - } - return perm; - } - - public Permission setOverrides(Command command, Long... userIds) { - overrides.put(command, Arrays.stream(userIds).collect(Collectors.toSet())); - return this; - } - - public static Set getOverrides(Command command) { - return Objects.requireNonNullElse(overrides.get(command), new HashSet<>()); - } - - public long getRole() { - return role; - } - - public int getPermissionLevel() { - return permissionLevel; - } - - public boolean hasPermission(Member member) { - return hasPermission(PermissionHandler.getPermission(member)); - } - - public boolean hasPermission(Permission permission) { - return getPermissionLevel() <= permission.getPermissionLevel(); - } -} +package com.diamondfire.helpbot.bot.command.permissions; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.bot.command.impl.Command; +import net.dv8tion.jda.api.entities.Member; + +import java.util.*; +import java.util.stream.Collectors; + +public enum Permission { + BOT_DEVELOPER(999), + DEVELOPER(999), + // Ask DragonSlasher, not me. + ADMINISTRATOR(666), + MODERATION(5), + SR_HELPER(4), + SUPPORT(3), + RETIRED_SUPPORT(2), + USER(1); + + private static final HashMap roleMap = new HashMap<>(); + private static final HashMap> overrides = new HashMap<>(); + + static { + for (Permission perm : values()) { + roleMap.put(perm.getRole(), perm); + } + } + + private final long role; + private final int permissionLevel; + + Permission(int permissionLevel) { + this.role = HelpBotInstance.getConfig().getPermissionRoleMap().get(this.name()); + this.permissionLevel = permissionLevel; + } + + public static Permission fromRole(long roleID) { + Permission perm = roleMap.get(roleID); + if (perm == null) { + return USER; + } + return perm; + } + + public Permission setOverrides(Command command, Long... userIds) { + overrides.put(command, Arrays.stream(userIds).collect(Collectors.toSet())); + return this; + } + + public static Set getOverrides(Command command) { + return Objects.requireNonNullElse(overrides.get(command), new HashSet<>()); + } + + public long getRole() { + return role; + } + + public int getPermissionLevel() { + return permissionLevel; + } + + public boolean hasPermission(Member member) { + return hasPermission(PermissionHandler.getPermission(member)); + } + + public boolean hasPermission(Permission permission) { + return getPermissionLevel() <= permission.getPermissionLevel(); + } +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java index 28e18f9e..5b549591 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java +++ b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java @@ -1,99 +1,105 @@ -package com.diamondfire.helpbot.bot.config; - -import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; -import com.google.gson.*; - -import java.io.*; -import java.util.stream.Collectors; - -public class Config { - - private final JsonObject config; - - public Config() throws IllegalStateException { - try (BufferedReader txtReader2 = new BufferedReader(new FileReader(ExternalFiles.CONFIG.getPath()))) { - String config = txtReader2.lines().collect(Collectors.joining()); - this.config = JsonParser.parseString(config).getAsJsonObject(); - } catch (Exception exception) { - throw new IllegalStateException("Config not correctly structured! Please check the readme file for a config template."); - } - } - - // Bot Stuff - public String getToken() { - return getPropertyString("token"); - } - - public String getPrefix() { - return getPropertyString("prefix"); - } - - public boolean isDevBot() { - return config.get("dev_bot").getAsBoolean(); - } - - // Mc account - public String getMcEmail() { - return getPropertyString("mc_email"); - } - - public String getMcPassword() { - return getPropertyString("mc_password"); - } - - // Database - public String getDBUrl() { - return getPropertyString("db_link"); - } - - public String getDBUser() { - return getPropertyString("db_user"); - } - - public String getDBPassword() { - return getPropertyString("db_password"); - } - - // General constants - - public String getlabsCoreToken() { - return getPropertyString("labs_token"); - } - - public long getGuild() { - return getPropertyLong("guild"); - } - - public long getLogChannel() { - return getPropertyLong("log_channel"); - } - - public long getDiscussionChannel() { - return getPropertyLong("discussion_channel"); - } - - public long getPurgeEvidenceChannel() { - return getPropertyLong("purge_evidence_channel"); - } - - public long getMutedRole() { - return getPropertyLong("muted_role"); - } - - public long getVerifiedRole() { - return getPropertyLong("verified_role"); - } - - public String getReportWehook() { - return getPropertyString("report_webhook"); - } - - private long getPropertyLong(String property) { - return config.get(property).getAsLong(); - } - - private String getPropertyString(String property) { - return config.get(property).getAsString(); - } - -} +package com.diamondfire.helpbot.bot.config; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; +import com.google.gson.*; +import com.google.gson.reflect.TypeToken; + +import java.io.*; +import java.nio.file.Files; +import java.util.Map; +import java.util.stream.Collectors; + +public class Config { + + private final JsonObject config; + + public Config() throws IllegalStateException { + try { + this.config = HelpBotInstance.GSON.fromJson(Files.readString(ExternalFiles.CONFIG.toPath()), JsonObject.class); + } catch (Exception exception) { + throw new IllegalStateException("Config not correctly structured! Please check the readme file for a config template."); + } + } + + // Bot Stuff + public String getToken() { + return getPropertyString("token"); + } + + public String getPrefix() { + return getPropertyString("prefix"); + } + + public boolean isDevBot() { + return config.get("dev_bot").getAsBoolean(); + } + + // Mc account + public String getMcEmail() { + return getPropertyString("mc_email"); + } + + public String getMcPassword() { + return getPropertyString("mc_password"); + } + + // Database + public String getDBUrl() { + return getPropertyString("db_link"); + } + + public String getDBUser() { + return getPropertyString("db_user"); + } + + public String getDBPassword() { + return getPropertyString("db_password"); + } + + // General constants + + public String getlabsCoreToken() { + return getPropertyString("labs_token"); + } + + public long getGuild() { + return getPropertyLong("guild"); + } + + public long getLogChannel() { + return getPropertyLong("log_channel"); + } + + public long getDiscussionChannel() { + return getPropertyLong("discussion_channel"); + } + + public long getPurgeEvidenceChannel() { + return getPropertyLong("purge_evidence_channel"); + } + + public long getMutedRole() { + return getPropertyLong("muted_role"); + } + + public long getVerifiedRole() { + return getPropertyLong("verified_role"); + } + + public String getReportWehook() { + return getPropertyString("report_webhook"); + } + + public Map getPermissionRoleMap() { + return HelpBotInstance.GSON.fromJson(config.get("permission_roles"), new TypeToken>(){}.getType()); + } + + private long getPropertyLong(String property) { + return config.get(property).getAsLong(); + } + + private String getPropertyString(String property) { + return config.get(property).getAsString(); + } +} From cb7a1770c6aace732ade60a3760668ce8e51adda Mon Sep 17 00:00:00 2001 From: tk2217 Date: Sun, 2 Oct 2022 18:25:29 -0500 Subject: [PATCH 14/27] fix i think --- .../bot/command/permissions/Permission.java | 140 +++++++++--------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java index 93b728f6..701b5487 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java @@ -1,70 +1,70 @@ -package com.diamondfire.helpbot.bot.command.permissions; - -import com.diamondfire.helpbot.bot.HelpBotInstance; -import com.diamondfire.helpbot.bot.command.impl.Command; -import net.dv8tion.jda.api.entities.Member; - -import java.util.*; -import java.util.stream.Collectors; - -public enum Permission { - BOT_DEVELOPER(999), - DEVELOPER(999), - // Ask DragonSlasher, not me. - ADMINISTRATOR(666), - MODERATION(5), - SR_HELPER(4), - SUPPORT(3), - RETIRED_SUPPORT(2), - USER(1); - - private static final HashMap roleMap = new HashMap<>(); - private static final HashMap> overrides = new HashMap<>(); - - static { - for (Permission perm : values()) { - roleMap.put(perm.getRole(), perm); - } - } - - private final long role; - private final int permissionLevel; - - Permission(int permissionLevel) { - this.role = HelpBotInstance.getConfig().getPermissionRoleMap().get(this.name()); - this.permissionLevel = permissionLevel; - } - - public static Permission fromRole(long roleID) { - Permission perm = roleMap.get(roleID); - if (perm == null) { - return USER; - } - return perm; - } - - public Permission setOverrides(Command command, Long... userIds) { - overrides.put(command, Arrays.stream(userIds).collect(Collectors.toSet())); - return this; - } - - public static Set getOverrides(Command command) { - return Objects.requireNonNullElse(overrides.get(command), new HashSet<>()); - } - - public long getRole() { - return role; - } - - public int getPermissionLevel() { - return permissionLevel; - } - - public boolean hasPermission(Member member) { - return hasPermission(PermissionHandler.getPermission(member)); - } - - public boolean hasPermission(Permission permission) { - return getPermissionLevel() <= permission.getPermissionLevel(); - } -} +package com.diamondfire.helpbot.bot.command.permissions; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.bot.command.impl.Command; +import net.dv8tion.jda.api.entities.Member; + +import java.util.*; +import java.util.stream.Collectors; + +public enum Permission { + BOT_DEVELOPER(999), + DEVELOPER(999), + // Ask DragonSlasher, not me. + ADMINISTRATOR(666), + MODERATION(5), + SR_HELPER(4), + SUPPORT(3), + RETIRED_SUPPORT(2), + USER(1); + + private static final HashMap roleMap = new HashMap<>(); + private static final HashMap> overrides = new HashMap<>(); + + static { + for (Permission perm : values()) { + roleMap.put(perm.getRole(), perm); + } + } + + private final long role; + private final int permissionLevel; + + Permission(int permissionLevel) { + this.role = HelpBotInstance.getConfig().getPermissionRoleMap().get(this.name()); + this.permissionLevel = permissionLevel; + } + + public static Permission fromRole(long roleID) { + Permission perm = roleMap.get(roleID); + if (perm == null) { + return USER; + } + return perm; + } + + public Permission setOverrides(Command command, Long... userIds) { + overrides.put(command, Arrays.stream(userIds).collect(Collectors.toSet())); + return this; + } + + public static Set getOverrides(Command command) { + return Objects.requireNonNullElse(overrides.get(command), new HashSet<>()); + } + + public long getRole() { + return role; + } + + public int getPermissionLevel() { + return permissionLevel; + } + + public boolean hasPermission(Member member) { + return hasPermission(PermissionHandler.getPermission(member)); + } + + public boolean hasPermission(Permission permission) { + return getPermissionLevel() <= permission.getPermissionLevel(); + } +} From de3a06a9e1f2e3b6ae0c3626a398b937c4db7cb9 Mon Sep 17 00:00:00 2001 From: tk2217 Date: Sun, 2 Oct 2022 18:31:49 -0500 Subject: [PATCH 15/27] fix the stupid editorconfig --- .editorconfig | 2382 ++++++++--------- .../helpbot/bot/HelpBotInstance.java | 318 +-- .../minecraft/MojangPlayerUUIDArgument.java | 72 +- .../helpbot/bot/config/Config.java | 210 +- 4 files changed, 1491 insertions(+), 1491 deletions(-) diff --git a/.editorconfig b/.editorconfig index bb35dfb7..2b58a138 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,1191 +1,1191 @@ -[*] -charset = utf-8 -end_of_line = crlf -indent_size = 4 -indent_style = space -insert_final_newline = false -max_line_length = 120 -tab_width = 4 -ij_continuation_indent_size = 8 -ij_formatter_off_tag = @formatter:off -ij_formatter_on_tag = @formatter:on -ij_formatter_tags_enabled = false -ij_smart_tabs = false -ij_visual_guides = none -ij_wrap_on_typing = false - -[*.css] -ij_css_align_closing_brace_with_properties = false -ij_css_blank_lines_around_nested_selector = 1 -ij_css_blank_lines_between_blocks = 1 -ij_css_brace_placement = end_of_line -ij_css_enforce_quotes_on_format = false -ij_css_hex_color_long_format = false -ij_css_hex_color_lower_case = false -ij_css_hex_color_short_format = false -ij_css_hex_color_upper_case = false -ij_css_keep_blank_lines_in_code = 2 -ij_css_keep_indents_on_empty_lines = false -ij_css_keep_single_line_blocks = false -ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_css_space_after_colon = true -ij_css_space_before_opening_brace = true -ij_css_use_double_quotes = true -ij_css_value_alignment = do_not_align - -[*.feature] -indent_size = 2 -ij_gherkin_keep_indents_on_empty_lines = false - -[*.haml] -indent_size = 2 -ij_haml_keep_indents_on_empty_lines = false - -[*.java] -ij_java_align_consecutive_assignments = false -ij_java_align_consecutive_variable_declarations = false -ij_java_align_group_field_declarations = false -ij_java_align_multiline_annotation_parameters = false -ij_java_align_multiline_array_initializer_expression = false -ij_java_align_multiline_assignment = false -ij_java_align_multiline_binary_operation = false -ij_java_align_multiline_chained_methods = false -ij_java_align_multiline_extends_list = false -ij_java_align_multiline_for = true -ij_java_align_multiline_method_parentheses = false -ij_java_align_multiline_parameters = true -ij_java_align_multiline_parameters_in_calls = false -ij_java_align_multiline_parenthesized_expression = false -ij_java_align_multiline_records = true -ij_java_align_multiline_resources = true -ij_java_align_multiline_ternary_operation = false -ij_java_align_multiline_text_blocks = false -ij_java_align_multiline_throws_list = false -ij_java_align_subsequent_simple_methods = false -ij_java_align_throws_keyword = false -ij_java_annotation_parameter_wrap = off -ij_java_array_initializer_new_line_after_left_brace = false -ij_java_array_initializer_right_brace_on_new_line = false -ij_java_array_initializer_wrap = off -ij_java_assert_statement_colon_on_next_line = false -ij_java_assert_statement_wrap = off -ij_java_assignment_wrap = off -ij_java_binary_operation_sign_on_next_line = false -ij_java_binary_operation_wrap = off -ij_java_blank_lines_after_anonymous_class_header = 0 -ij_java_blank_lines_after_class_header = 1 -ij_java_blank_lines_after_imports = 1 -ij_java_blank_lines_after_package = 1 -ij_java_blank_lines_around_class = 1 -ij_java_blank_lines_around_field = 0 -ij_java_blank_lines_around_field_in_interface = 0 -ij_java_blank_lines_around_initializer = 1 -ij_java_blank_lines_around_method = 1 -ij_java_blank_lines_around_method_in_interface = 1 -ij_java_blank_lines_before_class_end = 0 -ij_java_blank_lines_before_imports = 1 -ij_java_blank_lines_before_method_body = 0 -ij_java_blank_lines_before_package = 0 -ij_java_block_brace_style = end_of_line -ij_java_block_comment_at_first_column = true -ij_java_call_parameters_new_line_after_left_paren = false -ij_java_call_parameters_right_paren_on_new_line = false -ij_java_call_parameters_wrap = off -ij_java_case_statement_on_separate_line = true -ij_java_catch_on_new_line = false -ij_java_class_annotation_wrap = split_into_lines -ij_java_class_brace_style = end_of_line -ij_java_class_count_to_use_import_on_demand = 2 -ij_java_class_names_in_javadoc = 1 -ij_java_do_not_indent_top_level_class_members = false -ij_java_do_not_wrap_after_single_annotation = false -ij_java_do_while_brace_force = never -ij_java_doc_add_blank_line_after_description = true -ij_java_doc_add_blank_line_after_param_comments = false -ij_java_doc_add_blank_line_after_return = false -ij_java_doc_add_p_tag_on_empty_lines = true -ij_java_doc_align_exception_comments = true -ij_java_doc_align_param_comments = true -ij_java_doc_do_not_wrap_if_one_line = false -ij_java_doc_enable_formatting = true -ij_java_doc_enable_leading_asterisks = true -ij_java_doc_indent_on_continuation = false -ij_java_doc_keep_empty_lines = true -ij_java_doc_keep_empty_parameter_tag = true -ij_java_doc_keep_empty_return_tag = true -ij_java_doc_keep_empty_throws_tag = true -ij_java_doc_keep_invalid_tags = true -ij_java_doc_param_description_on_new_line = false -ij_java_doc_preserve_line_breaks = false -ij_java_doc_use_throws_not_exception_tag = true -ij_java_else_on_new_line = false -ij_java_entity_dd_suffix = EJB -ij_java_entity_eb_suffix = Bean -ij_java_entity_hi_suffix = Home -ij_java_entity_lhi_prefix = Local -ij_java_entity_lhi_suffix = Home -ij_java_entity_li_prefix = Local -ij_java_entity_pk_class = java.lang.String -ij_java_entity_vo_suffix = VO -ij_java_enum_constants_wrap = off -ij_java_extends_keyword_wrap = off -ij_java_extends_list_wrap = off -ij_java_field_annotation_wrap = split_into_lines -ij_java_finally_on_new_line = false -ij_java_for_brace_force = never -ij_java_for_statement_new_line_after_left_paren = false -ij_java_for_statement_right_paren_on_new_line = false -ij_java_for_statement_wrap = off -ij_java_generate_final_locals = false -ij_java_generate_final_parameters = false -ij_java_if_brace_force = never -ij_java_imports_layout = *,|,javax.**,java.**,|,$* -ij_java_indent_case_from_switch = true -ij_java_insert_inner_class_imports = false -ij_java_insert_override_annotation = true -ij_java_keep_blank_lines_before_right_brace = 2 -ij_java_keep_blank_lines_between_package_declaration_and_header = 2 -ij_java_keep_blank_lines_in_code = 2 -ij_java_keep_blank_lines_in_declarations = 2 -ij_java_keep_control_statement_in_one_line = true -ij_java_keep_first_column_comment = true -ij_java_keep_indents_on_empty_lines = true -ij_java_keep_line_breaks = true -ij_java_keep_multiple_expressions_in_one_line = false -ij_java_keep_simple_blocks_in_one_line = false -ij_java_keep_simple_classes_in_one_line = false -ij_java_keep_simple_lambdas_in_one_line = false -ij_java_keep_simple_methods_in_one_line = false -ij_java_label_indent_absolute = false -ij_java_label_indent_size = 0 -ij_java_lambda_brace_style = end_of_line -ij_java_layout_static_imports_separately = true -ij_java_line_comment_add_space = false -ij_java_line_comment_at_first_column = true -ij_java_message_dd_suffix = EJB -ij_java_message_eb_suffix = Bean -ij_java_method_annotation_wrap = split_into_lines -ij_java_method_brace_style = end_of_line -ij_java_method_call_chain_wrap = off -ij_java_method_parameters_new_line_after_left_paren = false -ij_java_method_parameters_right_paren_on_new_line = false -ij_java_method_parameters_wrap = off -ij_java_modifier_list_wrap = false -ij_java_names_count_to_use_import_on_demand = 3 -ij_java_new_line_after_lparen_in_record_header = false -ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* -ij_java_parameter_annotation_wrap = off -ij_java_parentheses_expression_new_line_after_left_paren = false -ij_java_parentheses_expression_right_paren_on_new_line = false -ij_java_place_assignment_sign_on_next_line = false -ij_java_prefer_longer_names = true -ij_java_prefer_parameters_wrap = false -ij_java_record_components_wrap = normal -ij_java_repeat_synchronized = true -ij_java_replace_instanceof_and_cast = false -ij_java_replace_null_check = true -ij_java_replace_sum_lambda_with_method_ref = true -ij_java_resource_list_new_line_after_left_paren = false -ij_java_resource_list_right_paren_on_new_line = false -ij_java_resource_list_wrap = off -ij_java_rparen_on_new_line_in_record_header = false -ij_java_session_dd_suffix = EJB -ij_java_session_eb_suffix = Bean -ij_java_session_hi_suffix = Home -ij_java_session_lhi_prefix = Local -ij_java_session_lhi_suffix = Home -ij_java_session_li_prefix = Local -ij_java_session_si_suffix = Service -ij_java_space_after_closing_angle_bracket_in_type_argument = false -ij_java_space_after_colon = true -ij_java_space_after_comma = true -ij_java_space_after_comma_in_type_arguments = true -ij_java_space_after_for_semicolon = true -ij_java_space_after_quest = true -ij_java_space_after_type_cast = true -ij_java_space_before_annotation_array_initializer_left_brace = false -ij_java_space_before_annotation_parameter_list = false -ij_java_space_before_array_initializer_left_brace = false -ij_java_space_before_catch_keyword = true -ij_java_space_before_catch_left_brace = true -ij_java_space_before_catch_parentheses = true -ij_java_space_before_class_left_brace = true -ij_java_space_before_colon = true -ij_java_space_before_colon_in_foreach = true -ij_java_space_before_comma = false -ij_java_space_before_do_left_brace = true -ij_java_space_before_else_keyword = true -ij_java_space_before_else_left_brace = true -ij_java_space_before_finally_keyword = true -ij_java_space_before_finally_left_brace = true -ij_java_space_before_for_left_brace = true -ij_java_space_before_for_parentheses = true -ij_java_space_before_for_semicolon = false -ij_java_space_before_if_left_brace = true -ij_java_space_before_if_parentheses = true -ij_java_space_before_method_call_parentheses = false -ij_java_space_before_method_left_brace = true -ij_java_space_before_method_parentheses = false -ij_java_space_before_opening_angle_bracket_in_type_parameter = false -ij_java_space_before_quest = true -ij_java_space_before_switch_left_brace = true -ij_java_space_before_switch_parentheses = true -ij_java_space_before_synchronized_left_brace = true -ij_java_space_before_synchronized_parentheses = true -ij_java_space_before_try_left_brace = true -ij_java_space_before_try_parentheses = true -ij_java_space_before_type_parameter_list = false -ij_java_space_before_while_keyword = true -ij_java_space_before_while_left_brace = true -ij_java_space_before_while_parentheses = true -ij_java_space_inside_one_line_enum_braces = false -ij_java_space_within_empty_array_initializer_braces = false -ij_java_space_within_empty_method_call_parentheses = false -ij_java_space_within_empty_method_parentheses = false -ij_java_spaces_around_additive_operators = true -ij_java_spaces_around_assignment_operators = true -ij_java_spaces_around_bitwise_operators = true -ij_java_spaces_around_equality_operators = true -ij_java_spaces_around_lambda_arrow = true -ij_java_spaces_around_logical_operators = true -ij_java_spaces_around_method_ref_dbl_colon = false -ij_java_spaces_around_multiplicative_operators = true -ij_java_spaces_around_relational_operators = true -ij_java_spaces_around_shift_operators = true -ij_java_spaces_around_type_bounds_in_type_parameters = true -ij_java_spaces_around_unary_operator = false -ij_java_spaces_within_angle_brackets = false -ij_java_spaces_within_annotation_parentheses = false -ij_java_spaces_within_array_initializer_braces = false -ij_java_spaces_within_braces = false -ij_java_spaces_within_brackets = false -ij_java_spaces_within_cast_parentheses = false -ij_java_spaces_within_catch_parentheses = false -ij_java_spaces_within_for_parentheses = false -ij_java_spaces_within_if_parentheses = false -ij_java_spaces_within_method_call_parentheses = false -ij_java_spaces_within_method_parentheses = false -ij_java_spaces_within_parentheses = false -ij_java_spaces_within_record_header = false -ij_java_spaces_within_switch_parentheses = false -ij_java_spaces_within_synchronized_parentheses = false -ij_java_spaces_within_try_parentheses = false -ij_java_spaces_within_while_parentheses = false -ij_java_special_else_if_treatment = true -ij_java_subclass_name_suffix = Impl -ij_java_ternary_operation_signs_on_next_line = false -ij_java_ternary_operation_wrap = off -ij_java_test_name_suffix = Test -ij_java_throws_keyword_wrap = off -ij_java_throws_list_wrap = off -ij_java_use_external_annotations = false -ij_java_use_fq_class_names = false -ij_java_use_relative_indents = false -ij_java_use_single_class_imports = true -ij_java_variable_annotation_wrap = off -ij_java_visibility = public -ij_java_while_brace_force = never -ij_java_while_on_new_line = false -ij_java_wrap_comments = false -ij_java_wrap_first_method_in_call_chain = false -ij_java_wrap_long_lines = false - -[*.less] -indent_size = 2 -ij_less_align_closing_brace_with_properties = false -ij_less_blank_lines_around_nested_selector = 1 -ij_less_blank_lines_between_blocks = 1 -ij_less_brace_placement = 0 -ij_less_enforce_quotes_on_format = false -ij_less_hex_color_long_format = false -ij_less_hex_color_lower_case = false -ij_less_hex_color_short_format = false -ij_less_hex_color_upper_case = false -ij_less_keep_blank_lines_in_code = 2 -ij_less_keep_indents_on_empty_lines = false -ij_less_keep_single_line_blocks = false -ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_less_space_after_colon = true -ij_less_space_before_opening_brace = true -ij_less_use_double_quotes = true -ij_less_value_alignment = 0 - -[*.nbtt] -max_line_length = 150 -ij_continuation_indent_size = 4 -ij_nbtt_keep_indents_on_empty_lines = false -ij_nbtt_space_after_colon = true -ij_nbtt_space_after_comma = true -ij_nbtt_space_before_colon = true -ij_nbtt_space_before_comma = false -ij_nbtt_spaces_within_brackets = false -ij_nbtt_spaces_within_parentheses = false - -[*.sass] -indent_size = 2 -ij_sass_align_closing_brace_with_properties = false -ij_sass_blank_lines_around_nested_selector = 1 -ij_sass_blank_lines_between_blocks = 1 -ij_sass_brace_placement = 0 -ij_sass_enforce_quotes_on_format = false -ij_sass_hex_color_long_format = false -ij_sass_hex_color_lower_case = false -ij_sass_hex_color_short_format = false -ij_sass_hex_color_upper_case = false -ij_sass_keep_blank_lines_in_code = 2 -ij_sass_keep_indents_on_empty_lines = false -ij_sass_keep_single_line_blocks = false -ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_sass_space_after_colon = true -ij_sass_space_before_opening_brace = true -ij_sass_use_double_quotes = true -ij_sass_value_alignment = 0 - -[*.scss] -indent_size = 2 -ij_scss_align_closing_brace_with_properties = false -ij_scss_blank_lines_around_nested_selector = 1 -ij_scss_blank_lines_between_blocks = 1 -ij_scss_brace_placement = 0 -ij_scss_enforce_quotes_on_format = false -ij_scss_hex_color_long_format = false -ij_scss_hex_color_lower_case = false -ij_scss_hex_color_short_format = false -ij_scss_hex_color_upper_case = false -ij_scss_keep_blank_lines_in_code = 2 -ij_scss_keep_indents_on_empty_lines = false -ij_scss_keep_single_line_blocks = false -ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_scss_space_after_colon = true -ij_scss_space_before_opening_brace = true -ij_scss_use_double_quotes = true -ij_scss_value_alignment = 0 - -[*.styl] -indent_size = 2 -ij_stylus_align_closing_brace_with_properties = false -ij_stylus_blank_lines_around_nested_selector = 1 -ij_stylus_blank_lines_between_blocks = 1 -ij_stylus_brace_placement = 0 -ij_stylus_enforce_quotes_on_format = false -ij_stylus_hex_color_long_format = false -ij_stylus_hex_color_lower_case = false -ij_stylus_hex_color_short_format = false -ij_stylus_hex_color_upper_case = false -ij_stylus_keep_blank_lines_in_code = 2 -ij_stylus_keep_indents_on_empty_lines = false -ij_stylus_keep_single_line_blocks = false -ij_stylus_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow -ij_stylus_space_after_colon = true -ij_stylus_space_before_opening_brace = true -ij_stylus_use_double_quotes = true -ij_stylus_value_alignment = 0 - -[.editorconfig] -ij_editorconfig_align_group_field_declarations = false -ij_editorconfig_space_after_colon = false -ij_editorconfig_space_after_comma = true -ij_editorconfig_space_before_colon = false -ij_editorconfig_space_before_comma = false -ij_editorconfig_spaces_around_assignment_operators = true - -[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdd,*.wsdl,*.xjb,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] -ij_xml_align_attributes = true -ij_xml_align_text = false -ij_xml_attribute_wrap = normal -ij_xml_block_comment_at_first_column = true -ij_xml_keep_blank_lines = 2 -ij_xml_keep_indents_on_empty_lines = false -ij_xml_keep_line_breaks = true -ij_xml_keep_line_breaks_in_text = true -ij_xml_keep_whitespaces = false -ij_xml_keep_whitespaces_around_cdata = preserve -ij_xml_keep_whitespaces_inside_cdata = false -ij_xml_line_comment_at_first_column = true -ij_xml_space_after_tag_name = false -ij_xml_space_around_equals_in_attribute = false -ij_xml_space_inside_empty_tag = false -ij_xml_text_wrap = normal - -[{*.ats,*.ts}] -ij_continuation_indent_size = 4 -ij_typescript_align_imports = false -ij_typescript_align_multiline_array_initializer_expression = false -ij_typescript_align_multiline_binary_operation = false -ij_typescript_align_multiline_chained_methods = false -ij_typescript_align_multiline_extends_list = false -ij_typescript_align_multiline_for = true -ij_typescript_align_multiline_parameters = true -ij_typescript_align_multiline_parameters_in_calls = false -ij_typescript_align_multiline_ternary_operation = false -ij_typescript_align_object_properties = 0 -ij_typescript_align_union_types = false -ij_typescript_align_var_statements = 0 -ij_typescript_array_initializer_new_line_after_left_brace = false -ij_typescript_array_initializer_right_brace_on_new_line = false -ij_typescript_array_initializer_wrap = off -ij_typescript_assignment_wrap = off -ij_typescript_binary_operation_sign_on_next_line = false -ij_typescript_binary_operation_wrap = off -ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** -ij_typescript_blank_lines_after_imports = 1 -ij_typescript_blank_lines_around_class = 1 -ij_typescript_blank_lines_around_field = 0 -ij_typescript_blank_lines_around_field_in_interface = 0 -ij_typescript_blank_lines_around_function = 1 -ij_typescript_blank_lines_around_method = 1 -ij_typescript_blank_lines_around_method_in_interface = 1 -ij_typescript_block_brace_style = end_of_line -ij_typescript_call_parameters_new_line_after_left_paren = false -ij_typescript_call_parameters_right_paren_on_new_line = false -ij_typescript_call_parameters_wrap = off -ij_typescript_catch_on_new_line = false -ij_typescript_chained_call_dot_on_new_line = true -ij_typescript_class_brace_style = end_of_line -ij_typescript_comma_on_new_line = false -ij_typescript_do_while_brace_force = never -ij_typescript_else_on_new_line = false -ij_typescript_enforce_trailing_comma = keep -ij_typescript_extends_keyword_wrap = off -ij_typescript_extends_list_wrap = off -ij_typescript_field_prefix = _ -ij_typescript_file_name_style = relaxed -ij_typescript_finally_on_new_line = false -ij_typescript_for_brace_force = never -ij_typescript_for_statement_new_line_after_left_paren = false -ij_typescript_for_statement_right_paren_on_new_line = false -ij_typescript_for_statement_wrap = off -ij_typescript_force_quote_style = false -ij_typescript_force_semicolon_style = false -ij_typescript_function_expression_brace_style = end_of_line -ij_typescript_if_brace_force = never -ij_typescript_import_merge_members = global -ij_typescript_import_prefer_absolute_path = global -ij_typescript_import_sort_members = true -ij_typescript_import_sort_module_name = false -ij_typescript_import_use_node_resolution = true -ij_typescript_imports_wrap = on_every_item -ij_typescript_indent_case_from_switch = true -ij_typescript_indent_chained_calls = true -ij_typescript_indent_package_children = 0 -ij_typescript_jsdoc_include_types = false -ij_typescript_jsx_attribute_value = braces -ij_typescript_keep_blank_lines_in_code = 2 -ij_typescript_keep_first_column_comment = true -ij_typescript_keep_indents_on_empty_lines = false -ij_typescript_keep_line_breaks = true -ij_typescript_keep_simple_blocks_in_one_line = false -ij_typescript_keep_simple_methods_in_one_line = false -ij_typescript_line_comment_add_space = true -ij_typescript_line_comment_at_first_column = false -ij_typescript_method_brace_style = end_of_line -ij_typescript_method_call_chain_wrap = off -ij_typescript_method_parameters_new_line_after_left_paren = false -ij_typescript_method_parameters_right_paren_on_new_line = false -ij_typescript_method_parameters_wrap = off -ij_typescript_object_literal_wrap = on_every_item -ij_typescript_parentheses_expression_new_line_after_left_paren = false -ij_typescript_parentheses_expression_right_paren_on_new_line = false -ij_typescript_place_assignment_sign_on_next_line = false -ij_typescript_prefer_as_type_cast = false -ij_typescript_prefer_explicit_types_function_expression_returns = false -ij_typescript_prefer_explicit_types_function_returns = false -ij_typescript_prefer_explicit_types_vars_fields = false -ij_typescript_prefer_parameters_wrap = false -ij_typescript_reformat_c_style_comments = false -ij_typescript_space_after_colon = true -ij_typescript_space_after_comma = true -ij_typescript_space_after_dots_in_rest_parameter = false -ij_typescript_space_after_generator_mult = true -ij_typescript_space_after_property_colon = true -ij_typescript_space_after_quest = true -ij_typescript_space_after_type_colon = true -ij_typescript_space_after_unary_not = false -ij_typescript_space_before_async_arrow_lparen = true -ij_typescript_space_before_catch_keyword = true -ij_typescript_space_before_catch_left_brace = true -ij_typescript_space_before_catch_parentheses = true -ij_typescript_space_before_class_lbrace = true -ij_typescript_space_before_class_left_brace = true -ij_typescript_space_before_colon = true -ij_typescript_space_before_comma = false -ij_typescript_space_before_do_left_brace = true -ij_typescript_space_before_else_keyword = true -ij_typescript_space_before_else_left_brace = true -ij_typescript_space_before_finally_keyword = true -ij_typescript_space_before_finally_left_brace = true -ij_typescript_space_before_for_left_brace = true -ij_typescript_space_before_for_parentheses = true -ij_typescript_space_before_for_semicolon = false -ij_typescript_space_before_function_left_parenth = true -ij_typescript_space_before_generator_mult = false -ij_typescript_space_before_if_left_brace = true -ij_typescript_space_before_if_parentheses = true -ij_typescript_space_before_method_call_parentheses = false -ij_typescript_space_before_method_left_brace = true -ij_typescript_space_before_method_parentheses = false -ij_typescript_space_before_property_colon = false -ij_typescript_space_before_quest = true -ij_typescript_space_before_switch_left_brace = true -ij_typescript_space_before_switch_parentheses = true -ij_typescript_space_before_try_left_brace = true -ij_typescript_space_before_type_colon = false -ij_typescript_space_before_unary_not = false -ij_typescript_space_before_while_keyword = true -ij_typescript_space_before_while_left_brace = true -ij_typescript_space_before_while_parentheses = true -ij_typescript_spaces_around_additive_operators = true -ij_typescript_spaces_around_arrow_function_operator = true -ij_typescript_spaces_around_assignment_operators = true -ij_typescript_spaces_around_bitwise_operators = true -ij_typescript_spaces_around_equality_operators = true -ij_typescript_spaces_around_logical_operators = true -ij_typescript_spaces_around_multiplicative_operators = true -ij_typescript_spaces_around_relational_operators = true -ij_typescript_spaces_around_shift_operators = true -ij_typescript_spaces_around_unary_operator = false -ij_typescript_spaces_within_array_initializer_brackets = false -ij_typescript_spaces_within_brackets = false -ij_typescript_spaces_within_catch_parentheses = false -ij_typescript_spaces_within_for_parentheses = false -ij_typescript_spaces_within_if_parentheses = false -ij_typescript_spaces_within_imports = false -ij_typescript_spaces_within_interpolation_expressions = false -ij_typescript_spaces_within_method_call_parentheses = false -ij_typescript_spaces_within_method_parentheses = false -ij_typescript_spaces_within_object_literal_braces = false -ij_typescript_spaces_within_object_type_braces = true -ij_typescript_spaces_within_parentheses = false -ij_typescript_spaces_within_switch_parentheses = false -ij_typescript_spaces_within_type_assertion = false -ij_typescript_spaces_within_union_types = true -ij_typescript_spaces_within_while_parentheses = false -ij_typescript_special_else_if_treatment = true -ij_typescript_ternary_operation_signs_on_next_line = false -ij_typescript_ternary_operation_wrap = off -ij_typescript_union_types_wrap = on_every_item -ij_typescript_use_chained_calls_group_indents = false -ij_typescript_use_double_quotes = true -ij_typescript_use_explicit_js_extension = global -ij_typescript_use_path_mapping = always -ij_typescript_use_public_modifier = false -ij_typescript_use_semicolon_after_statement = true -ij_typescript_var_declaration_wrap = normal -ij_typescript_while_brace_force = never -ij_typescript_while_on_new_line = false -ij_typescript_wrap_comments = false - -[{*.bash,*.sh,*.zsh}] -indent_size = 2 -tab_width = 2 -ij_shell_binary_ops_start_line = false -ij_shell_keep_column_alignment_padding = false -ij_shell_minify_program = false -ij_shell_redirect_followed_by_space = false -ij_shell_switch_cases_indented = false - -[{*.cjs,*.js}] -ij_continuation_indent_size = 4 -ij_javascript_align_imports = false -ij_javascript_align_multiline_array_initializer_expression = false -ij_javascript_align_multiline_binary_operation = false -ij_javascript_align_multiline_chained_methods = false -ij_javascript_align_multiline_extends_list = false -ij_javascript_align_multiline_for = true -ij_javascript_align_multiline_parameters = true -ij_javascript_align_multiline_parameters_in_calls = false -ij_javascript_align_multiline_ternary_operation = false -ij_javascript_align_object_properties = 0 -ij_javascript_align_union_types = false -ij_javascript_align_var_statements = 0 -ij_javascript_array_initializer_new_line_after_left_brace = false -ij_javascript_array_initializer_right_brace_on_new_line = false -ij_javascript_array_initializer_wrap = off -ij_javascript_assignment_wrap = off -ij_javascript_binary_operation_sign_on_next_line = false -ij_javascript_binary_operation_wrap = off -ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** -ij_javascript_blank_lines_after_imports = 1 -ij_javascript_blank_lines_around_class = 1 -ij_javascript_blank_lines_around_field = 0 -ij_javascript_blank_lines_around_function = 1 -ij_javascript_blank_lines_around_method = 1 -ij_javascript_block_brace_style = end_of_line -ij_javascript_call_parameters_new_line_after_left_paren = false -ij_javascript_call_parameters_right_paren_on_new_line = false -ij_javascript_call_parameters_wrap = off -ij_javascript_catch_on_new_line = false -ij_javascript_chained_call_dot_on_new_line = true -ij_javascript_class_brace_style = end_of_line -ij_javascript_comma_on_new_line = false -ij_javascript_do_while_brace_force = never -ij_javascript_else_on_new_line = false -ij_javascript_enforce_trailing_comma = keep -ij_javascript_extends_keyword_wrap = off -ij_javascript_extends_list_wrap = off -ij_javascript_field_prefix = _ -ij_javascript_file_name_style = relaxed -ij_javascript_finally_on_new_line = false -ij_javascript_for_brace_force = never -ij_javascript_for_statement_new_line_after_left_paren = false -ij_javascript_for_statement_right_paren_on_new_line = false -ij_javascript_for_statement_wrap = off -ij_javascript_force_quote_style = false -ij_javascript_force_semicolon_style = false -ij_javascript_function_expression_brace_style = end_of_line -ij_javascript_if_brace_force = never -ij_javascript_import_merge_members = global -ij_javascript_import_prefer_absolute_path = global -ij_javascript_import_sort_members = true -ij_javascript_import_sort_module_name = false -ij_javascript_import_use_node_resolution = true -ij_javascript_imports_wrap = on_every_item -ij_javascript_indent_case_from_switch = true -ij_javascript_indent_chained_calls = true -ij_javascript_indent_package_children = 0 -ij_javascript_jsx_attribute_value = braces -ij_javascript_keep_blank_lines_in_code = 2 -ij_javascript_keep_first_column_comment = true -ij_javascript_keep_indents_on_empty_lines = false -ij_javascript_keep_line_breaks = true -ij_javascript_keep_simple_blocks_in_one_line = false -ij_javascript_keep_simple_methods_in_one_line = false -ij_javascript_line_comment_add_space = true -ij_javascript_line_comment_at_first_column = false -ij_javascript_method_brace_style = end_of_line -ij_javascript_method_call_chain_wrap = off -ij_javascript_method_parameters_new_line_after_left_paren = false -ij_javascript_method_parameters_right_paren_on_new_line = false -ij_javascript_method_parameters_wrap = off -ij_javascript_object_literal_wrap = on_every_item -ij_javascript_parentheses_expression_new_line_after_left_paren = false -ij_javascript_parentheses_expression_right_paren_on_new_line = false -ij_javascript_place_assignment_sign_on_next_line = false -ij_javascript_prefer_as_type_cast = false -ij_javascript_prefer_explicit_types_function_expression_returns = false -ij_javascript_prefer_explicit_types_function_returns = false -ij_javascript_prefer_explicit_types_vars_fields = false -ij_javascript_prefer_parameters_wrap = false -ij_javascript_reformat_c_style_comments = false -ij_javascript_space_after_colon = true -ij_javascript_space_after_comma = true -ij_javascript_space_after_dots_in_rest_parameter = false -ij_javascript_space_after_generator_mult = true -ij_javascript_space_after_property_colon = true -ij_javascript_space_after_quest = true -ij_javascript_space_after_type_colon = true -ij_javascript_space_after_unary_not = false -ij_javascript_space_before_async_arrow_lparen = true -ij_javascript_space_before_catch_keyword = true -ij_javascript_space_before_catch_left_brace = true -ij_javascript_space_before_catch_parentheses = true -ij_javascript_space_before_class_lbrace = true -ij_javascript_space_before_class_left_brace = true -ij_javascript_space_before_colon = true -ij_javascript_space_before_comma = false -ij_javascript_space_before_do_left_brace = true -ij_javascript_space_before_else_keyword = true -ij_javascript_space_before_else_left_brace = true -ij_javascript_space_before_finally_keyword = true -ij_javascript_space_before_finally_left_brace = true -ij_javascript_space_before_for_left_brace = true -ij_javascript_space_before_for_parentheses = true -ij_javascript_space_before_for_semicolon = false -ij_javascript_space_before_function_left_parenth = true -ij_javascript_space_before_generator_mult = false -ij_javascript_space_before_if_left_brace = true -ij_javascript_space_before_if_parentheses = true -ij_javascript_space_before_method_call_parentheses = false -ij_javascript_space_before_method_left_brace = true -ij_javascript_space_before_method_parentheses = false -ij_javascript_space_before_property_colon = false -ij_javascript_space_before_quest = true -ij_javascript_space_before_switch_left_brace = true -ij_javascript_space_before_switch_parentheses = true -ij_javascript_space_before_try_left_brace = true -ij_javascript_space_before_type_colon = false -ij_javascript_space_before_unary_not = false -ij_javascript_space_before_while_keyword = true -ij_javascript_space_before_while_left_brace = true -ij_javascript_space_before_while_parentheses = true -ij_javascript_spaces_around_additive_operators = true -ij_javascript_spaces_around_arrow_function_operator = true -ij_javascript_spaces_around_assignment_operators = true -ij_javascript_spaces_around_bitwise_operators = true -ij_javascript_spaces_around_equality_operators = true -ij_javascript_spaces_around_logical_operators = true -ij_javascript_spaces_around_multiplicative_operators = true -ij_javascript_spaces_around_relational_operators = true -ij_javascript_spaces_around_shift_operators = true -ij_javascript_spaces_around_unary_operator = false -ij_javascript_spaces_within_array_initializer_brackets = false -ij_javascript_spaces_within_brackets = false -ij_javascript_spaces_within_catch_parentheses = false -ij_javascript_spaces_within_for_parentheses = false -ij_javascript_spaces_within_if_parentheses = false -ij_javascript_spaces_within_imports = false -ij_javascript_spaces_within_interpolation_expressions = false -ij_javascript_spaces_within_method_call_parentheses = false -ij_javascript_spaces_within_method_parentheses = false -ij_javascript_spaces_within_object_literal_braces = false -ij_javascript_spaces_within_object_type_braces = true -ij_javascript_spaces_within_parentheses = false -ij_javascript_spaces_within_switch_parentheses = false -ij_javascript_spaces_within_type_assertion = false -ij_javascript_spaces_within_union_types = true -ij_javascript_spaces_within_while_parentheses = false -ij_javascript_special_else_if_treatment = true -ij_javascript_ternary_operation_signs_on_next_line = false -ij_javascript_ternary_operation_wrap = off -ij_javascript_union_types_wrap = on_every_item -ij_javascript_use_chained_calls_group_indents = false -ij_javascript_use_double_quotes = true -ij_javascript_use_explicit_js_extension = global -ij_javascript_use_path_mapping = always -ij_javascript_use_public_modifier = false -ij_javascript_use_semicolon_after_statement = true -ij_javascript_var_declaration_wrap = normal -ij_javascript_while_brace_force = never -ij_javascript_while_on_new_line = false -ij_javascript_wrap_comments = false - -[{*.cjsx,*.coffee}] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 2 -ij_coffeescript_align_function_body = false -ij_coffeescript_align_imports = false -ij_coffeescript_align_multiline_array_initializer_expression = true -ij_coffeescript_align_multiline_parameters = true -ij_coffeescript_align_multiline_parameters_in_calls = false -ij_coffeescript_align_object_properties = 0 -ij_coffeescript_align_union_types = false -ij_coffeescript_align_var_statements = 0 -ij_coffeescript_array_initializer_new_line_after_left_brace = false -ij_coffeescript_array_initializer_right_brace_on_new_line = false -ij_coffeescript_array_initializer_wrap = normal -ij_coffeescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** -ij_coffeescript_blank_lines_around_function = 1 -ij_coffeescript_call_parameters_new_line_after_left_paren = false -ij_coffeescript_call_parameters_right_paren_on_new_line = false -ij_coffeescript_call_parameters_wrap = normal -ij_coffeescript_chained_call_dot_on_new_line = true -ij_coffeescript_comma_on_new_line = false -ij_coffeescript_enforce_trailing_comma = keep -ij_coffeescript_field_prefix = _ -ij_coffeescript_file_name_style = relaxed -ij_coffeescript_force_quote_style = false -ij_coffeescript_force_semicolon_style = false -ij_coffeescript_function_expression_brace_style = end_of_line -ij_coffeescript_import_merge_members = global -ij_coffeescript_import_prefer_absolute_path = global -ij_coffeescript_import_sort_members = true -ij_coffeescript_import_sort_module_name = false -ij_coffeescript_import_use_node_resolution = true -ij_coffeescript_imports_wrap = on_every_item -ij_coffeescript_indent_chained_calls = true -ij_coffeescript_indent_package_children = 0 -ij_coffeescript_jsx_attribute_value = braces -ij_coffeescript_keep_blank_lines_in_code = 2 -ij_coffeescript_keep_first_column_comment = true -ij_coffeescript_keep_indents_on_empty_lines = false -ij_coffeescript_keep_line_breaks = true -ij_coffeescript_keep_simple_methods_in_one_line = false -ij_coffeescript_method_parameters_new_line_after_left_paren = false -ij_coffeescript_method_parameters_right_paren_on_new_line = false -ij_coffeescript_method_parameters_wrap = off -ij_coffeescript_object_literal_wrap = on_every_item -ij_coffeescript_prefer_as_type_cast = false -ij_coffeescript_prefer_explicit_types_function_expression_returns = false -ij_coffeescript_prefer_explicit_types_function_returns = false -ij_coffeescript_prefer_explicit_types_vars_fields = false -ij_coffeescript_reformat_c_style_comments = false -ij_coffeescript_space_after_comma = true -ij_coffeescript_space_after_dots_in_rest_parameter = false -ij_coffeescript_space_after_generator_mult = true -ij_coffeescript_space_after_property_colon = true -ij_coffeescript_space_after_type_colon = true -ij_coffeescript_space_after_unary_not = false -ij_coffeescript_space_before_async_arrow_lparen = true -ij_coffeescript_space_before_class_lbrace = true -ij_coffeescript_space_before_comma = false -ij_coffeescript_space_before_function_left_parenth = true -ij_coffeescript_space_before_generator_mult = false -ij_coffeescript_space_before_property_colon = false -ij_coffeescript_space_before_type_colon = false -ij_coffeescript_space_before_unary_not = false -ij_coffeescript_spaces_around_additive_operators = true -ij_coffeescript_spaces_around_arrow_function_operator = true -ij_coffeescript_spaces_around_assignment_operators = true -ij_coffeescript_spaces_around_bitwise_operators = true -ij_coffeescript_spaces_around_equality_operators = true -ij_coffeescript_spaces_around_logical_operators = true -ij_coffeescript_spaces_around_multiplicative_operators = true -ij_coffeescript_spaces_around_relational_operators = true -ij_coffeescript_spaces_around_shift_operators = true -ij_coffeescript_spaces_around_unary_operator = false -ij_coffeescript_spaces_within_array_initializer_braces = false -ij_coffeescript_spaces_within_array_initializer_brackets = false -ij_coffeescript_spaces_within_imports = false -ij_coffeescript_spaces_within_index_brackets = false -ij_coffeescript_spaces_within_interpolation_expressions = false -ij_coffeescript_spaces_within_method_call_parentheses = false -ij_coffeescript_spaces_within_method_parentheses = false -ij_coffeescript_spaces_within_object_braces = false -ij_coffeescript_spaces_within_object_literal_braces = false -ij_coffeescript_spaces_within_object_type_braces = true -ij_coffeescript_spaces_within_range_brackets = false -ij_coffeescript_spaces_within_type_assertion = false -ij_coffeescript_spaces_within_union_types = true -ij_coffeescript_union_types_wrap = on_every_item -ij_coffeescript_use_chained_calls_group_indents = false -ij_coffeescript_use_double_quotes = true -ij_coffeescript_use_explicit_js_extension = global -ij_coffeescript_use_path_mapping = always -ij_coffeescript_use_public_modifier = false -ij_coffeescript_use_semicolon_after_statement = false -ij_coffeescript_var_declaration_wrap = normal - -[{*.ft,*.vm,*.vsl}] -ij_vtl_keep_indents_on_empty_lines = false - -[{*.gant,*.gradle,*.groovy,*.gy}] -ij_groovy_align_group_field_declarations = false -ij_groovy_align_multiline_array_initializer_expression = false -ij_groovy_align_multiline_assignment = false -ij_groovy_align_multiline_binary_operation = false -ij_groovy_align_multiline_chained_methods = false -ij_groovy_align_multiline_extends_list = false -ij_groovy_align_multiline_for = true -ij_groovy_align_multiline_list_or_map = true -ij_groovy_align_multiline_method_parentheses = false -ij_groovy_align_multiline_parameters = true -ij_groovy_align_multiline_parameters_in_calls = false -ij_groovy_align_multiline_resources = true -ij_groovy_align_multiline_ternary_operation = false -ij_groovy_align_multiline_throws_list = false -ij_groovy_align_named_args_in_map = true -ij_groovy_align_throws_keyword = false -ij_groovy_array_initializer_new_line_after_left_brace = false -ij_groovy_array_initializer_right_brace_on_new_line = false -ij_groovy_array_initializer_wrap = off -ij_groovy_assert_statement_wrap = off -ij_groovy_assignment_wrap = off -ij_groovy_binary_operation_wrap = off -ij_groovy_blank_lines_after_class_header = 0 -ij_groovy_blank_lines_after_imports = 1 -ij_groovy_blank_lines_after_package = 1 -ij_groovy_blank_lines_around_class = 1 -ij_groovy_blank_lines_around_field = 0 -ij_groovy_blank_lines_around_field_in_interface = 0 -ij_groovy_blank_lines_around_method = 1 -ij_groovy_blank_lines_around_method_in_interface = 1 -ij_groovy_blank_lines_before_imports = 1 -ij_groovy_blank_lines_before_method_body = 0 -ij_groovy_blank_lines_before_package = 0 -ij_groovy_block_brace_style = end_of_line -ij_groovy_block_comment_at_first_column = true -ij_groovy_call_parameters_new_line_after_left_paren = false -ij_groovy_call_parameters_right_paren_on_new_line = false -ij_groovy_call_parameters_wrap = off -ij_groovy_catch_on_new_line = false -ij_groovy_class_annotation_wrap = split_into_lines -ij_groovy_class_brace_style = end_of_line -ij_groovy_class_count_to_use_import_on_demand = 5 -ij_groovy_do_while_brace_force = never -ij_groovy_else_on_new_line = false -ij_groovy_enum_constants_wrap = off -ij_groovy_extends_keyword_wrap = off -ij_groovy_extends_list_wrap = off -ij_groovy_field_annotation_wrap = split_into_lines -ij_groovy_finally_on_new_line = false -ij_groovy_for_brace_force = never -ij_groovy_for_statement_new_line_after_left_paren = false -ij_groovy_for_statement_right_paren_on_new_line = false -ij_groovy_for_statement_wrap = off -ij_groovy_if_brace_force = never -ij_groovy_import_annotation_wrap = 2 -ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* -ij_groovy_indent_case_from_switch = true -ij_groovy_indent_label_blocks = true -ij_groovy_insert_inner_class_imports = false -ij_groovy_keep_blank_lines_before_right_brace = 2 -ij_groovy_keep_blank_lines_in_code = 2 -ij_groovy_keep_blank_lines_in_declarations = 2 -ij_groovy_keep_control_statement_in_one_line = true -ij_groovy_keep_first_column_comment = true -ij_groovy_keep_indents_on_empty_lines = false -ij_groovy_keep_line_breaks = true -ij_groovy_keep_multiple_expressions_in_one_line = false -ij_groovy_keep_simple_blocks_in_one_line = false -ij_groovy_keep_simple_classes_in_one_line = true -ij_groovy_keep_simple_lambdas_in_one_line = true -ij_groovy_keep_simple_methods_in_one_line = true -ij_groovy_label_indent_absolute = false -ij_groovy_label_indent_size = 0 -ij_groovy_lambda_brace_style = end_of_line -ij_groovy_layout_static_imports_separately = true -ij_groovy_line_comment_add_space = false -ij_groovy_line_comment_at_first_column = true -ij_groovy_method_annotation_wrap = split_into_lines -ij_groovy_method_brace_style = end_of_line -ij_groovy_method_call_chain_wrap = off -ij_groovy_method_parameters_new_line_after_left_paren = false -ij_groovy_method_parameters_right_paren_on_new_line = false -ij_groovy_method_parameters_wrap = off -ij_groovy_modifier_list_wrap = false -ij_groovy_names_count_to_use_import_on_demand = 3 -ij_groovy_parameter_annotation_wrap = off -ij_groovy_parentheses_expression_new_line_after_left_paren = false -ij_groovy_parentheses_expression_right_paren_on_new_line = false -ij_groovy_prefer_parameters_wrap = false -ij_groovy_resource_list_new_line_after_left_paren = false -ij_groovy_resource_list_right_paren_on_new_line = false -ij_groovy_resource_list_wrap = off -ij_groovy_space_after_assert_separator = true -ij_groovy_space_after_colon = true -ij_groovy_space_after_comma = true -ij_groovy_space_after_comma_in_type_arguments = true -ij_groovy_space_after_for_semicolon = true -ij_groovy_space_after_quest = true -ij_groovy_space_after_type_cast = true -ij_groovy_space_before_annotation_parameter_list = false -ij_groovy_space_before_array_initializer_left_brace = false -ij_groovy_space_before_assert_separator = false -ij_groovy_space_before_catch_keyword = true -ij_groovy_space_before_catch_left_brace = true -ij_groovy_space_before_catch_parentheses = true -ij_groovy_space_before_class_left_brace = true -ij_groovy_space_before_closure_left_brace = true -ij_groovy_space_before_colon = true -ij_groovy_space_before_comma = false -ij_groovy_space_before_do_left_brace = true -ij_groovy_space_before_else_keyword = true -ij_groovy_space_before_else_left_brace = true -ij_groovy_space_before_finally_keyword = true -ij_groovy_space_before_finally_left_brace = true -ij_groovy_space_before_for_left_brace = true -ij_groovy_space_before_for_parentheses = true -ij_groovy_space_before_for_semicolon = false -ij_groovy_space_before_if_left_brace = true -ij_groovy_space_before_if_parentheses = true -ij_groovy_space_before_method_call_parentheses = false -ij_groovy_space_before_method_left_brace = true -ij_groovy_space_before_method_parentheses = false -ij_groovy_space_before_quest = true -ij_groovy_space_before_switch_left_brace = true -ij_groovy_space_before_switch_parentheses = true -ij_groovy_space_before_synchronized_left_brace = true -ij_groovy_space_before_synchronized_parentheses = true -ij_groovy_space_before_try_left_brace = true -ij_groovy_space_before_try_parentheses = true -ij_groovy_space_before_while_keyword = true -ij_groovy_space_before_while_left_brace = true -ij_groovy_space_before_while_parentheses = true -ij_groovy_space_in_named_argument = true -ij_groovy_space_in_named_argument_before_colon = false -ij_groovy_space_within_empty_array_initializer_braces = false -ij_groovy_space_within_empty_method_call_parentheses = false -ij_groovy_spaces_around_additive_operators = true -ij_groovy_spaces_around_assignment_operators = true -ij_groovy_spaces_around_bitwise_operators = true -ij_groovy_spaces_around_equality_operators = true -ij_groovy_spaces_around_lambda_arrow = true -ij_groovy_spaces_around_logical_operators = true -ij_groovy_spaces_around_multiplicative_operators = true -ij_groovy_spaces_around_regex_operators = true -ij_groovy_spaces_around_relational_operators = true -ij_groovy_spaces_around_shift_operators = true -ij_groovy_spaces_within_annotation_parentheses = false -ij_groovy_spaces_within_array_initializer_braces = false -ij_groovy_spaces_within_braces = true -ij_groovy_spaces_within_brackets = false -ij_groovy_spaces_within_cast_parentheses = false -ij_groovy_spaces_within_catch_parentheses = false -ij_groovy_spaces_within_for_parentheses = false -ij_groovy_spaces_within_gstring_injection_braces = false -ij_groovy_spaces_within_if_parentheses = false -ij_groovy_spaces_within_list_or_map = false -ij_groovy_spaces_within_method_call_parentheses = false -ij_groovy_spaces_within_method_parentheses = false -ij_groovy_spaces_within_parentheses = false -ij_groovy_spaces_within_switch_parentheses = false -ij_groovy_spaces_within_synchronized_parentheses = false -ij_groovy_spaces_within_try_parentheses = false -ij_groovy_spaces_within_tuple_expression = false -ij_groovy_spaces_within_while_parentheses = false -ij_groovy_special_else_if_treatment = true -ij_groovy_ternary_operation_wrap = off -ij_groovy_throws_keyword_wrap = off -ij_groovy_throws_list_wrap = off -ij_groovy_use_flying_geese_braces = false -ij_groovy_use_fq_class_names = false -ij_groovy_use_fq_class_names_in_javadoc = true -ij_groovy_use_relative_indents = false -ij_groovy_use_single_class_imports = true -ij_groovy_variable_annotation_wrap = off -ij_groovy_while_brace_force = never -ij_groovy_while_on_new_line = false -ij_groovy_wrap_long_lines = false - -[{*.gradle.kts,*.kt,*.kts,*.main.kts}] -ij_kotlin_align_in_columns_case_branch = false -ij_kotlin_align_multiline_binary_operation = false -ij_kotlin_align_multiline_extends_list = false -ij_kotlin_align_multiline_method_parentheses = false -ij_kotlin_align_multiline_parameters = true -ij_kotlin_align_multiline_parameters_in_calls = false -ij_kotlin_allow_trailing_comma = false -ij_kotlin_allow_trailing_comma_on_call_site = false -ij_kotlin_assignment_wrap = normal -ij_kotlin_blank_lines_after_class_header = 0 -ij_kotlin_blank_lines_around_block_when_branches = 0 -ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 -ij_kotlin_block_comment_at_first_column = true -ij_kotlin_call_parameters_new_line_after_left_paren = true -ij_kotlin_call_parameters_right_paren_on_new_line = true -ij_kotlin_call_parameters_wrap = on_every_item -ij_kotlin_catch_on_new_line = false -ij_kotlin_class_annotation_wrap = split_into_lines -ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL -ij_kotlin_continuation_indent_for_chained_calls = false -ij_kotlin_continuation_indent_for_expression_bodies = false -ij_kotlin_continuation_indent_in_argument_lists = false -ij_kotlin_continuation_indent_in_elvis = false -ij_kotlin_continuation_indent_in_if_conditions = false -ij_kotlin_continuation_indent_in_parameter_lists = false -ij_kotlin_continuation_indent_in_supertype_lists = false -ij_kotlin_else_on_new_line = false -ij_kotlin_enum_constants_wrap = off -ij_kotlin_extends_list_wrap = normal -ij_kotlin_field_annotation_wrap = split_into_lines -ij_kotlin_finally_on_new_line = false -ij_kotlin_if_rparen_on_new_line = true -ij_kotlin_import_nested_classes = false -ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ -ij_kotlin_insert_whitespaces_in_simple_one_line_method = true -ij_kotlin_keep_blank_lines_before_right_brace = 2 -ij_kotlin_keep_blank_lines_in_code = 2 -ij_kotlin_keep_blank_lines_in_declarations = 2 -ij_kotlin_keep_first_column_comment = true -ij_kotlin_keep_indents_on_empty_lines = false -ij_kotlin_keep_line_breaks = true -ij_kotlin_lbrace_on_next_line = false -ij_kotlin_line_comment_add_space = false -ij_kotlin_line_comment_at_first_column = true -ij_kotlin_method_annotation_wrap = split_into_lines -ij_kotlin_method_call_chain_wrap = normal -ij_kotlin_method_parameters_new_line_after_left_paren = true -ij_kotlin_method_parameters_right_paren_on_new_line = true -ij_kotlin_method_parameters_wrap = on_every_item -ij_kotlin_name_count_to_use_star_import = 5 -ij_kotlin_name_count_to_use_star_import_for_members = 3 -ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.** -ij_kotlin_parameter_annotation_wrap = off -ij_kotlin_space_after_comma = true -ij_kotlin_space_after_extend_colon = true -ij_kotlin_space_after_type_colon = true -ij_kotlin_space_before_catch_parentheses = true -ij_kotlin_space_before_comma = false -ij_kotlin_space_before_extend_colon = true -ij_kotlin_space_before_for_parentheses = true -ij_kotlin_space_before_if_parentheses = true -ij_kotlin_space_before_lambda_arrow = true -ij_kotlin_space_before_type_colon = false -ij_kotlin_space_before_when_parentheses = true -ij_kotlin_space_before_while_parentheses = true -ij_kotlin_spaces_around_additive_operators = true -ij_kotlin_spaces_around_assignment_operators = true -ij_kotlin_spaces_around_equality_operators = true -ij_kotlin_spaces_around_function_type_arrow = true -ij_kotlin_spaces_around_logical_operators = true -ij_kotlin_spaces_around_multiplicative_operators = true -ij_kotlin_spaces_around_range = false -ij_kotlin_spaces_around_relational_operators = true -ij_kotlin_spaces_around_unary_operator = false -ij_kotlin_spaces_around_when_arrow = true -ij_kotlin_variable_annotation_wrap = off -ij_kotlin_while_on_new_line = false -ij_kotlin_wrap_elvis_expressions = 1 -ij_kotlin_wrap_expression_body_functions = 1 -ij_kotlin_wrap_first_method_in_call_chain = false - -[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config,mcmod.info,pack.mcmeta}] -indent_size = 2 -ij_json_keep_blank_lines_in_code = 0 -ij_json_keep_indents_on_empty_lines = false -ij_json_keep_line_breaks = true -ij_json_space_after_colon = true -ij_json_space_after_comma = true -ij_json_space_before_colon = true -ij_json_space_before_comma = false -ij_json_spaces_within_braces = false -ij_json_spaces_within_brackets = false -ij_json_wrap_long_lines = false - -[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 -ij_html_align_attributes = true -ij_html_align_text = false -ij_html_attribute_wrap = normal -ij_html_block_comment_at_first_column = true -ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p -ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot -ij_html_enforce_quotes = false -ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var -ij_html_keep_blank_lines = 2 -ij_html_keep_indents_on_empty_lines = false -ij_html_keep_line_breaks = true -ij_html_keep_line_breaks_in_text = true -ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea -ij_html_line_comment_at_first_column = true -ij_html_new_line_after_last_attribute = never -ij_html_new_line_before_first_attribute = never -ij_html_quote_style = double -ij_html_remove_new_line_before_tags = br -ij_html_space_after_tag_name = false -ij_html_space_around_equality_in_attribute = false -ij_html_space_inside_empty_tag = false -ij_html_text_wrap = normal -ij_html_uniform_ident = false - -[{*.jsf,*.jsp,*.jspf,*.tag,*.tagf,*.xjsp}] -ij_jsp_jsp_prefer_comma_separated_import_list = false -ij_jsp_keep_indents_on_empty_lines = false - -[{*.jspx,*.tagx}] -ij_jspx_keep_indents_on_empty_lines = false - -[{*.markdown,*.md}] -ij_markdown_force_one_space_after_blockquote_symbol = true -ij_markdown_force_one_space_after_header_symbol = true -ij_markdown_force_one_space_after_list_bullet = true -ij_markdown_force_one_space_between_words = true -ij_markdown_keep_indents_on_empty_lines = false -ij_markdown_max_lines_around_block_elements = 1 -ij_markdown_max_lines_around_header = 1 -ij_markdown_max_lines_between_paragraphs = 1 -ij_markdown_min_lines_around_block_elements = 1 -ij_markdown_min_lines_around_header = 1 -ij_markdown_min_lines_between_paragraphs = 1 - -[{*.properties,spring.handlers,spring.schemas}] -ij_properties_align_group_field_declarations = false -ij_properties_keep_blank_lines = false -ij_properties_key_value_delimiter = equals -ij_properties_spaces_around_key_value_delimiter = false - -[{*.yaml,*.yml}] -indent_size = 2 -ij_yaml_align_values_properties = do_not_align -ij_yaml_autoinsert_sequence_marker = true -ij_yaml_block_mapping_on_new_line = false -ij_yaml_indent_sequence_value = true -ij_yaml_keep_indents_on_empty_lines = false -ij_yaml_keep_line_breaks = true -ij_yaml_sequence_on_new_line = false -ij_yaml_space_before_colon = false -ij_yaml_spaces_within_braces = true -ij_yaml_spaces_within_brackets = true +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = false +max_line_length = 120 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align + +[*.feature] +indent_size = 2 +ij_gherkin_keep_indents_on_empty_lines = false + +[*.haml] +indent_size = 2 +ij_haml_keep_indents_on_empty_lines = false + +[*.java] +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 1 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_at_first_column = true +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 2 +ij_java_class_names_in_javadoc = 1 +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_entity_dd_suffix = EJB +ij_java_entity_eb_suffix = Bean +ij_java_entity_hi_suffix = Home +ij_java_entity_lhi_prefix = Local +ij_java_entity_lhi_suffix = Home +ij_java_entity_li_prefix = Local +ij_java_entity_pk_class = java.lang.String +ij_java_entity_vo_suffix = VO +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = never +ij_java_imports_layout = *,|,javax.**,java.**,|,$* +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = true +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_at_first_column = true +ij_java_message_dd_suffix = EJB +ij_java_message_eb_suffix = Bean +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 3 +ij_java_new_line_after_lparen_in_record_header = false +ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_record_header = false +ij_java_session_dd_suffix = EJB +ij_java_session_eb_suffix = Bean +ij_java_session_hi_suffix = Home +ij_java_session_lhi_prefix = Local +ij_java_session_lhi_suffix = Home +ij_java_session_li_prefix = Local +ij_java_session_si_suffix = Service +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[*.less] +indent_size = 2 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 + +[*.nbtt] +max_line_length = 150 +ij_continuation_indent_size = 4 +ij_nbtt_keep_indents_on_empty_lines = false +ij_nbtt_space_after_colon = true +ij_nbtt_space_after_comma = true +ij_nbtt_space_before_colon = true +ij_nbtt_space_before_comma = false +ij_nbtt_spaces_within_brackets = false +ij_nbtt_spaces_within_parentheses = false + +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 + +[*.scss] +indent_size = 2 +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 + +[*.styl] +indent_size = 2 +ij_stylus_align_closing_brace_with_properties = false +ij_stylus_blank_lines_around_nested_selector = 1 +ij_stylus_blank_lines_between_blocks = 1 +ij_stylus_brace_placement = 0 +ij_stylus_enforce_quotes_on_format = false +ij_stylus_hex_color_long_format = false +ij_stylus_hex_color_lower_case = false +ij_stylus_hex_color_short_format = false +ij_stylus_hex_color_upper_case = false +ij_stylus_keep_blank_lines_in_code = 2 +ij_stylus_keep_indents_on_empty_lines = false +ij_stylus_keep_single_line_blocks = false +ij_stylus_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_stylus_space_after_colon = true +ij_stylus_space_before_opening_brace = true +ij_stylus_use_double_quotes = true +ij_stylus_value_alignment = 0 + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdd,*.wsdl,*.xjb,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal + +[{*.ats,*.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = global +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false + +[{*.cjs,*.js}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 0 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = off +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = off +ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = off +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = end_of_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = never +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = keep +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = never +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = off +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = never +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = global +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = off +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = off +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = false +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = global +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = never +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.cjsx,*.coffee}] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 2 +ij_coffeescript_align_function_body = false +ij_coffeescript_align_imports = false +ij_coffeescript_align_multiline_array_initializer_expression = true +ij_coffeescript_align_multiline_parameters = true +ij_coffeescript_align_multiline_parameters_in_calls = false +ij_coffeescript_align_object_properties = 0 +ij_coffeescript_align_union_types = false +ij_coffeescript_align_var_statements = 0 +ij_coffeescript_array_initializer_new_line_after_left_brace = false +ij_coffeescript_array_initializer_right_brace_on_new_line = false +ij_coffeescript_array_initializer_wrap = normal +ij_coffeescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_coffeescript_blank_lines_around_function = 1 +ij_coffeescript_call_parameters_new_line_after_left_paren = false +ij_coffeescript_call_parameters_right_paren_on_new_line = false +ij_coffeescript_call_parameters_wrap = normal +ij_coffeescript_chained_call_dot_on_new_line = true +ij_coffeescript_comma_on_new_line = false +ij_coffeescript_enforce_trailing_comma = keep +ij_coffeescript_field_prefix = _ +ij_coffeescript_file_name_style = relaxed +ij_coffeescript_force_quote_style = false +ij_coffeescript_force_semicolon_style = false +ij_coffeescript_function_expression_brace_style = end_of_line +ij_coffeescript_import_merge_members = global +ij_coffeescript_import_prefer_absolute_path = global +ij_coffeescript_import_sort_members = true +ij_coffeescript_import_sort_module_name = false +ij_coffeescript_import_use_node_resolution = true +ij_coffeescript_imports_wrap = on_every_item +ij_coffeescript_indent_chained_calls = true +ij_coffeescript_indent_package_children = 0 +ij_coffeescript_jsx_attribute_value = braces +ij_coffeescript_keep_blank_lines_in_code = 2 +ij_coffeescript_keep_first_column_comment = true +ij_coffeescript_keep_indents_on_empty_lines = false +ij_coffeescript_keep_line_breaks = true +ij_coffeescript_keep_simple_methods_in_one_line = false +ij_coffeescript_method_parameters_new_line_after_left_paren = false +ij_coffeescript_method_parameters_right_paren_on_new_line = false +ij_coffeescript_method_parameters_wrap = off +ij_coffeescript_object_literal_wrap = on_every_item +ij_coffeescript_prefer_as_type_cast = false +ij_coffeescript_prefer_explicit_types_function_expression_returns = false +ij_coffeescript_prefer_explicit_types_function_returns = false +ij_coffeescript_prefer_explicit_types_vars_fields = false +ij_coffeescript_reformat_c_style_comments = false +ij_coffeescript_space_after_comma = true +ij_coffeescript_space_after_dots_in_rest_parameter = false +ij_coffeescript_space_after_generator_mult = true +ij_coffeescript_space_after_property_colon = true +ij_coffeescript_space_after_type_colon = true +ij_coffeescript_space_after_unary_not = false +ij_coffeescript_space_before_async_arrow_lparen = true +ij_coffeescript_space_before_class_lbrace = true +ij_coffeescript_space_before_comma = false +ij_coffeescript_space_before_function_left_parenth = true +ij_coffeescript_space_before_generator_mult = false +ij_coffeescript_space_before_property_colon = false +ij_coffeescript_space_before_type_colon = false +ij_coffeescript_space_before_unary_not = false +ij_coffeescript_spaces_around_additive_operators = true +ij_coffeescript_spaces_around_arrow_function_operator = true +ij_coffeescript_spaces_around_assignment_operators = true +ij_coffeescript_spaces_around_bitwise_operators = true +ij_coffeescript_spaces_around_equality_operators = true +ij_coffeescript_spaces_around_logical_operators = true +ij_coffeescript_spaces_around_multiplicative_operators = true +ij_coffeescript_spaces_around_relational_operators = true +ij_coffeescript_spaces_around_shift_operators = true +ij_coffeescript_spaces_around_unary_operator = false +ij_coffeescript_spaces_within_array_initializer_braces = false +ij_coffeescript_spaces_within_array_initializer_brackets = false +ij_coffeescript_spaces_within_imports = false +ij_coffeescript_spaces_within_index_brackets = false +ij_coffeescript_spaces_within_interpolation_expressions = false +ij_coffeescript_spaces_within_method_call_parentheses = false +ij_coffeescript_spaces_within_method_parentheses = false +ij_coffeescript_spaces_within_object_braces = false +ij_coffeescript_spaces_within_object_literal_braces = false +ij_coffeescript_spaces_within_object_type_braces = true +ij_coffeescript_spaces_within_range_brackets = false +ij_coffeescript_spaces_within_type_assertion = false +ij_coffeescript_spaces_within_union_types = true +ij_coffeescript_union_types_wrap = on_every_item +ij_coffeescript_use_chained_calls_group_indents = false +ij_coffeescript_use_double_quotes = true +ij_coffeescript_use_explicit_js_extension = global +ij_coffeescript_use_path_mapping = always +ij_coffeescript_use_public_modifier = false +ij_coffeescript_use_semicolon_after_statement = false +ij_coffeescript_var_declaration_wrap = normal + +[{*.ft,*.vm,*.vsl}] +ij_vtl_keep_indents_on_empty_lines = false + +[{*.gant,*.gradle,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_long_lines = false + +[{*.gradle.kts,*.kt,*.kts,*.main.kts}] +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = normal +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = true +ij_kotlin_call_parameters_right_paren_on_new_line = true +ij_kotlin_call_parameters_wrap = on_every_item +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = false +ij_kotlin_continuation_indent_for_expression_bodies = false +ij_kotlin_continuation_indent_in_argument_lists = false +ij_kotlin_continuation_indent_in_elvis = false +ij_kotlin_continuation_indent_in_if_conditions = false +ij_kotlin_continuation_indent_in_parameter_lists = false +ij_kotlin_continuation_indent_in_supertype_lists = false +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = normal +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = true +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = normal +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = on_every_item +ij_kotlin_name_count_to_use_star_import = 5 +ij_kotlin_name_count_to_use_star_import_for_members = 3 +ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 1 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config,mcmod.info,pack.mcmeta}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal +ij_html_uniform_ident = false + +[{*.jsf,*.jsp,*.jspf,*.tag,*.tagf,*.xjsp}] +ij_jsp_jsp_prefer_comma_separated_import_list = false +ij_jsp_keep_indents_on_empty_lines = false + +[{*.jspx,*.tagx}] +ij_jspx_keep_indents_on_empty_lines = false + +[{*.markdown,*.md}] +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 + +[{*.properties,spring.handlers,spring.schemas}] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[{*.yaml,*.yml}] +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index 64b2eecc..38d6b41c 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -1,159 +1,159 @@ -package com.diamondfire.helpbot.bot; - -import com.diamondfire.helpbot.bot.command.CommandHandler; -import com.diamondfire.helpbot.bot.command.impl.codeblock.*; -import com.diamondfire.helpbot.bot.command.impl.other.StoreCommand; -import com.diamondfire.helpbot.bot.command.impl.other.dev.*; -import com.diamondfire.helpbot.bot.command.impl.other.dumps.*; -import com.diamondfire.helpbot.bot.command.impl.other.fun.*; -import com.diamondfire.helpbot.bot.command.impl.other.info.*; -import com.diamondfire.helpbot.bot.command.impl.other.mod.*; -import com.diamondfire.helpbot.bot.command.impl.other.tag.TagCommand; -import com.diamondfire.helpbot.bot.command.impl.other.util.*; -import com.diamondfire.helpbot.bot.command.impl.stats.*; -import com.diamondfire.helpbot.bot.command.impl.stats.graph.*; -import com.diamondfire.helpbot.bot.command.impl.stats.individualized.*; -import com.diamondfire.helpbot.bot.command.impl.stats.metrics.*; -import com.diamondfire.helpbot.bot.command.impl.stats.plot.*; -import com.diamondfire.helpbot.bot.command.impl.stats.support.*; -import com.diamondfire.helpbot.bot.command.impl.stats.top.*; -import com.diamondfire.helpbot.bot.config.Config; -import com.diamondfire.helpbot.bot.events.*; -import com.diamondfire.helpbot.sys.tasks.TaskRegistry; -import com.google.gson.Gson; -import net.dv8tion.jda.api.*; -import net.dv8tion.jda.api.entities.Activity; -import net.dv8tion.jda.api.requests.GatewayIntent; -import net.dv8tion.jda.api.utils.MemberCachePolicy; -import net.dv8tion.jda.api.utils.cache.CacheFlag; -import okhttp3.OkHttpClient; - -import javax.security.auth.login.LoginException; - -public class HelpBotInstance { - - private static final Config config = new Config(); - public static final long DF_GUILD = config.getGuild(); - public static final long LOG_CHANNEL = config.getLogChannel(); - - public static final Gson GSON = new Gson(); - - private static JDA jda; - private static final TaskRegistry loop = new TaskRegistry(); - - public static void initialize() throws LoginException { - - CommandHandler.getInstance().register( - // codeblock commands - new CodeCommand(), - new RankCommand(), - new BlockCommand(), - new SearchCommand(), - new TagsCommand(), - // others - new CowsayCommand(), - new MimicCommand(), - new FetchDataCommand(), - new InfoCommand(), - new EvalCommand(), - // new GarfieldCommand(), - Dead - new HelpCommand(), - new RestartCommand(), - new ActionDumpCommand(), - new RawCommand(), - new SamQuotesCommand(), - new PolicyCommand(), - new SkinCommand(), - new DisableCommand(), - new EnableCommand(), - new DisableCommand(), - new ImageDumpCommand(), - new SoundListCommand(), - new RulesCommand(), - new BulkExecuteCommand(), - new PermUnlocksCommand(), - new MuteCommand(), - new MutedCommand(), - new UnmuteCommand(), - new VerifyCommand(), - // new PollCommand(), - Unused - new IdeaCommand(), - new StoreCommand(), - // new ChannelMuteCommand(), - not finished - // statsbot - new StatsCommand(), - new SupportBadCommand(), - new JoinBadCommand(), - new PlotCommand(), - new ProfileCommand(), - new ActivePlotsCommand(), - new TrendingPlotsCommand(), - new PlotsCommand(), - //new CpTopCommand(), - new RetiredListCommand(), - new StaffListCommand(), - new SessionTopCommand(), - new LastJoinedCommand(), - new SupporteeStatsCommand(), - new NewPlayersCommand(), - new StatsGraphCommand(), - new NewJoinGraphCommand(), - new PlayersCommand(), - new BoostersCommand(), - new DiscordBoostersCommand(), - new TimeTopCommand(), - new QueueCommand(), - new WhoHelpedCommand(), - new HelpedByCommand(), - // new NamesCommand(), - Dead - new PlayerJoinGraphCommand(), - //new CpCommand(), - //new CpRequirementsCommand(), - new VoteGivenLeaderboard(), - new PlotVoteGraphCommand(), - new JoinDataCommand(), - new TotalStatsCommand(), - new TokenTopCommand(), - new HistoryCommand(), - new UuidCommand(), - new PlotLocCommand(), - new FindSupporteeNamesCommand(), - new SessionsCommand(), - new SupporteeSessionsCommand(), - new ExcuseStaffCommand(), - new ExcusedStaffCommand(), - new SupportBannedPlayersCommand(), - new NbsCommand(), - new DailySessionsCommand(), - new EightBallCommand(), - // new OcrCommand(), - Dead - new JoinsCommand(), - new TagCommand(), - new PurgeCommand() - ); - - JDABuilder builder = JDABuilder.createDefault(config.getToken()) - .enableIntents(GatewayIntent.GUILD_MEMBERS) - .setStatus(OnlineStatus.ONLINE) - .setMemberCachePolicy(MemberCachePolicy.NONE) - .setActivity(Activity.watching("for " + getConfig().getPrefix() + "help")) - .setGatewayEncoding(GatewayEncoding.ETF) - .disableCache(CacheFlag.ACTIVITY, CacheFlag.VOICE_STATE, CacheFlag.CLIENT_STATUS) - .addEventListeners(new MessageEvent(), new ReadyEvent(), new GuildJoinEvent(), new ButtonEvent(), new MessageEditEvent()); - - jda = builder.build(); - CommandHandler.getInstance().initialize(); - } - - public static JDA getJda() { - return jda; - } - - public static Config getConfig() { - return config; - } - - public static TaskRegistry getScheduler() { - return loop; - } -} +package com.diamondfire.helpbot.bot; + +import com.diamondfire.helpbot.bot.command.CommandHandler; +import com.diamondfire.helpbot.bot.command.impl.codeblock.*; +import com.diamondfire.helpbot.bot.command.impl.other.StoreCommand; +import com.diamondfire.helpbot.bot.command.impl.other.dev.*; +import com.diamondfire.helpbot.bot.command.impl.other.dumps.*; +import com.diamondfire.helpbot.bot.command.impl.other.fun.*; +import com.diamondfire.helpbot.bot.command.impl.other.info.*; +import com.diamondfire.helpbot.bot.command.impl.other.mod.*; +import com.diamondfire.helpbot.bot.command.impl.other.tag.TagCommand; +import com.diamondfire.helpbot.bot.command.impl.other.util.*; +import com.diamondfire.helpbot.bot.command.impl.stats.*; +import com.diamondfire.helpbot.bot.command.impl.stats.graph.*; +import com.diamondfire.helpbot.bot.command.impl.stats.individualized.*; +import com.diamondfire.helpbot.bot.command.impl.stats.metrics.*; +import com.diamondfire.helpbot.bot.command.impl.stats.plot.*; +import com.diamondfire.helpbot.bot.command.impl.stats.support.*; +import com.diamondfire.helpbot.bot.command.impl.stats.top.*; +import com.diamondfire.helpbot.bot.config.Config; +import com.diamondfire.helpbot.bot.events.*; +import com.diamondfire.helpbot.sys.tasks.TaskRegistry; +import com.google.gson.Gson; +import net.dv8tion.jda.api.*; +import net.dv8tion.jda.api.entities.Activity; +import net.dv8tion.jda.api.requests.GatewayIntent; +import net.dv8tion.jda.api.utils.MemberCachePolicy; +import net.dv8tion.jda.api.utils.cache.CacheFlag; +import okhttp3.OkHttpClient; + +import javax.security.auth.login.LoginException; + +public class HelpBotInstance { + + private static final Config config = new Config(); + public static final long DF_GUILD = config.getGuild(); + public static final long LOG_CHANNEL = config.getLogChannel(); + + public static final Gson GSON = new Gson(); + + private static JDA jda; + private static final TaskRegistry loop = new TaskRegistry(); + + public static void initialize() throws LoginException { + + CommandHandler.getInstance().register( + // codeblock commands + new CodeCommand(), + new RankCommand(), + new BlockCommand(), + new SearchCommand(), + new TagsCommand(), + // others + new CowsayCommand(), + new MimicCommand(), + new FetchDataCommand(), + new InfoCommand(), + new EvalCommand(), + // new GarfieldCommand(), - Dead + new HelpCommand(), + new RestartCommand(), + new ActionDumpCommand(), + new RawCommand(), + new SamQuotesCommand(), + new PolicyCommand(), + new SkinCommand(), + new DisableCommand(), + new EnableCommand(), + new DisableCommand(), + new ImageDumpCommand(), + new SoundListCommand(), + new RulesCommand(), + new BulkExecuteCommand(), + new PermUnlocksCommand(), + new MuteCommand(), + new MutedCommand(), + new UnmuteCommand(), + new VerifyCommand(), + // new PollCommand(), - Unused + new IdeaCommand(), + new StoreCommand(), + // new ChannelMuteCommand(), - not finished + // statsbot + new StatsCommand(), + new SupportBadCommand(), + new JoinBadCommand(), + new PlotCommand(), + new ProfileCommand(), + new ActivePlotsCommand(), + new TrendingPlotsCommand(), + new PlotsCommand(), + //new CpTopCommand(), + new RetiredListCommand(), + new StaffListCommand(), + new SessionTopCommand(), + new LastJoinedCommand(), + new SupporteeStatsCommand(), + new NewPlayersCommand(), + new StatsGraphCommand(), + new NewJoinGraphCommand(), + new PlayersCommand(), + new BoostersCommand(), + new DiscordBoostersCommand(), + new TimeTopCommand(), + new QueueCommand(), + new WhoHelpedCommand(), + new HelpedByCommand(), + // new NamesCommand(), - Dead + new PlayerJoinGraphCommand(), + //new CpCommand(), + //new CpRequirementsCommand(), + new VoteGivenLeaderboard(), + new PlotVoteGraphCommand(), + new JoinDataCommand(), + new TotalStatsCommand(), + new TokenTopCommand(), + new HistoryCommand(), + new UuidCommand(), + new PlotLocCommand(), + new FindSupporteeNamesCommand(), + new SessionsCommand(), + new SupporteeSessionsCommand(), + new ExcuseStaffCommand(), + new ExcusedStaffCommand(), + new SupportBannedPlayersCommand(), + new NbsCommand(), + new DailySessionsCommand(), + new EightBallCommand(), + // new OcrCommand(), - Dead + new JoinsCommand(), + new TagCommand(), + new PurgeCommand() + ); + + JDABuilder builder = JDABuilder.createDefault(config.getToken()) + .enableIntents(GatewayIntent.GUILD_MEMBERS) + .setStatus(OnlineStatus.ONLINE) + .setMemberCachePolicy(MemberCachePolicy.NONE) + .setActivity(Activity.watching("for " + getConfig().getPrefix() + "help")) + .setGatewayEncoding(GatewayEncoding.ETF) + .disableCache(CacheFlag.ACTIVITY, CacheFlag.VOICE_STATE, CacheFlag.CLIENT_STATUS) + .addEventListeners(new MessageEvent(), new ReadyEvent(), new GuildJoinEvent(), new ButtonEvent(), new MessageEditEvent()); + + jda = builder.build(); + CommandHandler.getInstance().initialize(); + } + + public static JDA getJda() { + return jda; + } + + public static Config getConfig() { + return config; + } + + public static TaskRegistry getScheduler() { + return loop; + } +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java b/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java index f9fbaee5..92468d80 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/argument/impl/types/minecraft/MojangPlayerUUIDArgument.java @@ -1,36 +1,36 @@ -package com.diamondfire.helpbot.bot.command.argument.impl.types.minecraft; - -import com.diamondfire.helpbot.bot.command.argument.impl.parsing.exceptions.ArgumentException; -import com.diamondfire.helpbot.bot.command.argument.impl.types.AbstractSimpleValueArgument; -import com.diamondfire.helpbot.bot.events.CommandEvent; -import com.diamondfire.helpbot.util.*; -import com.google.gson.JsonObject; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.util.UUID; - -// TODO: Player -public class MojangPlayerUUIDArgument extends AbstractSimpleValueArgument { - - @Override - protected UUID parse(@NotNull String argument, CommandEvent event) throws ArgumentException { - if (argument.length() > 16) { - return Util.toUuid(argument); - } else { - JsonObject responseObject = null; - - try { - responseObject = WebUtil.getJson("https://api.mojang.com/users/profiles/minecraft/" + argument).getAsJsonObject(); - } catch (IOException e) { - e.printStackTrace(); - } - - if (responseObject.has("id")) { - return Util.toUuid(responseObject.get("id").getAsString()); - } else { - return null; - } - } - } -} +package com.diamondfire.helpbot.bot.command.argument.impl.types.minecraft; + +import com.diamondfire.helpbot.bot.command.argument.impl.parsing.exceptions.ArgumentException; +import com.diamondfire.helpbot.bot.command.argument.impl.types.AbstractSimpleValueArgument; +import com.diamondfire.helpbot.bot.events.CommandEvent; +import com.diamondfire.helpbot.util.*; +import com.google.gson.JsonObject; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.util.UUID; + +// TODO: Player +public class MojangPlayerUUIDArgument extends AbstractSimpleValueArgument { + + @Override + protected UUID parse(@NotNull String argument, CommandEvent event) throws ArgumentException { + if (argument.length() > 16) { + return Util.toUuid(argument); + } else { + JsonObject responseObject = null; + + try { + responseObject = WebUtil.getJson("https://api.mojang.com/users/profiles/minecraft/" + argument).getAsJsonObject(); + } catch (IOException e) { + e.printStackTrace(); + } + + if (responseObject.has("id")) { + return Util.toUuid(responseObject.get("id").getAsString()); + } else { + return null; + } + } + } +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java index 5b549591..79f0f571 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java +++ b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java @@ -1,105 +1,105 @@ -package com.diamondfire.helpbot.bot.config; - -import com.diamondfire.helpbot.bot.HelpBotInstance; -import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; -import com.google.gson.*; -import com.google.gson.reflect.TypeToken; - -import java.io.*; -import java.nio.file.Files; -import java.util.Map; -import java.util.stream.Collectors; - -public class Config { - - private final JsonObject config; - - public Config() throws IllegalStateException { - try { - this.config = HelpBotInstance.GSON.fromJson(Files.readString(ExternalFiles.CONFIG.toPath()), JsonObject.class); - } catch (Exception exception) { - throw new IllegalStateException("Config not correctly structured! Please check the readme file for a config template."); - } - } - - // Bot Stuff - public String getToken() { - return getPropertyString("token"); - } - - public String getPrefix() { - return getPropertyString("prefix"); - } - - public boolean isDevBot() { - return config.get("dev_bot").getAsBoolean(); - } - - // Mc account - public String getMcEmail() { - return getPropertyString("mc_email"); - } - - public String getMcPassword() { - return getPropertyString("mc_password"); - } - - // Database - public String getDBUrl() { - return getPropertyString("db_link"); - } - - public String getDBUser() { - return getPropertyString("db_user"); - } - - public String getDBPassword() { - return getPropertyString("db_password"); - } - - // General constants - - public String getlabsCoreToken() { - return getPropertyString("labs_token"); - } - - public long getGuild() { - return getPropertyLong("guild"); - } - - public long getLogChannel() { - return getPropertyLong("log_channel"); - } - - public long getDiscussionChannel() { - return getPropertyLong("discussion_channel"); - } - - public long getPurgeEvidenceChannel() { - return getPropertyLong("purge_evidence_channel"); - } - - public long getMutedRole() { - return getPropertyLong("muted_role"); - } - - public long getVerifiedRole() { - return getPropertyLong("verified_role"); - } - - public String getReportWehook() { - return getPropertyString("report_webhook"); - } - - public Map getPermissionRoleMap() { - return HelpBotInstance.GSON.fromJson(config.get("permission_roles"), new TypeToken>(){}.getType()); - } - - private long getPropertyLong(String property) { - return config.get(property).getAsLong(); - } - - private String getPropertyString(String property) { - return config.get(property).getAsString(); - } -} +package com.diamondfire.helpbot.bot.config; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; +import com.google.gson.*; +import com.google.gson.reflect.TypeToken; + +import java.io.*; +import java.nio.file.Files; +import java.util.Map; +import java.util.stream.Collectors; + +public class Config { + + private final JsonObject config; + + public Config() throws IllegalStateException { + try { + this.config = HelpBotInstance.GSON.fromJson(Files.readString(ExternalFiles.CONFIG.toPath()), JsonObject.class); + } catch (Exception exception) { + throw new IllegalStateException("Config not correctly structured! Please check the readme file for a config template."); + } + } + + // Bot Stuff + public String getToken() { + return getPropertyString("token"); + } + + public String getPrefix() { + return getPropertyString("prefix"); + } + + public boolean isDevBot() { + return config.get("dev_bot").getAsBoolean(); + } + + // Mc account + public String getMcEmail() { + return getPropertyString("mc_email"); + } + + public String getMcPassword() { + return getPropertyString("mc_password"); + } + + // Database + public String getDBUrl() { + return getPropertyString("db_link"); + } + + public String getDBUser() { + return getPropertyString("db_user"); + } + + public String getDBPassword() { + return getPropertyString("db_password"); + } + + // General constants + + public String getlabsCoreToken() { + return getPropertyString("labs_token"); + } + + public long getGuild() { + return getPropertyLong("guild"); + } + + public long getLogChannel() { + return getPropertyLong("log_channel"); + } + + public long getDiscussionChannel() { + return getPropertyLong("discussion_channel"); + } + + public long getPurgeEvidenceChannel() { + return getPropertyLong("purge_evidence_channel"); + } + + public long getMutedRole() { + return getPropertyLong("muted_role"); + } + + public long getVerifiedRole() { + return getPropertyLong("verified_role"); + } + + public String getReportWehook() { + return getPropertyString("report_webhook"); + } + + public Map getPermissionRoleMap() { + return HelpBotInstance.GSON.fromJson(config.get("permission_roles"), new TypeToken>(){}.getType()); + } + + private long getPropertyLong(String property) { + return config.get(property).getAsLong(); + } + + private String getPropertyString(String property) { + return config.get(property).getAsString(); + } +} From 4ab3b24952a5f8dfedb4bd8bae4a9a80dfa686ab Mon Sep 17 00:00:00 2001 From: tk2217 Date: Sun, 2 Oct 2022 18:43:08 -0500 Subject: [PATCH 16/27] make gradlew executable (linux moment --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 323e52ff1db6a8ad16b8cc7ed303e2e4a0c44f11 Mon Sep 17 00:00:00 2001 From: Reason <28310208+Reasonlesss@users.noreply.github.com> Date: Fri, 10 Feb 2023 20:14:08 +0000 Subject: [PATCH 17/27] Fix ?garfield command. --- .../java/com/diamondfire/helpbot/bot/HelpBotInstance.java | 2 +- .../helpbot/bot/command/impl/other/fun/GarfieldCommand.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index 380d2007..27ca017c 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -54,7 +54,7 @@ public static void initialize() throws LoginException { new FetchDataCommand(), new InfoCommand(), new EvalCommand(), - // new GarfieldCommand(), - Dead + new GarfieldCommand(), new HelpCommand(), new RestartCommand(), new ActionDumpCommand(), diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/GarfieldCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/GarfieldCommand.java index 05eb8b2a..aefc3552 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/GarfieldCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/GarfieldCommand.java @@ -41,9 +41,9 @@ public Permission getPermission() { public void run(CommandEvent event) { EmbedBuilder builder = new EmbedBuilder(); try { - URL url = new URL("https://labscore.vercel.app/v2/garfield"); + URL url = new URL("https://garfield.justsomederpyst.repl.co/random"); try (BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()))) { - String link = JsonParser.parseString(in.readLine()).getAsJsonObject().get("link").getAsString(); + String link = JsonParser.parseString(in.readLine()).getAsJsonObject().get("direct_url").getAsString(); if (link == null) { throw new IOException(); From 585a9f1b3753c405bb84168214064756aefba79b Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Sun, 12 Feb 2023 22:48:34 -0500 Subject: [PATCH 18/27] Revert "Delete ?query command (#86)" (#95) This reverts commit 6c5b42556b5ea8d9ca1db4c39be74d2f3c1a0c46. --- .../helpbot/bot/HelpBotInstance.java | 1 + .../command/impl/other/dev/QueryCommand.java | 91 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index 27ca017c..3480533b 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -67,6 +67,7 @@ public static void initialize() throws LoginException { new DisableCommand(), new ImageDumpCommand(), new SoundListCommand(), + new QueryCommand(), new RulesCommand(), new BulkExecuteCommand(), new PermUnlocksCommand(), diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java new file mode 100644 index 00000000..0e85f3c6 --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/QueryCommand.java @@ -0,0 +1,91 @@ +package com.diamondfire.helpbot.bot.command.impl.other.dev; + +import com.diamondfire.helpbot.bot.command.argument.ArgumentSet; +import com.diamondfire.helpbot.bot.command.argument.impl.parsing.types.MessageArgument; +import com.diamondfire.helpbot.bot.command.help.*; +import com.diamondfire.helpbot.bot.command.impl.Command; +import com.diamondfire.helpbot.bot.command.permissions.Permission; +import com.diamondfire.helpbot.bot.events.CommandEvent; +import com.diamondfire.helpbot.sys.database.impl.DatabaseQuery; +import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; +import com.diamondfire.helpbot.util.StringUtil; +import net.dv8tion.jda.api.EmbedBuilder; + +import java.io.*; +import java.sql.ResultSet; +import java.util.*; + + +public class QueryCommand extends Command { + + @Override + public String getName() { + return "query"; + } + + @Override + public HelpContext getHelpContext() { + return new HelpContext() + .description("Executes given query.") + .category(CommandCategory.OTHER) + .addArgument( + new HelpContextArgument() + .name("query") + ); + } + + @Override + public ArgumentSet compileArguments() { + return new ArgumentSet() + .addArgument("query", new MessageArgument()); + } + + @Override + public Permission getPermission() { + return Permission.BOT_DEVELOPER; + } + + @SuppressWarnings("LanguageMismatch") + @Override + public void run(CommandEvent event) { + String query = event.getArgument("query"); + EmbedBuilder builder = new EmbedBuilder(); + builder.setTitle("SQL Result"); + + try { + new DatabaseQuery() + .query(new BasicQuery(query)) + .compile() + .run((set) -> { + int width = set.getResult().getMetaData().getColumnCount(); + List objects = new ArrayList<>(); + for (ResultSet resultSet : set) { + HashMap entries = new HashMap<>(); + for (int i = 1; i <= width; i++) { + String columnName = resultSet.getMetaData().getColumnName(i); + entries.put(columnName, String.valueOf(resultSet.getObject(i))); + } + objects.add(StringUtil.asciidocStyle(entries)); + } + + for (int i = 0; i < objects.size(); i++) { + if (i > 25) { + break; + } + builder.addField("Row: " + (i + 1), String.format("```asciidoc\n%s```", objects.get(i)), false); + } + + event.getReplyHandler().reply(builder); + }); + } catch (IllegalStateException e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + String sStackTrace = sw.toString(); + builder.setTitle("Query failed! " + e.getClass().getName()); + event.getChannel().sendMessageEmbeds(builder.build()).queue(); + event.getChannel().sendMessage(String.format("```%s```", sStackTrace.length() >= 1500 ? sStackTrace.substring(0, 1500) : sStackTrace)).queue(); + } + + } + +} From 87c42c57171a254759b815ae65001d77e71495b3 Mon Sep 17 00:00:00 2001 From: TechStreet Date: Sun, 18 Jun 2023 20:53:07 +0100 Subject: [PATCH 19/27] Add pronouns to ProfileCommand (#97) --- .../bot/command/impl/stats/individualized/ProfileCommand.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java index 90a68ac4..5c79d7e3 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java @@ -71,6 +71,7 @@ protected void execute(CommandEvent event, Player player) { String playerName = set.getString("name"); String playerUUID = set.getString("uuid"); String whois = set.getString("whois"); + String pronouns = set.getString("pronouns"); Timestamp joinDate = set.getTimestamp("join_date"); String rankString; @@ -86,6 +87,7 @@ protected void execute(CommandEvent event, Player player) { embed.addField("Name", rankString + " " + StringUtil.display(playerName), false); embed.addField("UUID", playerUUID, false); embed.addField("Whois", StringUtil.display(whois.isEmpty() ? "N/A" : whois).replace("\\n", "\n"), false); + embed.addField("Pronouns", StringUtil.display(pronouns == null || pronouns.isEmpty() ? "N/A" : pronouns), false); Rank[] ranks = RankUtil.getRanks(set); List ranksList = new ArrayList<>(); From b4e95bab5c9599adfa0ba82fd562a5df7f84a04f Mon Sep 17 00:00:00 2001 From: tk2217 Date: Mon, 7 Aug 2023 14:23:35 -0500 Subject: [PATCH 20/27] yep --- .../diamondfire/helpbot/bot/config/Config.java | 5 +++-- .../helpbot/bot/events/MessageEvent.java | 2 +- ... => ReportAndFeatureApplicationAcceptor.java} | 16 ++++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) rename src/main/java/com/diamondfire/helpbot/sys/message/acceptors/{ReportAcceptor.java => ReportAndFeatureApplicationAcceptor.java} (83%) diff --git a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java index 28e18f9e..5cf8a079 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java +++ b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java @@ -4,6 +4,7 @@ import com.google.gson.*; import java.io.*; +import java.util.Map; import java.util.stream.Collectors; public class Config { @@ -84,8 +85,8 @@ public long getVerifiedRole() { return getPropertyLong("verified_role"); } - public String getReportWehook() { - return getPropertyString("report_webhook"); + public JsonObject getForwardingChannels() { + return config.get("forwarding_channels").getAsJsonObject(); } private long getPropertyLong(String property) { diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java index df3c9791..072929ea 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java @@ -10,7 +10,7 @@ public class MessageEvent extends ListenerAdapter { private static final MessageAcceptor[] acceptors = { - new ReportAcceptor(), + new ReportAndFeatureApplicationAcceptor(), new FilterAcceptor(), new CommandAcceptor(), new TagAcceptor(), diff --git a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/ReportAcceptor.java b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/ReportAndFeatureApplicationAcceptor.java similarity index 83% rename from src/main/java/com/diamondfire/helpbot/sys/message/acceptors/ReportAcceptor.java rename to src/main/java/com/diamondfire/helpbot/sys/message/acceptors/ReportAndFeatureApplicationAcceptor.java index 19c80df1..e1b8a194 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/ReportAcceptor.java +++ b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/ReportAndFeatureApplicationAcceptor.java @@ -9,24 +9,21 @@ import java.net.URL; import java.util.concurrent.*; -public class ReportAcceptor implements MessageAcceptor { +public class ReportAndFeatureApplicationAcceptor implements MessageAcceptor { private static final ExecutorService SERVICE = Executors.newCachedThreadPool(); @Override public boolean accept(Message message) { - if (message.getChannel().getIdLong() != 849769323166040124L) { - return false; - } + final var webhookUrl = HelpBotInstance.getConfig().getForwardingChannels().get(message.getChannel().getId()); + if (webhookUrl == null) return false; SERVICE.submit(() -> { - try (WebhookClient client = JDAWebhookClient.withUrl(HelpBotInstance.getConfig().getReportWehook())) { + try (WebhookClient client = JDAWebhookClient.withUrl(webhookUrl.getAsString())) { boolean tooLong = message.getContentRaw().length() > 2000; String content = tooLong ? "See content.txt for message (too long)" : message.getContentRaw(); - WebhookMessageBuilder builder = new WebhookMessageBuilder() - .setTTS(message.isTTS()) .setContent(content) .setAllowedMentions(AllowedMentions.none()) .setUsername(message.getMember().getEffectiveName()) @@ -43,7 +40,10 @@ public boolean accept(Message message) { System.out.println("Sending to webhook"); client.send(builder.build()).whenComplete((msg, exception) -> { - exception.printStackTrace(); + if (exception != null) exception.printStackTrace(); + + if (message.getChannel().getIdLong() != 849769323166040124L) return; + User user = message.getAuthor(); user.openPrivateChannel().queue((channel) -> { if (exception != null) { From a1a2714c8963665cf6ab86591dc2aeb90df2b517 Mon Sep 17 00:00:00 2001 From: tk2217 Date: Mon, 7 Aug 2023 14:35:04 -0500 Subject: [PATCH 21/27] fix the stupid thing --- .../java/com/diamondfire/helpbot/bot/HelpBotInstance.java | 4 ++-- src/main/java/com/diamondfire/helpbot/bot/config/Config.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index 909dfa7f..e85db715 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -32,12 +32,12 @@ public class HelpBotInstance { + public static final Gson GSON = new Gson(); + private static final Config config = new Config(); public static final long DF_GUILD = config.getGuild(); public static final long LOG_CHANNEL = config.getLogChannel(); - public static final Gson GSON = new Gson(); - private static JDA jda; private static final TaskRegistry loop = new TaskRegistry(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java index 9f6f8a02..b14941aa 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java +++ b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java @@ -18,7 +18,7 @@ public Config() throws IllegalStateException { try { this.config = HelpBotInstance.GSON.fromJson(Files.readString(ExternalFiles.CONFIG.toPath()), JsonObject.class); } catch (Exception exception) { - throw new IllegalStateException("Config not correctly structured! Please check the readme file for a config template."); + throw new IllegalStateException("Config not correctly structured! Please check the readme file for a config template.", exception); } } From f22a43f8c07e0c38b507a87ba8702e9fd88e7e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AE=28gorg=29?= <81434111+GeorgeRNG@users.noreply.github.com> Date: Fri, 10 Nov 2023 03:27:13 +0000 Subject: [PATCH 22/27] Update ?nbs command (#93) Use DFOnline for the template because derpystuff is no longer working. Replace CodeUtilities with Recode since cu has been replace. --- .../helpbot/bot/command/impl/other/fun/NbsCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java index d35ce74b..90772bb8 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java @@ -26,7 +26,7 @@ public String getName() { @Override public HelpContext getHelpContext() { return new HelpContext() - .description("Generates a Codeutils song function.") + .description("Generates a Recode song function.") .category(CommandCategory.OTHER); } @@ -74,7 +74,7 @@ public void run(CommandEvent event) { .setColor(new Color(70,199,82)) .setTitle("Template Generated!") .setThumbnail(NBS_IMAGE) - .addField("Information","You can copy the command above and give it to yourself in singleplayer. Use toolbars to transfer it to Diamondfire. You will need a [Music Player](https://derpystuff.gitlab.io/code/l?link=7cf5d91c35bbde31c28567d8d8945c40) function to play this song!", false); + .addField("Information","You can copy the command above and give it to yourself in singleplayer. Use toolbars to transfer it to Diamondfire. You will need a [Music Player](https://dfonline.dev/edit/?template=nbs) function to play this song!", false); channel.sendFile(templateOutputfile).setEmbeds(embed.build()).queue(); From 8783ab438b55c2d1334198bd993d364074467bc7 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Tue, 16 Apr 2024 15:07:04 -0400 Subject: [PATCH 23/27] 5.0.0 --- build.gradle.kts | 4 +- .../helpbot/bot/HelpBotInstance.java | 10 +- .../codeblock/AbstractSingleQueryCommand.java | 16 +- .../command/impl/codeblock/CodeCommand.java | 5 +- .../command/impl/codeblock/RawCommand.java | 2 +- .../command/impl/codeblock/TagsCommand.java | 5 +- .../impl/other/dev/FetchDataCommand.java | 164 ++++++++---------- .../impl/other/dumps/ActionDumpCommand.java | 3 +- .../impl/other/dumps/ImageDumpCommand.java | 3 +- .../command/impl/other/fun/NbsCommand.java | 8 +- .../impl/other/fun/SamQuotesCommand.java | 3 +- .../impl/other/mod/ChannelMuteCommand.java | 3 +- .../command/impl/other/mod/PurgeCommand.java | 6 +- .../command/impl/other/mod/UnmuteCommand.java | 1 + .../other/util/AbstractFileListCommand.java | 3 +- .../command/impl/other/util/PollCommand.java | 3 +- .../command/impl/stats/BoostersCommand.java | 6 +- .../stats/graph/AbstractGraphCommand.java | 3 +- .../impl/stats/individualized/CpCommand.java | 5 +- .../stats/individualized/HistoryCommand.java | 11 +- .../stats/individualized/ProfileCommand.java | 2 +- .../impl/stats/metrics/JoinDataCommand.java | 2 +- .../impl/stats/plot/AbstractPlotCommand.java | 3 +- .../impl/stats/plot/PlotVoteGraphCommand.java | 5 +- .../support/AbstractSessionLogCommand.java | 3 +- .../stats/support/DailySessionsCommand.java | 5 +- .../stats/support/ExcusedStaffCommand.java | 2 +- .../support/FindSupporteeNamesCommand.java | 2 +- .../impl/stats/support/StatsGraphCommand.java | 5 +- .../bot/command/reply/ReplyHandler.java | 14 +- .../helpbot/bot/config/Config.java | 4 + .../helpbot/bot/events/ButtonEvent.java | 4 +- .../helpbot/bot/events/CommandEvent.java | 6 +- .../helpbot/bot/events/GuildJoinEvent.java | 4 +- .../helpbot/bot/events/MessageEditEvent.java | 5 +- .../helpbot/bot/events/MessageEvent.java | 9 +- .../helpbot/bot/events/ReadyEvent.java | 7 +- .../helpbot/bot/restart/RestartHandler.java | 2 +- .../df/codeinfo/viewables/BasicReaction.java | 49 ++---- .../viewables/constants/CodeBlockEnum.java | 6 +- .../embeds/CodeActionEmbedBuilder.java | 6 +- .../viewables/embeds/CodeDisplayBuilder.java | 3 +- .../diamondfire/helpbot/df/ranks/Rank.java | 8 +- .../sys/interaction/button/ButtonHandler.java | 13 +- .../sys/message/acceptors/TagAcceptor.java | 2 +- .../sys/message/acceptors/VerifyAcceptor.java | 3 +- .../sys/multiselector/MultiSelector.java | 9 +- .../sys/rolereact/RoleReactListener.java | 20 +-- .../com/diamondfire/helpbot/sys/tag/Tag.java | 1 + .../helpbot/sys/tag/TagHandler.java | 4 + .../helpbot/sys/tasks/LoopingTask.java | 2 +- .../helpbot/sys/tasks/TaskRegistry.java | 2 +- .../sys/tasks/impl/GraphChannelTask.java | 7 +- .../sys/tasks/impl/MuteExpireTask.java | 5 +- .../sys/tasks/impl/SupportUnexcuseTask.java | 2 +- .../util/PlainComponentSerializer.java | 9 +- .../com/diamondfire/helpbot/util/Util.java | 2 +- 57 files changed, 242 insertions(+), 259 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index eb98c31c..6bf3b888 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,14 +17,14 @@ repositories { } dependencies { - implementation("net.dv8tion:JDA:4.4.0_350") { + implementation ("net.dv8tion:JDA:5.0.0-beta.20") { exclude(module = "opus-java") } implementation("club.minnced:discord-webhooks:0.5.8") implementation("ch.qos.logback:logback-classic:1.2.5") implementation("com.google.code.gson:gson:2.8.6") - implementation("com.github.Steveice10:MCProtocolLib:c5e4b66") + implementation ("com.github.Steveice10:MCProtocolLib:c5e4b66") implementation("mysql:mysql-connector-java:5.1.13") implementation("org.codehaus.groovy:groovy-jsr223:3.0.8") } diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index e85db715..9c6bb118 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -51,12 +51,12 @@ public static void initialize() throws LoginException { new SearchCommand(), new TagsCommand(), // others - new CowsayCommand(), + //new CowsayCommand(), new MimicCommand(), - new FetchDataCommand(), + //new FetchDataCommand(), new InfoCommand(), new EvalCommand(), - new GarfieldCommand(), + //new GarfieldCommand(), new HelpCommand(), new RestartCommand(), new ActionDumpCommand(), @@ -79,7 +79,7 @@ public static void initialize() throws LoginException { new VerifyCommand(), // new PollCommand(), - Unused new IdeaCommand(), - new StoreCommand(), + // new StoreCommand(), // new ChannelMuteCommand(), - not finished // statsbot new StatsCommand(), @@ -134,7 +134,7 @@ public static void initialize() throws LoginException { ); JDABuilder builder = JDABuilder.createDefault(config.getToken()) - .enableIntents(GatewayIntent.GUILD_MEMBERS) + .enableIntents(GatewayIntent.GUILD_MEMBERS, GatewayIntent.MESSAGE_CONTENT, GatewayIntent.DIRECT_MESSAGES, GatewayIntent.DIRECT_MESSAGE_REACTIONS) .setStatus(OnlineStatus.ONLINE) .setMemberCachePolicy(MemberCachePolicy.NONE) .setActivity(Activity.watching("for " + getConfig().getPrefix() + "help")) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java index df2e4856..f512dee2 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java @@ -13,7 +13,9 @@ import com.diamondfire.helpbot.sys.interaction.button.ButtonHandler; import com.diamondfire.helpbot.util.*; import net.dv8tion.jda.api.entities.*; -import net.dv8tion.jda.api.interactions.components.Button; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.emoji.Emoji; +import net.dv8tion.jda.api.interactions.components.buttons.Button; import java.util.*; import java.util.function.BiConsumer; @@ -46,7 +48,7 @@ public static void sendMultipleMessage(List actions, TextChannel cha for (Map.Entry reaction : referenceData.getEnum().getEmbedBuilder().generateDupeEmojis(actions).entrySet()) { Button button = Button.secondary(reaction.getKey().toString(), reaction.getValue().getName()); - buttons.add(button.withEmoji(Emoji.fromEmote(reaction.getKey().getEmote()))); + buttons.add(button.withEmoji(Emoji.fromCustom(reaction.getKey().getEmote()))); buttonMap.put(button.getId(), reaction.getValue()); } } else { @@ -54,18 +56,18 @@ public static void sendMultipleMessage(List actions, TextChannel cha long emoji = data.getEnum().getEmoji(); Button button = Button.secondary(String.valueOf(data.getEnum().getEmoji()), data.getName()); - buttons.add(button.withEmoji(Emoji.fromEmote(HelpBotInstance.getJda().getEmoteById(emoji)))); + buttons.add(button.withEmoji(HelpBotInstance.getJda().getEmojiById(emoji))); buttonMap.put(button.getId(), data); } } - channel.sendMessageEmbeds(preset.getEmbed().build()).setActionRows(Util.of(buttons)).queue((message) -> { + channel.sendMessageEmbeds(preset.getEmbed().build()).setActionRow(buttons).queue((message) -> { ButtonHandler.addListener(userToWait, message, (event) -> { message.delete().queue(); // when msg is deleted causes nullpointer when tries to remove reactions! FIX CodeObject object = buttonMap.get(event.getComponentId()); - onChosen.accept(object, message.getTextChannel()); + onChosen.accept(object, message.getChannel().asTextChannel()); }); }); @@ -118,9 +120,9 @@ protected void getData(CommandEvent event, BiConsumer o // If none, proceed. Else we need to special case that. if (sameActions.size() == 1) { - onChosen.accept(sameActions.get(0), event.getChannel()); + onChosen.accept(sameActions.get(0), event.getChannel().asTextChannel()); } else if (sameActions.size() > 1) { - sendMultipleMessage(sameActions, event.getChannel(), event.getMember().getIdLong(), onChosen); + sendMultipleMessage(sameActions, event.getChannel().asTextChannel(), event.getMember().getIdLong(), onChosen); } return; diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java index 04ddd6b3..759baba5 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java @@ -6,7 +6,8 @@ import com.diamondfire.helpbot.df.codeinfo.codedatabase.db.datatypes.CodeObject; import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; import java.util.function.BiConsumer; @@ -21,7 +22,7 @@ public static void sendHelpMessage(T data, TextChannel ch if (customHead == null) { File actionIcon = Util.fetchMinecraftTextureFile(data.getItem().getMaterial().toUpperCase()); builder.setThumbnail("attachment://" + actionIcon.getName()); - channel.sendMessageEmbeds(builder.build()).addFile(actionIcon).queue(); + channel.sendMessageEmbeds(builder.build()).addFiles(FileUpload.fromData(actionIcon)).queue(); } else { builder.setThumbnail(customHead); channel.sendMessageEmbeds(builder.build()).queue(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java index 8f4c5bd7..75d5c4be 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java @@ -6,7 +6,7 @@ import com.diamondfire.helpbot.df.codeinfo.codedatabase.db.datatypes.CodeObject; import com.diamondfire.helpbot.util.StringUtil; import com.google.gson.*; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import java.util.function.BiConsumer; diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java index ae3fc2d4..92f84dee 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java @@ -6,7 +6,8 @@ import com.diamondfire.helpbot.df.codeinfo.codedatabase.db.datatypes.*; import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; import java.util.function.BiConsumer; @@ -52,7 +53,7 @@ private static void sendTagMessage(CodeObject data, TextChannel channel) { if (customHead == null) { File actionIcon = Util.fetchMinecraftTextureFile(data.getItem().getMaterial().toUpperCase()); builder.setThumbnail("attachment://" + actionIcon.getName()); - channel.sendMessageEmbeds(builder.build()).addFile(actionIcon).queue(); + channel.sendMessageEmbeds(builder.build()).addFiles(FileUpload.fromData(actionIcon)).queue(); } else { builder.setThumbnail(customHead); channel.sendMessageEmbeds(builder.build()).queue(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java index 33d1a49a..d868e11e 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java @@ -13,28 +13,15 @@ import com.diamondfire.helpbot.df.codeinfo.codedatabase.db.CodeDatabase; import com.diamondfire.helpbot.sys.externalfile.ExternalFileUtil; import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; -import com.diamondfire.helpbot.util.PlainComponentSerializer; -import com.github.steveice10.mc.auth.exception.request.RequestException; -import com.github.steveice10.mc.auth.service.AuthenticationService; -import com.github.steveice10.mc.protocol.MinecraftProtocol; -import com.github.steveice10.mc.protocol.data.game.MessageType; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; -import com.github.steveice10.packetlib.event.session.PacketReceivedEvent; -import com.github.steveice10.packetlib.event.session.SessionAdapter; -import com.github.steveice10.packetlib.packet.Packet; -import com.github.steveice10.packetlib.tcp.TcpClientSession; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; +import java.io.*; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; +import java.nio.file.*; +import java.util.*; import java.util.concurrent.CompletableFuture; @@ -74,7 +61,7 @@ public Permission getPermission() { public void run(CommandEvent event) { List flags = event.getArgument("flag"); if (flags == null) { - setup(event.getChannel()); + setup(event.getChannel().asTextChannel()); } else { boolean includeColors = false; boolean updateDb = true; @@ -85,7 +72,7 @@ public void run(CommandEvent event) { updateDb = false; } } - setup(event.getChannel(), includeColors, updateDb); + setup(event.getChannel().asTextChannel(), includeColors, updateDb); } } @@ -100,7 +87,6 @@ public void setup(TextChannel channel, boolean includeColors, boolean updateDb) builder.setDescription("Please wait a moment!"); Message sentMessage = channel.sendMessageEmbeds(builder.build()).complete(); - fetchData(sentMessage, includeColors).thenAccept((queue) -> { status(sentMessage, String.format("Data has been received, parsing %s lines...", queue.size())); @@ -134,7 +120,7 @@ public void setup(TextChannel channel, boolean includeColors, boolean updateDb) status(sentMessage, "Finished!"); } else { status(sentMessage, "Finished!"); - sentMessage.getChannel().sendFile(file).queue(); + sentMessage.getChannel().sendFiles(FileUpload.fromData(file)).queue(); } }).exceptionally((exception) -> { error(sentMessage, exception); @@ -145,77 +131,69 @@ public void setup(TextChannel channel, boolean includeColors, boolean updateDb) private CompletableFuture> fetchData(Message message, boolean includeColors) { CompletableFuture> completableFuture = new CompletableFuture<>(); - - AuthenticationService authService = new AuthenticationService(); - authService.setUsername(USERNAME); - authService.setPassword(PASSWORD); - try { - authService.login(); - } catch (RequestException e) { - e.printStackTrace(); - } - - MinecraftProtocol protocol = new MinecraftProtocol(authService.getSelectedProfile(), authService.getAccessToken()); - TcpClientSession client = new TcpClientSession("beta.mcdiamondfire.com", 25565, protocol); - - status(message, "Connecting to DiamondFire..."); - - client.connect(); - - client.addListener(new SessionAdapter() { - - boolean ready = false; - List queue = new ArrayList<>(); - - @Override - public void packetReceived(PacketReceivedEvent event) { - Packet packet = event.getPacket(); - - if (packet instanceof ServerJoinGamePacket) { - status(message, "Joined server!"); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - event.getSession().send(new ClientChatPacket("/chat none")); - event.getSession().send(new ClientChatPacket(includeColors ? "/dumpactioninfo -c" : "/dumpactioninfo")); - } - - if (packet instanceof ServerChatPacket) { - ServerChatPacket chatPacket = event.getPacket(); - String text = PlainComponentSerializer.INSTANCE.serialize(chatPacket.getMessage()); - - if (chatPacket.getType() == MessageType.NOTIFICATION) return; - - if (text.contains("Unknown command!")) { - completableFuture.completeExceptionally(new IllegalStateException("Command not found!")); - } - - if (text.startsWith("{")) { - status(message, "Receiving data..."); - ready = true; - } else if (text.startsWith("}")) { - client.disconnect("HelpBot data collection has concluded. "); - - if (queue.isEmpty()) { - completableFuture.completeExceptionally(new IllegalStateException("Failed to retrieve data")); - return; - } - - queue.add("}"); - completableFuture.complete(queue); - return; - } - - if (ready) { - queue.add(new String(text.getBytes(StandardCharsets.UTF_8))); - } - - } - } - }); - + +// System.out.println("Logging in..."); +// +// +// +// TcpClientSession client = new TcpClientSession("beta.mcdiamondfire.com", 25565, new MinecraftProtocol(MinecraftCodec.CODEC, auth.getSelectedProfile(), auth.getAccessToken())); +// +// status(message, "Connecting to DiamondFire..."); +// +// client.connect(); +// +// client.addListener(new SessionAdapter() { +// +// boolean ready = false; +// List queue = new ArrayList<>(); +// +// @Override +// public void packetReceived(Session session, Packet packet) { +// if (packet instanceof ClientboundLoginPacket) { +// status(message, "Joined server!"); +// try { +// Thread.sleep(2000); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } +// session.send(new ServerboundChatCommandPacket("/chat none", System.currentTimeMillis(), System.currentTimeMillis(), List.of(), 0, new BitSet())); +// session.send(new ServerboundChatCommandPacket(includeColors ? "/dumpactioninfo -c" : "/dumpactioninfo", System.currentTimeMillis(), System.currentTimeMillis(), List.of(), 0, new BitSet())); +// } +// +// if (packet instanceof ClientboundSystemChatPacket chatPacket) { +// String text = PlainComponentSerializer.INSTANCE.serialize(chatPacket.getContent()); +// +// if (chatPacket.isOverlay()) return; +// +// if (text.contains("Unknown command!")) { +// completableFuture.completeExceptionally(new IllegalStateException("Command not found!")); +// } +// +// if (text.startsWith("{")) { +// status(message, "Receiving data..."); +// ready = true; +// } else if (text.startsWith("}")) { +// client.disconnect("HelpBot data collection has concluded. "); +// +// if (queue.isEmpty()) { +// completableFuture.completeExceptionally(new IllegalStateException("Failed to retrieve data")); +// return; +// } +// +// queue.add("}"); +// completableFuture.complete(queue); +// return; +// } +// +// if (ready) { +// queue.add(new String(text.getBytes(StandardCharsets.UTF_8))); +// } +// +// } +// } +// +// }); + return completableFuture; } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ActionDumpCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ActionDumpCommand.java index 1e48bcd0..c617c6f6 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ActionDumpCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ActionDumpCommand.java @@ -6,6 +6,7 @@ import com.diamondfire.helpbot.bot.command.permissions.Permission; import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; +import net.dv8tion.jda.api.utils.FileUpload; public class ActionDumpCommand extends Command { @@ -33,7 +34,7 @@ public Permission getPermission() { @Override public void run(CommandEvent event) { - event.getChannel().sendFile(ExternalFiles.DB).queue(); + event.getChannel().sendFiles(FileUpload.fromData(ExternalFiles.DB)).queue(); } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ImageDumpCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ImageDumpCommand.java index 9500c7b2..045fa9a2 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ImageDumpCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dumps/ImageDumpCommand.java @@ -9,6 +9,7 @@ import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; import com.diamondfire.helpbot.util.IOUtil; +import net.dv8tion.jda.api.utils.FileUpload; import java.io.*; @@ -44,7 +45,7 @@ public void run(CommandEvent event) { event.getReplyHandler().replyA(builder).queue((msg) -> { try { File zip = IOUtil.zipFile(images.toPath(), "images.zip"); - event.getChannel().sendFile(zip).queue((fileMsg) -> { + event.getChannel().sendFiles(FileUpload.fromData(zip)).queue((fileMsg) -> { msg.delete().queue(); }); } catch (IOException e) { diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java index 90772bb8..9688bc54 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java @@ -10,6 +10,8 @@ import com.diamondfire.helpbot.util.nbs.*; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; import java.awt.*; import java.io.*; @@ -42,7 +44,7 @@ public Permission getPermission() { @Override public void run(CommandEvent event) { - TextChannel channel = event.getChannel(); + TextChannel channel = event.getChannel().asTextChannel(); PresetBuilder attachNbsMsg = new PresetBuilder().withPreset(new InformativeReply(InformativeReplyType.ERROR,"You need to attach an nbs file!")); PresetBuilder errorMsg = new PresetBuilder().withPreset(new InformativeReply(InformativeReplyType.ERROR,"Something went wrong while generating!")); @@ -59,7 +61,7 @@ public void run(CommandEvent event) { File file = new File("input.nbs"); - + attachment.downloadToFile(file).thenAccept(downloadedFile -> { try { byte[] b64 = new NBSToTemplate(NBSDecoder.parse(file)).convert(); @@ -77,7 +79,7 @@ public void run(CommandEvent event) { .addField("Information","You can copy the command above and give it to yourself in singleplayer. Use toolbars to transfer it to Diamondfire. You will need a [Music Player](https://dfonline.dev/edit/?template=nbs) function to play this song!", false); - channel.sendFile(templateOutputfile).setEmbeds(embed.build()).queue(); + channel.sendFiles(FileUpload.fromData(templateOutputfile)).setEmbeds(embed.build()).queue(); file.deleteOnExit(); } catch (OutdatedNBSException | IOException e) { e.printStackTrace(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java index 8bfc9488..d21ec2d5 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java @@ -11,6 +11,7 @@ import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.utils.FileUpload; import javax.imageio.ImageIO; import java.awt.*; @@ -53,7 +54,7 @@ public void run(CommandEvent event) { builder.setImage("attachment://quote.png"); builder.setColor(new Color(87, 177, 71)); - event.getChannel().sendMessageEmbeds(builder.build()).addFile(file, "quote.png").queue(); + event.getChannel().sendMessageEmbeds(builder.build()).addFiles(FileUpload.fromData(file)).queue(); } @Override diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java index 96491723..2bc6f32e 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/ChannelMuteCommand.java @@ -15,6 +15,7 @@ import com.diamondfire.helpbot.sys.tasks.impl.MuteExpireTask; import com.diamondfire.helpbot.util.*; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import java.time.*; import java.util.Date; @@ -86,7 +87,7 @@ public void run(CommandEvent event) { Guild punishmentGuild = event.getGuild(); TextChannel textChannel = punishmentGuild.getTextChannelById(channel); punishmentGuild.retrieveMemberById(user).queue((member) -> { - textChannel.putPermissionOverride(member).deny(net.dv8tion.jda.api.Permission.MESSAGE_ADD_REACTION, net.dv8tion.jda.api.Permission.MESSAGE_WRITE).queue(); + textChannel.upsertPermissionOverride(member).deny(net.dv8tion.jda.api.Permission.MESSAGE_ADD_REACTION, net.dv8tion.jda.api.Permission.MESSAGE_SEND).queue(); }); HelpBotInstance.getScheduler().schedule(new MuteExpireTask(user, finalDuration)); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java index 3d8f8064..f439efd8 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java @@ -11,6 +11,8 @@ import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.sys.externalfile.ExternalFileUtil; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; import java.nio.file.*; @@ -55,7 +57,7 @@ public void run(CommandEvent event) { ); event.reply(builder); } else { - TextChannel channel = event.getChannel(); + TextChannel channel = event.getChannel().asTextChannel(); channel.getHistory().retrievePast(messagesToRemove).queue((messages) -> { // Adds the messages to the messageBuilder object StringBuilder stringBuilder = new StringBuilder(); @@ -97,7 +99,7 @@ public void run(CommandEvent event) { ); assert evidenceLog != null; - evidenceLog.sendFile(file).queue(); + evidenceLog.sendFiles(FileUpload.fromData(file)).queue(); } catch (Exception e) { throw new IllegalStateException(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java index 935f2a3e..d5bdb0f0 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/UnmuteCommand.java @@ -12,6 +12,7 @@ import com.diamondfire.helpbot.sys.database.impl.DatabaseQuery; import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import java.sql.ResultSet; diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/AbstractFileListCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/AbstractFileListCommand.java index 9b313df0..7d8172c4 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/AbstractFileListCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/AbstractFileListCommand.java @@ -7,6 +7,7 @@ import com.diamondfire.helpbot.df.codeinfo.codedatabase.db.datatypes.CodeObject; import com.diamondfire.helpbot.sys.externalfile.ExternalFileUtil; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.utils.FileUpload; import java.io.*; import java.util.*; @@ -43,6 +44,6 @@ protected void generate(CommandEvent event, List data) { return; } - event.getChannel().sendMessage("File Generated").addFile(file).queue(); + event.getChannel().sendMessage("File Generated").addFiles(FileUpload.fromData(file)).queue(); } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/PollCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/PollCommand.java index f8965927..7e4bd99d 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/PollCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/PollCommand.java @@ -10,6 +10,7 @@ import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.emoji.Emoji; import java.awt.*; import java.util.*; @@ -104,7 +105,7 @@ public void run(CommandEvent event) { //add reactions Deque nums = Util.getUnicodeNumbers(); for (String option : pollOptions) { - message.addReaction(nums.pop()).queue(); + message.addReaction(Emoji.fromUnicode(nums.pop())).queue(); } }); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/BoostersCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/BoostersCommand.java index a8dd705d..00b5543d 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/BoostersCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/BoostersCommand.java @@ -11,7 +11,7 @@ import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; import com.diamondfire.helpbot.util.*; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.Emote; +import net.dv8tion.jda.api.entities.emoji.Emoji; import java.sql.ResultSet; @@ -66,8 +66,8 @@ public void run(CommandEvent event) { int multiplier = set.getInt("multiplier"); String durationName = FormatUtil.formatMilliTime(set.getLong("end_time") - System.currentTimeMillis()); - Emote emote = event.getJDA().getEmoteById(emotes[Util.clamp(multiplier - 2, 0, emotes.length - 1)]); - embed.addField(String.format("%s %sx booster from %s ", emote.getAsMention(), multiplier, owner), String.format("Ends in: %s", durationName), false); + Emoji emote = event.getJDA().getEmojiById(emotes[Util.clamp(multiplier - 2, 0, emotes.length - 1)]); + embed.addField(String.format("%s %sx booster from %s ", emote.getFormatted(), multiplier, owner), String.format("Ends in: %s", durationName), false); } event.reply(preset); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/graph/AbstractGraphCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/graph/AbstractGraphCommand.java index 2e868836..ebf43de6 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/graph/AbstractGraphCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/graph/AbstractGraphCommand.java @@ -6,6 +6,7 @@ import com.diamondfire.helpbot.bot.command.permissions.Permission; import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.sys.graph.generators.*; +import net.dv8tion.jda.api.utils.FileUpload; public abstract class AbstractGraphCommand extends Command { @@ -27,7 +28,7 @@ public Permission getPermission() { public void run(CommandEvent event) { T context = createContext(event); - event.getChannel().sendFile(getGraphGenerator().createGraph(context)).queue(); + event.getChannel().sendFiles(FileUpload.fromData(getGraphGenerator().createGraph(context))).queue(); } public abstract GraphGenerator getGraphGenerator(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/CpCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/CpCommand.java index 5daab72a..968e282f 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/CpCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/CpCommand.java @@ -15,6 +15,7 @@ import com.diamondfire.helpbot.sys.graph.impl.ChartGraphBuilder; import com.diamondfire.helpbot.util.FormatUtil; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.utils.FileUpload; import java.sql.ResultSet; import java.util.*; @@ -129,9 +130,9 @@ protected void execute(CommandEvent event, Player player) { embed.setImage("attachment://graph.png"); try { event.getReplyHandler().replyA(preset) - .addFile(new ChartGraphBuilder() + .addFiles(FileUpload.fromData(new ChartGraphBuilder() .setGraphName(player.name() + "'s CP Graph") - .createGraph(entries), "graph.png") + .createGraph(entries), "graph.png")) .queue(); } catch (Exception ignored) { event.reply(preset); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java index c9219821..3db5b07b 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/HistoryCommand.java @@ -13,7 +13,8 @@ import com.diamondfire.helpbot.sys.externalfile.ExternalFileUtil; import com.diamondfire.helpbot.util.*; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.requests.restaction.MessageAction; +import net.dv8tion.jda.api.requests.restaction.MessageCreateAction; +import net.dv8tion.jda.api.utils.FileUpload; import java.awt.*; import java.io.*; @@ -65,7 +66,7 @@ protected void execute(CommandEvent event, Player player) { return; } - List msgs = new ArrayList<>(); + List msgs = new ArrayList<>(); List punishments = new PunishmentFetcher() .withUUID(player.uuidString()) .withAll() @@ -150,7 +151,7 @@ protected void execute(CommandEvent event, Player player) { try { File sendFile = ExternalFileUtil.generateFile("history.txt"); Files.writeString(sendFile.toPath(), String.join("\n", punishmentStrings)); - msgs.add(privateChannel.sendFile(sendFile)); + msgs.add(privateChannel.sendFiles(FileUpload.fromData(sendFile))); } catch (IOException exception) { exception.printStackTrace(); } @@ -158,7 +159,7 @@ protected void execute(CommandEvent event, Player player) { } - MessageAction action = msgs.get(0); + MessageCreateAction action = msgs.get(0); msgs.remove(0); action.queue((msg) -> { @@ -170,7 +171,7 @@ protected void execute(CommandEvent event, Player player) { event.reply(successMSG); - for (MessageAction msgAction : msgs) { + for (MessageCreateAction msgAction : msgs) { msgAction.queue(); } }, (error) -> { diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java index 5c79d7e3..c0d9647a 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java @@ -80,7 +80,7 @@ protected void execute(CommandEvent event, Player player) { if (highRank == null) { rankString = ""; } else { - rankString = highRank.getRankEmote().getAsMention(); + rankString = highRank.getRankEmote().getFormatted(); } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinDataCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinDataCommand.java index c1070e35..b86d5f65 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinDataCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinDataCommand.java @@ -170,6 +170,6 @@ public void run(CommandEvent event) { } private String format(Rank rank) { - return rank.getRankEmote().getAsMention() + " "; + return rank.getRankEmote().getFormatted() + " "; } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java index 3122439c..0c7cc316 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java @@ -6,6 +6,7 @@ import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.util.*; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; import java.sql.*; @@ -92,7 +93,7 @@ public void run(CommandEvent event) { } else { File mcItem = Util.fetchMinecraftTextureFile(plotIcon.toUpperCase()); embed.setThumbnail("attachment://" + mcItem.getName()); - event.getReplyHandler().replyA(preset).addFile(mcItem).queue(); + event.getReplyHandler().replyA(preset).addFiles(FileUpload.fromData(mcItem)).queue(); } } catch (SQLException | IllegalStateException e) { diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotVoteGraphCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotVoteGraphCommand.java index 05f85ffb..6431a8a8 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotVoteGraphCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/PlotVoteGraphCommand.java @@ -12,6 +12,7 @@ import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; import com.diamondfire.helpbot.sys.graph.graphable.*; import com.diamondfire.helpbot.sys.graph.impl.ChartGraphBuilder; +import net.dv8tion.jda.api.utils.FileUpload; import java.sql.ResultSet; import java.util.*; @@ -70,9 +71,9 @@ public void run(CommandEvent event) { entries.add(new StringEntry(set.getString("time"))); } - event.getChannel().sendFile(new ChartGraphBuilder() + event.getChannel().sendFiles(FileUpload.fromData(new ChartGraphBuilder() .setGraphName(String.format("Votes on plot %s this month", plotID)) - .createGraphFromCollection(entries)).queue(); + .createGraphFromCollection(entries))).queue(); }); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/AbstractSessionLogCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/AbstractSessionLogCommand.java index e8eeeff7..7e9e14c4 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/AbstractSessionLogCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/AbstractSessionLogCommand.java @@ -6,6 +6,7 @@ import com.diamondfire.helpbot.bot.events.CommandEvent; import com.diamondfire.helpbot.sys.externalfile.ExternalFileUtil; import com.diamondfire.helpbot.util.FormatUtil; +import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; import java.nio.file.*; @@ -37,7 +38,7 @@ protected void execute(CommandEvent event, Player player) { File file = ExternalFileUtil.generateFile("session_log.txt"); Files.writeString(file.toPath(), builder.toString(), StandardOpenOption.WRITE); - event.getChannel().sendFile(file).queue(); + event.getChannel().sendFiles(FileUpload.fromData(file)).queue(); } catch (Exception e) { throw new IllegalStateException(); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/DailySessionsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/DailySessionsCommand.java index b5517384..57311236 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/DailySessionsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/DailySessionsCommand.java @@ -12,6 +12,7 @@ import com.diamondfire.helpbot.sys.graph.graphable.*; import com.diamondfire.helpbot.sys.graph.impl.ChartGraphBuilder; import com.diamondfire.helpbot.util.DateUtil; +import net.dv8tion.jda.api.utils.FileUpload; import java.sql.ResultSet; import java.time.Instant; @@ -100,9 +101,9 @@ public void run(CommandEvent event) { } } - event.getChannel().sendFile(new ChartGraphBuilder() + event.getChannel().sendFiles(FileUpload.fromData(new ChartGraphBuilder() .setGraphName(String.format("Total sessions on %s", date)) - .createGraph(dates)).queue(); + .createGraph(dates))).queue(); }); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java index a2279402..4412f595 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/ExcusedStaffCommand.java @@ -83,7 +83,7 @@ public void run(CommandEvent event) { names.add(name); } - embed.addField(rank.getRankEmote().getAsMention() + " " + name, String.format("Until: ``%s``\nReason: %s (<@%s>)", FormatUtil.formatDate(date), reason, excused_by), false); + embed.addField(rank.getRankEmote().getFormatted() + " " + name, String.format("Until: ``%s``\nReason: %s (<@%s>)", FormatUtil.formatDate(date), reason, excused_by), false); } event.reply(builder); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/FindSupporteeNamesCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/FindSupporteeNamesCommand.java index e40fdea9..fe316f24 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/FindSupporteeNamesCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/FindSupporteeNamesCommand.java @@ -131,7 +131,7 @@ protected void execute(CommandEvent event, Player player) { builder.getEmbed().addField("", "Player hasn't been helped by anybody!", false); } - msg.editMessageEmbeds(builder.getEmbed().build()).override(true).queue(); + msg.editMessageEmbeds(builder.getEmbed().build()).setReplace(true).queue(); }); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/StatsGraphCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/StatsGraphCommand.java index 2a64900b..882bb556 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/StatsGraphCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/support/StatsGraphCommand.java @@ -9,6 +9,7 @@ import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; import com.diamondfire.helpbot.sys.graph.graphable.*; import com.diamondfire.helpbot.sys.graph.impl.ChartGraphBuilder; +import net.dv8tion.jda.api.utils.FileUpload; import java.sql.ResultSet; import java.util.*; @@ -64,9 +65,9 @@ SELECT dates.dt date, COALESCE(t.total, 0) AS total FROM all_dates dates LEFT JO dates.put(new DateEntry(set.getDate("date")), set.getInt("total")); } - event.getChannel().sendFile(new ChartGraphBuilder() + event.getChannel().sendFiles(FileUpload.fromData(new ChartGraphBuilder() .setGraphName(String.format("%s's sessions", player)) - .createGraph(dates)).queue(); + .createGraph(dates))).queue(); }); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java b/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java index b47f9fff..5f7e2184 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java @@ -2,7 +2,11 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; -import net.dv8tion.jda.api.requests.restaction.MessageAction; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; +import net.dv8tion.jda.api.requests.RestAction; +import net.dv8tion.jda.api.requests.restaction.MessageCreateAction; +import net.dv8tion.jda.api.utils.messages.MessageRequest; public class ReplyHandler { @@ -36,19 +40,19 @@ public void reply(EmbedBuilder builder, MessageChannel channel) { embedReply(builder, channel).queue(); } - public MessageAction replyA(PresetBuilder preset) { + public MessageCreateAction replyA(PresetBuilder preset) { return replyA(preset, getChannel()); } - public MessageAction replyA(PresetBuilder preset, MessageChannel channel) { + public MessageCreateAction replyA(PresetBuilder preset, MessageChannel channel) { return embedReply(preset.getEmbed(), channel); } - public MessageAction embedReply(EmbedBuilder embed, MessageChannel channel) { + public MessageCreateAction embedReply(EmbedBuilder embed, MessageChannel channel) { return channel.sendMessageEmbeds(embed.build()); } - public MessageAction textReply(String msg, MessageChannel channel) { + public MessageCreateAction textReply(String msg, MessageChannel channel) { return channel.sendMessage(msg); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java index b14941aa..59fc8666 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java +++ b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java @@ -95,6 +95,10 @@ public Map getPermissionRoleMap() { return HelpBotInstance.GSON.fromJson(config.get("permission_roles"), new TypeToken>(){}.getType()); } + public long getPermission(String role) { + return this.config.get("permission_roles").getAsJsonObject().get(role).getAsLong(); + } + private long getPropertyLong(String property) { return config.get(property).getAsLong(); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/ButtonEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/ButtonEvent.java index f3155897..908833d8 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/ButtonEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/ButtonEvent.java @@ -1,14 +1,14 @@ package com.diamondfire.helpbot.bot.events; import com.diamondfire.helpbot.sys.interaction.button.ButtonHandler; -import net.dv8tion.jda.api.events.interaction.ButtonClickEvent; +import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import org.jetbrains.annotations.NotNull; public class ButtonEvent extends ListenerAdapter { @Override - public void onButtonClick(@NotNull ButtonClickEvent event) { + public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { ButtonHandler.handleEvent(event); } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java index 4a5bcac7..6a980cef 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java @@ -8,14 +8,14 @@ import com.diamondfire.helpbot.bot.command.impl.Command; import com.diamondfire.helpbot.bot.command.reply.*; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import java.util.*; -public class CommandEvent extends GuildMessageReceivedEvent { +public class CommandEvent extends MessageReceivedEvent { private Command command; - private final ReplyHandler replyHandler = new ReplyHandler(getChannel()); + private final ReplyHandler replyHandler = new ReplyHandler(getChannel().asTextChannel()); //TODO Cleanup and refactor this. // I'd like to see stuff like replying be put into it's whole own section and refactored as well. private ParsedArgumentSet parsedArgumentSet = null; diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/GuildJoinEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/GuildJoinEvent.java index 0080879d..71e23123 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/GuildJoinEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/GuildJoinEvent.java @@ -7,12 +7,10 @@ import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; -import javax.annotation.Nonnull; - public class GuildJoinEvent extends ListenerAdapter { @Override - public void onGuildMemberJoin(@Nonnull GuildMemberJoinEvent event) { + public void onGuildMemberJoin(GuildMemberJoinEvent event) { if (event.getGuild().getIdLong() == HelpBotInstance.DF_GUILD) { Member member = event.getMember(); Util.updateMember(member); diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEditEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEditEvent.java index 395e48b9..1c6c5e8d 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEditEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEditEvent.java @@ -5,9 +5,6 @@ import net.dv8tion.jda.api.events.message.MessageUpdateEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; - -import javax.annotation.Nonnull; - public class MessageEditEvent extends ListenerAdapter { private static final MessageAcceptor[] acceptors = { @@ -15,7 +12,7 @@ public class MessageEditEvent extends ListenerAdapter { }; @Override - public void onMessageUpdate(@Nonnull MessageUpdateEvent event) { + public void onMessageUpdate(MessageUpdateEvent event) { Message message = event.getMessage(); for (MessageAcceptor acceptor : acceptors) { if (acceptor.accept(message)) { diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java index 072929ea..a516b34d 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java @@ -2,10 +2,9 @@ import com.diamondfire.helpbot.sys.message.acceptors.*; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent; +import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class MessageEvent extends ListenerAdapter { @@ -18,14 +17,12 @@ public class MessageEvent extends ListenerAdapter { }; @Override - public void onGuildMessageReceived(@Nonnull GuildMessageReceivedEvent event) { + public void onMessageReceived(@NotNull MessageReceivedEvent event) { Message message = event.getMessage(); for (MessageAcceptor acceptor : acceptors) { if (acceptor.accept(message)) { break; } } - } - } diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/ReadyEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/ReadyEvent.java index 8f356ba4..56ac7f28 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/ReadyEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/ReadyEvent.java @@ -4,15 +4,12 @@ import com.diamondfire.helpbot.bot.restart.RestartHandler; import com.diamondfire.helpbot.sys.rolereact.RoleReactListener; import net.dv8tion.jda.api.hooks.ListenerAdapter; - -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; public class ReadyEvent extends ListenerAdapter { @Override - public void onReady(@Nonnull net.dv8tion.jda.api.events.ReadyEvent event) { - super.onReady(event); - + public void onReady(@NotNull net.dv8tion.jda.api.events.session.ReadyEvent event) { RestartHandler.recover(event.getJDA()); HelpBotInstance.getScheduler().initialize(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/restart/RestartHandler.java b/src/main/java/com/diamondfire/helpbot/bot/restart/RestartHandler.java index 2e1015d9..e68ec8c6 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/restart/RestartHandler.java +++ b/src/main/java/com/diamondfire/helpbot/bot/restart/RestartHandler.java @@ -36,7 +36,7 @@ public static void recover(JDA jda) { builder.setTitle("Restart Successful!"); builder.setDescription("Restarted in " + FormatUtil.formatMilliTime(System.currentTimeMillis() - Long.parseLong(restartMSG[2]))); - jda.getTextChannelById(restartMSG[1]).editMessageEmbedsById(restartMSG[0], builder.build()).override(true).queue(); + jda.getTextChannelById(restartMSG[1]).editMessageEmbedsById(restartMSG[0], builder.build()).setReplace(true).queue(); restart.delete(); } catch (IOException | ArrayIndexOutOfBoundsException ignored) { } diff --git a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/BasicReaction.java b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/BasicReaction.java index 74c2b571..ab48cacf 100644 --- a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/BasicReaction.java +++ b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/BasicReaction.java @@ -2,66 +2,41 @@ import com.diamondfire.helpbot.bot.HelpBotInstance; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.emoji.*; import net.dv8tion.jda.api.requests.RestAction; public class BasicReaction { - final boolean isUnicode; - String unicode; - long id; + private final Emoji emoji; - public BasicReaction(String unicode) { - isUnicode = true; - this.unicode = unicode; + public BasicReaction(Emoji emoji) { + this.emoji = emoji; } - public BasicReaction(long emoteID) { - isUnicode = false; - this.id = emoteID; - } public String getUnicode() { - if (!isUnicode) { + if (emoji.getType() != Emoji.Type.UNICODE) { throw new IllegalStateException("Emoji is not a unicode char!"); } - return unicode; + return emoji.getName(); } - public Emote getEmote() { - if (isUnicode) { - throw new IllegalStateException("Emoji is a unicode char!"); + public CustomEmoji getEmote() { + if (emoji.getType() != Emoji.Type.CUSTOM) { + throw new IllegalStateException("Emoji is not a unicode char!"); } - return HelpBotInstance.getJda().getEmoteById(id); + return (CustomEmoji) emoji; } public RestAction react(Message message) { - if (isUnicode) { - return message.addReaction(getUnicode()); - } - - return message.addReaction(getEmote()); + return message.addReaction(emoji); } @Override public String toString() { - if (isUnicode) { - return getUnicode(); - } - - return getEmote().getAsMention(); - } - - public boolean equalToReaction(MessageReaction.ReactionEmote reaction) { - // if reaction is emoji yet this isn't unicode error is thrown. - if (reaction.isEmoji() != isUnicode) { - return false; - } - - if (reaction.isEmoji()) return getUnicode().equals(reaction.getEmoji()); - if (!reaction.isEmoji()) return getEmote().getIdLong() == reaction.getIdLong(); - return false; + return this.emoji.getFormatted(); } } diff --git a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/constants/CodeBlockEnum.java b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/constants/CodeBlockEnum.java index 71fbde28..aed8acf0 100644 --- a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/constants/CodeBlockEnum.java +++ b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/constants/CodeBlockEnum.java @@ -1,7 +1,7 @@ package com.diamondfire.helpbot.df.codeinfo.viewables.constants; import com.diamondfire.helpbot.bot.HelpBotInstance; -import net.dv8tion.jda.api.entities.Emote; +import net.dv8tion.jda.api.entities.emoji.*; import java.awt.*; import java.util.Map; @@ -53,7 +53,7 @@ public String getID() { } - public Emote getEmoji() { - return HelpBotInstance.getJda().getEmotesByName(getID(), true).get(0); + public CustomEmoji getEmoji() { + return HelpBotInstance.getJda().getEmojisByName(getID(), true).get(0); } } diff --git a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java index 60bf79ff..02e791f2 100644 --- a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java +++ b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeActionEmbedBuilder.java @@ -5,7 +5,7 @@ import com.diamondfire.helpbot.df.codeinfo.viewables.BasicReaction; import com.diamondfire.helpbot.util.StringUtil; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.Emote; +import net.dv8tion.jda.api.entities.emoji.*; import java.util.*; @@ -13,7 +13,7 @@ public class CodeActionEmbedBuilder implements IconEmbedBuilder { @Override public EmbedBuilder buildDataEmbed(ActionData data) { - Emote emote = data.getCodeBlockData().getCodeblockEnum().getEmoji(); + CustomEmoji emote = data.getCodeBlockData().getCodeblockEnum().getEmoji(); EmbedBuilder builder = new EmbedBuilder() .setColor(data.getCodeBlockData().getCodeblockEnum().getColor()) .setAuthor(StringUtil.smartCaps(data.getCodeblockName()), null, emote.getImageUrl()); @@ -34,7 +34,7 @@ public LinkedHashMap generateDupeEmojis(List dataHashed = new LinkedHashMap<>(); for (CodeObject data : dataArrayList) { ActionData actionData = (ActionData) data; - dataHashed.put(new BasicReaction(actionData.getCodeBlockData().getCodeblockEnum().getEmoji().getIdLong()), data); + dataHashed.put(new BasicReaction(actionData.getCodeBlockData().getCodeblockEnum().getEmoji()), data); } return dataHashed; diff --git a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeDisplayBuilder.java b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeDisplayBuilder.java index 601585b5..164261a4 100644 --- a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeDisplayBuilder.java +++ b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/CodeDisplayBuilder.java @@ -5,6 +5,7 @@ import com.diamondfire.helpbot.df.codeinfo.viewables.BasicReaction; import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.emoji.Emoji; import java.util.*; @@ -57,7 +58,7 @@ default LinkedHashMap generateDupeEmojis(List nums = Util.getUnicodeNumbers(); LinkedHashMap dataHashed = new LinkedHashMap<>(); for (CodeObject data : dataArrayList) { - dataHashed.put(new BasicReaction(nums.pop()), data); + dataHashed.put(new BasicReaction(Emoji.fromUnicode(nums.pop())), data); } return dataHashed; diff --git a/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java b/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java index 64c0658d..fa6b48a3 100644 --- a/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java +++ b/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java @@ -1,7 +1,7 @@ package com.diamondfire.helpbot.df.ranks; import com.diamondfire.helpbot.bot.HelpBotInstance; -import net.dv8tion.jda.api.entities.Emote; +import net.dv8tion.jda.api.entities.emoji.Emoji; public enum Rank { // Ranks @@ -31,13 +31,13 @@ public enum Rank { private final String rankName; private final int number; private final RankBranch category; - private final Emote emote; + private final Emoji emote; Rank(String rankName, int number, RankBranch category, String emote) { this.rankName = rankName; this.number = number; this.category = category; - this.emote = HelpBotInstance.getJda().getGuildById(615846886414483465L).getEmotesByName(emote, false).get(0); + this.emote = HelpBotInstance.getJda().getGuildById(615846886414483465L).getEmojiById(emote); } public String getRankName() { @@ -62,7 +62,7 @@ public static Rank fromBranch(RankBranch branch, int rankNum) { return null; } - public Emote getRankEmote() { + public Emoji getRankEmote() { return emote; } } diff --git a/src/main/java/com/diamondfire/helpbot/sys/interaction/button/ButtonHandler.java b/src/main/java/com/diamondfire/helpbot/sys/interaction/button/ButtonHandler.java index 82d7dc01..26f0657e 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/interaction/button/ButtonHandler.java +++ b/src/main/java/com/diamondfire/helpbot/sys/interaction/button/ButtonHandler.java @@ -5,7 +5,8 @@ import com.diamondfire.helpbot.bot.command.reply.feature.informative.*; import com.diamondfire.helpbot.util.TemporaryRunnableStorage; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.events.interaction.ButtonClickEvent; +import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; +import net.dv8tion.jda.api.utils.messages.MessageEditData; import java.util.Collections; import java.util.function.Consumer; @@ -14,20 +15,20 @@ public class ButtonHandler { private static final TemporaryRunnableStorage BUTTON_CONSUMERS = new TemporaryRunnableStorage<>(); - public static void addListener(long user, Message message, Consumer consumer, boolean persistent) { + public static void addListener(long user, Message message, Consumer consumer, boolean persistent) { BUTTON_CONSUMERS.put(message.getIdLong(), new ButtonListener(user, consumer), () -> { HelpBotInstance.getJda() .getTextChannelById(message.getChannel().getIdLong()).retrieveMessageById(message.getIdLong()) - .flatMap((msg) -> persistent, (msg) -> message.editMessage(message).setActionRows(Collections.emptyList())) + .flatMap((msg) -> persistent, (msg) -> message.editMessage(MessageEditData.fromMessage(message)).setActionRow(Collections.emptyList())) .queue(); }, persistent); } - public static void addListener(long user, Message message, Consumer consumer) { + public static void addListener(long user, Message message, Consumer consumer) { addListener(user, message, consumer, false); } - public static void handleEvent(ButtonClickEvent event) { + public static void handleEvent(ButtonInteractionEvent event) { ButtonListener listener = BUTTON_CONSUMERS.get(event.getMessageIdLong()); if (listener != null) { if (event.getUser().getIdLong() != listener.user) { @@ -45,7 +46,7 @@ public static void handleEvent(ButtonClickEvent event) { } } - private record ButtonListener(long user, Consumer consumer) { + private record ButtonListener(long user, Consumer consumer) { } diff --git a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java index f1658aa2..05cdc074 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java +++ b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java @@ -21,7 +21,7 @@ public boolean accept(Message message) { try { // Get Tag and send response TagHandler.getTag(parsedText) - .sendResponse(message.getTextChannel(), message.getAuthor()); + .sendResponse(message.getChannel().asTextChannel(), message.getAuthor()); } catch (TagDoesNotExistException | IOException ignored) { return false; diff --git a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/VerifyAcceptor.java b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/VerifyAcceptor.java index b1493bf9..fbdc1f2f 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/VerifyAcceptor.java +++ b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/VerifyAcceptor.java @@ -7,6 +7,7 @@ import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.emoji.Emoji; import java.sql.ResultSet; @@ -32,7 +33,7 @@ public boolean accept(Message message) { .compile() .run((result) -> { if (result.isEmpty()) { - message.addReaction("❌").queue(); + message.addReaction(Emoji.fromUnicode("❌")).queue(); } else { ResultSet set = result.getResult(); Member author = message.getMember(); diff --git a/src/main/java/com/diamondfire/helpbot/sys/multiselector/MultiSelector.java b/src/main/java/com/diamondfire/helpbot/sys/multiselector/MultiSelector.java index 890de253..96f6eb60 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/multiselector/MultiSelector.java +++ b/src/main/java/com/diamondfire/helpbot/sys/multiselector/MultiSelector.java @@ -3,8 +3,9 @@ import com.diamondfire.helpbot.sys.interaction.button.ButtonHandler; import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.*; -import net.dv8tion.jda.api.entities.Emoji; -import net.dv8tion.jda.api.interactions.components.Button; +import net.dv8tion.jda.api.entities.emoji.Emoji; +import net.dv8tion.jda.api.interactions.components.ItemComponent; +import net.dv8tion.jda.api.interactions.components.buttons.Button; import java.util.*; @@ -42,10 +43,10 @@ public void send(JDA jda) { buttons.add(button); } - jda.getTextChannelById(channel).sendMessageEmbeds(pages[0].getPage().build()).setActionRows(Util.of(buttons)).queue((message) -> { + jda.getTextChannelById(channel).sendMessageEmbeds(pages[0].getPage().build()).setActionRow(buttons).queue((message) -> { ButtonHandler.addListener(user, message, event -> { event.deferEdit().queue(); - message.editMessageEmbeds(pageMap.get(event.getComponentId()).getPage().build()).setActionRows(message.getActionRows()).queue(); + message.editMessageEmbeds(pageMap.get(event.getComponentId()).getPage().build()).setComponents(message.getComponents()).queue(); }, true); }); } diff --git a/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java b/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java index 6d00930e..a80494ad 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java +++ b/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java @@ -3,10 +3,11 @@ import com.diamondfire.helpbot.bot.HelpBotInstance; import com.diamondfire.helpbot.util.*; import net.dv8tion.jda.api.entities.*; -import net.dv8tion.jda.api.events.interaction.ButtonClickEvent; +import net.dv8tion.jda.api.entities.emoji.Emoji; +import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; -import net.dv8tion.jda.api.interactions.components.Button; -import net.dv8tion.jda.api.requests.restaction.interactions.ReplyAction; +import net.dv8tion.jda.api.interactions.components.buttons.*; +import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -34,13 +35,13 @@ public RoleReactListener() { roleMap.put(button.getId(), role.getRoleID()); } - msg.editMessage("__**Reaction Roles**__ \nClick to add/remove roles from yourself").setActionRows(Util.of(buttons)).queue(); + msg.editMessage("__**Reaction Roles**__ \nClick to add/remove roles from yourself").setActionRow(buttons).queue(); }); } @Override - public void onButtonClick(@NotNull ButtonClickEvent event) { + public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { if (!roleMap.containsKey(event.getComponentId())) { return; } @@ -49,16 +50,15 @@ public void onButtonClick(@NotNull ButtonClickEvent event) { Guild guild = event.getGuild(); Role guildRole = event.getGuild().getRoleById(role); Member member = event.getMember(); - - ReplyAction action = event.deferReply(true); + + ReplyCallbackAction action = event.deferReply(true); if (member.getRoles().contains(guildRole)) { action.setContent("Removed the " + guildRole.getAsMention() + " role from you!"); - guild.removeRoleFromMember(member.getIdLong(), guildRole).reason("User unsubscribed to announcement!").queue(); + guild.removeRoleFromMember(UserSnowflake.fromId(member.getIdLong()), guildRole).reason("User unsubscribed to announcement!").queue(); } else { action.setContent("Added the " + guildRole.getAsMention() + " role to you!"); - guild.addRoleToMember(member.getIdLong(), guildRole).reason("User subscribed to announcement!").queue(); + guild.addRoleToMember(UserSnowflake.fromId(member.getIdLong()), guildRole).reason("User subscribed to announcement!").queue(); } action.queue(); } - } diff --git a/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java b/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java index 681d5d1d..4f47f71d 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import org.jetbrains.annotations.NotNull; import java.io.Serializable; diff --git a/src/main/java/com/diamondfire/helpbot/sys/tag/TagHandler.java b/src/main/java/com/diamondfire/helpbot/sys/tag/TagHandler.java index 5784dd9f..e565cbab 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tag/TagHandler.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tag/TagHandler.java @@ -82,6 +82,10 @@ public static void deleteTag(Tag tag) throws TagDoesNotExistException, IOExcepti } public static @NotNull Tag getTag(String activator) throws TagDoesNotExistException, IOException { + if (TAGS.isEmpty()) { + throw new TagDoesNotExistException("Empty"); + } + Tag tag = TAGS.stream() .filter(t -> t.getActivator().equals(activator)) .collect(Collectors.toList()) diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/LoopingTask.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/LoopingTask.java index 0c7a98ba..fb83401a 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/LoopingTask.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/LoopingTask.java @@ -1,7 +1,7 @@ package com.diamondfire.helpbot.sys.tasks; import com.diamondfire.helpbot.bot.HelpBotInstance; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; public interface LoopingTask extends Runnable { diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java index ed290d18..324c0f1c 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java @@ -13,7 +13,7 @@ public void initialize() { if (HelpBotInstance.getConfig().isDevBot()) return; register( - new CodeDatabaseTask(), + //new CodeDatabaseTask(), new GraphChannelTask(), //new RefreshCreditsTask(), new SupporterClassTask(), diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/GraphChannelTask.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/GraphChannelTask.java index b43d1a34..caf74175 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/GraphChannelTask.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/GraphChannelTask.java @@ -4,7 +4,8 @@ import com.diamondfire.helpbot.sys.graph.generators.*; import com.diamondfire.helpbot.sys.graph.generators.context.TimeGraphContext; import com.diamondfire.helpbot.sys.tasks.MidnightTask; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.utils.FileUpload; public class GraphChannelTask implements MidnightTask { @@ -14,7 +15,7 @@ public void run() { channel.getHistoryFromBeginning(50).queue(messageHistory -> channel.purgeMessages(messageHistory.getRetrievedHistory())); TimeGraphContext context = new TimeGraphContext(TimeMode.DAILY, 14); - channel.sendFile(GraphGenerators.NEW_PLAYERS.createGraph(context)).queue(); - channel.sendFile(GraphGenerators.UNIQUE_JOINS.createGraph(context)).queue(); + channel.sendFiles(FileUpload.fromData(GraphGenerators.NEW_PLAYERS.createGraph(context))).queue(); + channel.sendFiles(FileUpload.fromData(GraphGenerators.UNIQUE_JOINS.createGraph(context))).queue(); } } diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java index bd71dbaa..41213885 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/MuteExpireTask.java @@ -6,6 +6,7 @@ import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; import com.diamondfire.helpbot.sys.tasks.OneTimeTask; import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import java.sql.*; import java.time.*; @@ -29,8 +30,8 @@ public long getExecution() { @Override public void run() { Guild guild = HelpBotInstance.getJda().getGuildById(HelpBotInstance.DF_GUILD); - - guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue(); + + guild.removeRoleFromMember(UserSnowflake.fromId(member), guild.getRoleById(MuteCommand.ROLE_ID)).queue(); new DatabaseQuery() .query(new BasicQuery("UPDATE owen.muted_members SET handled = true WHERE member = ?", (statement) -> statement.setLong(1, member))) diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java index dd59273c..7893929d 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/SupportUnexcuseTask.java @@ -10,7 +10,7 @@ import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; import com.diamondfire.helpbot.sys.tasks.OneTimeTask; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.TextChannel; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;; import java.sql.ResultSet; import java.time.*; diff --git a/src/main/java/com/diamondfire/helpbot/util/PlainComponentSerializer.java b/src/main/java/com/diamondfire/helpbot/util/PlainComponentSerializer.java index 3bc2586a..b15db61e 100644 --- a/src/main/java/com/diamondfire/helpbot/util/PlainComponentSerializer.java +++ b/src/main/java/com/diamondfire/helpbot/util/PlainComponentSerializer.java @@ -2,7 +2,6 @@ import net.kyori.adventure.text.*; import net.kyori.adventure.text.serializer.ComponentSerializer; -import org.checkerframework.checker.nullness.qual.NonNull; import java.util.function.Function; @@ -18,23 +17,23 @@ public PlainComponentSerializer() { this(component -> ""); } - public PlainComponentSerializer(final @NonNull Function translatable) { + public PlainComponentSerializer(final Function translatable) { this.translatable = translatable; } @Override - public @NonNull TextComponent deserialize(final @NonNull String input) { + public TextComponent deserialize(final String input) { return Component.text(input); } @Override - public @NonNull String serialize(final @NonNull Component component) { + public String serialize(final Component component) { final StringBuilder sb = new StringBuilder(); this.serialize(sb, component); return sb.toString(); } - public void serialize(final @NonNull StringBuilder sb, final @NonNull Component component) { + public void serialize(final StringBuilder sb, final Component component) { if (component instanceof TextComponent) { sb.append(((TextComponent) component).content()); } else if (component instanceof TranslatableComponent) { diff --git a/src/main/java/com/diamondfire/helpbot/util/Util.java b/src/main/java/com/diamondfire/helpbot/util/Util.java index 0d2ee005..f8a3a559 100644 --- a/src/main/java/com/diamondfire/helpbot/util/Util.java +++ b/src/main/java/com/diamondfire/helpbot/util/Util.java @@ -15,7 +15,7 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; 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 java.io.BufferedReader; import java.io.File; From 59cf40b06d4cdb1c253ee0073bb419705608a1e6 Mon Sep 17 00:00:00 2001 From: Reasonless <28310208+Reasonlesss@users.noreply.github.com> Date: Fri, 3 May 2024 02:57:21 +0100 Subject: [PATCH 24/27] Only allow specific bot devs to run ?eval as mods can just give themselves the role. (#101) --- .../command/impl/other/dev/EvalCommand.java | 19 +++++++++++++++++++ .../bot/command/permissions/Permission.java | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/EvalCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/EvalCommand.java index 3c4ec9b5..b7354f10 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/EvalCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/EvalCommand.java @@ -13,12 +13,20 @@ import javax.script.*; import java.awt.*; import java.io.*; +import java.util.*; import java.util.List; import java.util.stream.Collectors; public class EvalCommand extends Command { + // Moderators can just give themselves bot dev role apparently... + private static final Set BOT_DEVELOPERS = Set.of( + 511653192942092289L, // Reasonless + 248855041803288576L, // Tomoli75 + 945012492030074900L // Owen1212055 + ); + private static final List IMPORTS = List.of( "net.dv8tion.jda.core", "net.dv8tion.jda.core.managers", @@ -68,6 +76,17 @@ public void run(CommandEvent event) { return; } + boolean hasManual = BOT_DEVELOPERS.contains(event.getMember().getIdLong()); + boolean hasRole = Permission.DEVELOPER.hasPermission(event.getMember()); + if (!hasManual && !hasRole) { + EmbedBuilder builder = new EmbedBuilder(); + builder.setTitle("No."); + builder.setColor(Color.red); + + event.getChannel().sendMessageEmbeds(builder.build()).queue(); + return; + } + ScriptEngine engine = new ScriptEngineManager().getEngineByName("groovy"); engine.put("jda", event.getJDA()); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java index 701b5487..6d0914c0 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/permissions/Permission.java @@ -8,8 +8,8 @@ import java.util.stream.Collectors; public enum Permission { - BOT_DEVELOPER(999), DEVELOPER(999), + BOT_DEVELOPER(998), // Ask DragonSlasher, not me. ADMINISTRATOR(666), MODERATION(5), From 9f4435cdbd33ab7cf6546abd1478ce87bdeb5862 Mon Sep 17 00:00:00 2001 From: Reasonless <28310208+Reasonlesss@users.noreply.github.com> Date: Sat, 15 Jun 2024 00:14:23 +0100 Subject: [PATCH 25/27] VIP Role Star (#100) * Add VIP role logic * Formatting * Remove testing code * Add VIP role logic * Formatting * Remove testing code * Owen's requested changes * Create roles on start up * Only create stars for roles without icons * Changes and small bug fixes * Fix bugs + make messages work in threads --- .gitignore | 1 - .../java/com/diamondfire/helpbot/HelpBot.java | 3 - .../disable/DisableCommandHandler.java | 3 + .../codeblock/AbstractSingleQueryCommand.java | 13 +- .../command/impl/codeblock/CodeCommand.java | 5 +- .../command/impl/codeblock/RawCommand.java | 5 +- .../command/impl/codeblock/TagsCommand.java | 5 +- .../impl/other/dev/FetchDataCommand.java | 9 +- .../command/impl/other/fun/NbsCommand.java | 3 +- .../command/impl/other/mod/PurgeCommand.java | 3 +- .../bot/command/reply/ReplyHandler.java | 7 +- .../helpbot/bot/events/CommandEvent.java | 2 +- .../diamondfire/helpbot/df/ranks/Rank.java | 2 +- .../sys/externalfile/ExternalFiles.java | 6 + .../sys/message/acceptors/TagAcceptor.java | 2 +- .../sys/rolereact/RoleReactListener.java | 4 +- .../com/diamondfire/helpbot/sys/tag/Tag.java | 3 +- .../helpbot/sys/tasks/TaskRegistry.java | 3 +- .../helpbot/sys/tasks/impl/VIPStarTask.java | 51 ++++++++ .../helpbot/sys/vip/VIPRoleHandler.java | 114 ++++++++++++++++++ .../diamondfire/helpbot/util/StarUtil.java | 40 ++++++ src/main/resources/star.png | Bin 0 -> 5336 bytes 22 files changed, 253 insertions(+), 31 deletions(-) create mode 100644 src/main/java/com/diamondfire/helpbot/sys/tasks/impl/VIPStarTask.java create mode 100644 src/main/java/com/diamondfire/helpbot/sys/vip/VIPRoleHandler.java create mode 100644 src/main/java/com/diamondfire/helpbot/util/StarUtil.java create mode 100644 src/main/resources/star.png diff --git a/.gitignore b/.gitignore index 1d24e1fe..d20abb20 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ build /src/main/resources/swear_filter.json *.json -*.png *.txt diff --git a/src/main/java/com/diamondfire/helpbot/HelpBot.java b/src/main/java/com/diamondfire/helpbot/HelpBot.java index bd820c9e..95b064b0 100644 --- a/src/main/java/com/diamondfire/helpbot/HelpBot.java +++ b/src/main/java/com/diamondfire/helpbot/HelpBot.java @@ -1,13 +1,10 @@ package com.diamondfire.helpbot; - import com.diamondfire.helpbot.bot.HelpBotInstance; import com.diamondfire.helpbot.df.codeinfo.codedatabase.changelog.CodeDifferenceHandler; import com.diamondfire.helpbot.df.codeinfo.codedatabase.db.CodeDatabase; -import com.diamondfire.helpbot.sys.tag.TagHandler; import javax.security.auth.login.LoginException; -import java.io.IOException; public class HelpBot { diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/disable/DisableCommandHandler.java b/src/main/java/com/diamondfire/helpbot/bot/command/disable/DisableCommandHandler.java index 14c925e1..a72af1b5 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/disable/DisableCommandHandler.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/disable/DisableCommandHandler.java @@ -48,6 +48,9 @@ public void enable(Command command) { } public void disable(Command command) { + if (command == null) { + return; + } // Prevents tricky people using eval. if (command instanceof CommandDisableFlag) { return; diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java index f512dee2..f2dccdf8 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/AbstractSingleQueryCommand.java @@ -14,6 +14,7 @@ import com.diamondfire.helpbot.util.*; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.interactions.components.buttons.Button; @@ -24,7 +25,7 @@ public abstract class AbstractSingleQueryCommand extends Command { - public static void sendMultipleMessage(List actions, TextChannel channel, long userToWait, BiConsumer onChosen) { + public static void sendMultipleMessage(List actions, GuildMessageChannel channel, long userToWait, BiConsumer onChosen) { // This here is to determine if all the duplicate types are the same. If not, we need to make sure that we filter those out first.. CodeObject referenceData = actions.get(0); Class classReference = referenceData.getClass(); @@ -67,7 +68,7 @@ public static void sendMultipleMessage(List actions, TextChannel cha // when msg is deleted causes nullpointer when tries to remove reactions! FIX CodeObject object = buttonMap.get(event.getComponentId()); - onChosen.accept(object, message.getChannel().asTextChannel()); + onChosen.accept(object, message.getChannel().asGuildMessageChannel()); }); }); @@ -85,9 +86,9 @@ public void run(CommandEvent event) { getData(event, onDataReceived()); } - public abstract BiConsumer onDataReceived(); + public abstract BiConsumer onDataReceived(); - protected void getData(CommandEvent event, BiConsumer onChosen) { + protected void getData(CommandEvent event, BiConsumer onChosen) { String name = event.getArgument("name"); PresetBuilder preset = new PresetBuilder(); @@ -120,9 +121,9 @@ protected void getData(CommandEvent event, BiConsumer o // If none, proceed. Else we need to special case that. if (sameActions.size() == 1) { - onChosen.accept(sameActions.get(0), event.getChannel().asTextChannel()); + onChosen.accept(sameActions.get(0), event.getChannel().asGuildMessageChannel()); } else if (sameActions.size() > 1) { - sendMultipleMessage(sameActions, event.getChannel().asTextChannel(), event.getMember().getIdLong(), onChosen); + sendMultipleMessage(sameActions, event.getChannel().asGuildMessageChannel(), event.getMember().getIdLong(), onChosen); } return; diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java index 759baba5..cde99c68 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/CodeCommand.java @@ -7,6 +7,7 @@ import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; @@ -15,7 +16,7 @@ public class CodeCommand extends AbstractSingleQueryCommand { - public static void sendHelpMessage(T data, TextChannel channel) { + public static void sendHelpMessage(T data, GuildMessageChannel channel) { EmbedBuilder builder = data.getEnum().getEmbedBuilder().generateEmbed(data); String customHead = data.getItem().getHead(); @@ -57,7 +58,7 @@ public void run(CommandEvent event) { } @Override - public BiConsumer onDataReceived() { + public BiConsumer onDataReceived() { return CodeCommand::sendHelpMessage; } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java index 75d5c4be..2be76c85 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/RawCommand.java @@ -7,13 +7,14 @@ import com.diamondfire.helpbot.util.StringUtil; import com.google.gson.*; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import java.util.function.BiConsumer; public class RawCommand extends AbstractSingleQueryCommand { - private static void sendRawMessage(CodeObject data, TextChannel channel) { + private static void sendRawMessage(CodeObject data, GuildMessageChannel channel) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(data.getJson()); @@ -55,7 +56,7 @@ public void run(CommandEvent event) { } @Override - public BiConsumer onDataReceived() { + public BiConsumer onDataReceived() { return RawCommand::sendRawMessage; } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java index 92f84dee..d7a84a72 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/codeblock/TagsCommand.java @@ -7,6 +7,7 @@ import com.diamondfire.helpbot.util.Util; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; @@ -15,7 +16,7 @@ public class TagsCommand extends AbstractSingleQueryCommand { - private static void sendTagMessage(CodeObject data, TextChannel channel) { + private static void sendTagMessage(CodeObject data, GuildMessageChannel channel) { EmbedBuilder builder = new EmbedBuilder(); ActionData actionData; @@ -92,7 +93,7 @@ public void run(CommandEvent event) { } @Override - public BiConsumer onDataReceived() { + public BiConsumer onDataReceived() { return TagsCommand::sendTagMessage; } } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java index d868e11e..779c3bb6 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/dev/FetchDataCommand.java @@ -16,6 +16,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.utils.FileUpload; import java.io.*; @@ -61,7 +62,7 @@ public Permission getPermission() { public void run(CommandEvent event) { List flags = event.getArgument("flag"); if (flags == null) { - setup(event.getChannel().asTextChannel()); + setup(event.getChannel().asGuildMessageChannel()); } else { boolean includeColors = false; boolean updateDb = true; @@ -72,15 +73,15 @@ public void run(CommandEvent event) { updateDb = false; } } - setup(event.getChannel().asTextChannel(), includeColors, updateDb); + setup(event.getChannel().asGuildMessageChannel(), includeColors, updateDb); } } - public void setup(TextChannel channel) { + public void setup(GuildMessageChannel channel) { setup(channel, false, true); } - public void setup(TextChannel channel, boolean includeColors, boolean updateDb) { + public void setup(GuildMessageChannel channel, boolean includeColors, boolean updateDb) { EmbedBuilder builder = new EmbedBuilder(); builder.setTitle("Fetching Code Database..."); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java index 9688bc54..9ba93905 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/NbsCommand.java @@ -11,6 +11,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.utils.FileUpload; import java.awt.*; @@ -44,7 +45,7 @@ public Permission getPermission() { @Override public void run(CommandEvent event) { - TextChannel channel = event.getChannel().asTextChannel(); + GuildMessageChannel channel = event.getChannel().asGuildMessageChannel(); PresetBuilder attachNbsMsg = new PresetBuilder().withPreset(new InformativeReply(InformativeReplyType.ERROR,"You need to attach an nbs file!")); PresetBuilder errorMsg = new PresetBuilder().withPreset(new InformativeReply(InformativeReplyType.ERROR,"Something went wrong while generating!")); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java index f439efd8..cbdc99db 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/mod/PurgeCommand.java @@ -12,6 +12,7 @@ import com.diamondfire.helpbot.sys.externalfile.ExternalFileUtil; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.utils.FileUpload; import java.io.File; @@ -57,7 +58,7 @@ public void run(CommandEvent event) { ); event.reply(builder); } else { - TextChannel channel = event.getChannel().asTextChannel(); + GuildMessageChannel channel = event.getChannel().asGuildMessageChannel(); channel.getHistory().retrievePast(messagesToRemove).queue((messages) -> { // Adds the messages to the messageBuilder object StringBuilder stringBuilder = new StringBuilder(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java b/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java index 5f7e2184..426fc6d1 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/reply/ReplyHandler.java @@ -3,6 +3,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.requests.RestAction; import net.dv8tion.jda.api.requests.restaction.MessageCreateAction; @@ -10,13 +11,13 @@ public class ReplyHandler { - private final TextChannel channel; + private final GuildMessageChannel channel; - public ReplyHandler(TextChannel channel) { + public ReplyHandler(GuildMessageChannel channel) { this.channel = channel; } - public TextChannel getChannel() { + public GuildMessageChannel getChannel() { return channel; } diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java index 6a980cef..c5220bd9 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/CommandEvent.java @@ -15,7 +15,7 @@ public class CommandEvent extends MessageReceivedEvent { private Command command; - private final ReplyHandler replyHandler = new ReplyHandler(getChannel().asTextChannel()); + private final ReplyHandler replyHandler = new ReplyHandler(getChannel().asGuildMessageChannel()); //TODO Cleanup and refactor this. // I'd like to see stuff like replying be put into it's whole own section and refactored as well. private ParsedArgumentSet parsedArgumentSet = null; diff --git a/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java b/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java index fa6b48a3..771f5121 100644 --- a/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java +++ b/src/main/java/com/diamondfire/helpbot/df/ranks/Rank.java @@ -37,7 +37,7 @@ public enum Rank { this.rankName = rankName; this.number = number; this.category = category; - this.emote = HelpBotInstance.getJda().getGuildById(615846886414483465L).getEmojiById(emote); + this.emote = HelpBotInstance.getJda().getGuildById(615846886414483465L).getEmojisByName(emote, false).get(0); } public String getRankName() { diff --git a/src/main/java/com/diamondfire/helpbot/sys/externalfile/ExternalFiles.java b/src/main/java/com/diamondfire/helpbot/sys/externalfile/ExternalFiles.java index 6d85802b..2becc72c 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/externalfile/ExternalFiles.java +++ b/src/main/java/com/diamondfire/helpbot/sys/externalfile/ExternalFiles.java @@ -61,6 +61,12 @@ public interface ExternalFiles { .setFileType("json") .buildFile(); + File VIP_ROLES = new ExternalFileBuilder() + .isDirectory(false) + .setName("vip_roles") + .setFileType("json") + .buildFile(); + File SAM_QUOTES = new ExternalFileBuilder() .isDirectory(false) .setName("samquotes") diff --git a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java index 05cdc074..0f8a4700 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java +++ b/src/main/java/com/diamondfire/helpbot/sys/message/acceptors/TagAcceptor.java @@ -21,7 +21,7 @@ public boolean accept(Message message) { try { // Get Tag and send response TagHandler.getTag(parsedText) - .sendResponse(message.getChannel().asTextChannel(), message.getAuthor()); + .sendResponse(message.getChannel().asGuildMessageChannel(), message.getAuthor()); } catch (TagDoesNotExistException | IOException ignored) { return false; diff --git a/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java b/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java index a80494ad..af5bd748 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java +++ b/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java @@ -35,7 +35,9 @@ public RoleReactListener() { roleMap.put(button.getId(), role.getRoleID()); } - msg.editMessage("__**Reaction Roles**__ \nClick to add/remove roles from yourself").setActionRow(buttons).queue(); + msg.editMessage("__**Reaction Roles**__ \nClick to add/remove roles from yourself") + .setComponents(Util.of(buttons)) + .queue(); }); } diff --git a/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java b/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java index 4f47f71d..b8c89ed1 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tag/Tag.java @@ -5,6 +5,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import org.jetbrains.annotations.NotNull; import java.io.Serializable; @@ -66,7 +67,7 @@ public void setImage(String image) { this.image = image; } - public void sendResponse(TextChannel channel, @NotNull User requester) { + public void sendResponse(GuildMessageChannel channel, @NotNull User requester) { EmbedBuilder embed = new EmbedBuilder() .setTitle(getTitle()) diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java index 324c0f1c..2959bede 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/TaskRegistry.java @@ -17,7 +17,8 @@ public void initialize() { new GraphChannelTask(), //new RefreshCreditsTask(), new SupporterClassTask(), - new NameUpdateTask() + new NameUpdateTask(), + new VIPStarTask() ); SupportUnexcuseTask.prepare(); diff --git a/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/VIPStarTask.java b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/VIPStarTask.java new file mode 100644 index 00000000..93207b64 --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/sys/tasks/impl/VIPStarTask.java @@ -0,0 +1,51 @@ +package com.diamondfire.helpbot.sys.tasks.impl; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.sys.tasks.LoopingTask; +import com.diamondfire.helpbot.sys.vip.VIPRoleHandler; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.Role; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +public class VIPStarTask implements LoopingTask { + + @Override + public long getInitialStart() { + return 0; + } + + @Override + public long getNextLoop() { + return TimeUnit.MINUTES.toMillis(30L); + } + + @Override + public void run() { + Guild guild = HelpBotInstance.getJda().getGuildById(HelpBotInstance.DF_GUILD); + Set vipIds = VIPRoleHandler.retrieveVIPs(); + + guild.loadMembers((member) -> { + Role role = VIPRoleHandler.getRole(member.getColorRaw()); + if (role == null) { + return; + } + if (vipIds.contains(member.getIdLong()) && !member.getRoles().contains(role)) { + guild.addRoleToMember(member, role) + .reason("User has VIP Pass") + .queue(); + return; + } + if (!vipIds.contains(member.getIdLong()) && member.getRoles().contains(role)) { + guild.removeRoleFromMember(member, role) + .reason("User's VIP Pass has expired") + .queue(); + } + }); + + } + +} diff --git a/src/main/java/com/diamondfire/helpbot/sys/vip/VIPRoleHandler.java b/src/main/java/com/diamondfire/helpbot/sys/vip/VIPRoleHandler.java new file mode 100644 index 00000000..2743407f --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/sys/vip/VIPRoleHandler.java @@ -0,0 +1,114 @@ +package com.diamondfire.helpbot.sys.vip; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.sys.database.impl.DatabaseQuery; +import com.diamondfire.helpbot.sys.database.impl.queries.BasicQuery; +import com.diamondfire.helpbot.sys.externalfile.ExternalFiles; +import com.diamondfire.helpbot.util.StarUtil; +import com.google.gson.*; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Icon; +import net.dv8tion.jda.api.entities.Role; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.StandardOpenOption; +import java.sql.ResultSet; +import java.util.*; + +public class VIPRoleHandler { + + private static final String ROLE_NAME = "VIP"; + + private static final File FILE = ExternalFiles.VIP_ROLES; + private static final Map COLOR_ROLE_MAP = new HashMap<>(); + + static { + try { + cacheJson(); + + Guild guild = HelpBotInstance.getJda().getGuildById(HelpBotInstance.DF_GUILD); + for (Role role : guild.getRoles()) { + int color = role.getColorRaw(); + if (color == Role.DEFAULT_COLOR_RAW) { + continue; + } + if (role.getIcon() != null) { + continue; + } + if (!COLOR_ROLE_MAP.containsKey(color)) { + // Create the coloured star and register it on discord. + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write(StarUtil.create(new Color(color)), "png", baos); + baos.flush(); + role = guild.createRole() + .setName(ROLE_NAME) + .setIcon(Icon.from(baos.toByteArray())) + .setPermissions(0L) + .complete(); + COLOR_ROLE_MAP.put(color, role.getIdLong()); + } + } + save(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void cacheJson() throws IOException { + String content = new String(Files.readAllBytes(FILE.toPath())); + + if (content.isEmpty()) { + content = "{}"; + } + + JsonObject obj = JsonParser.parseString(content).getAsJsonObject(); + + for (String key : obj.keySet()) { + long roleId = obj.get(key).getAsLong(); + COLOR_ROLE_MAP.put(Integer.parseInt(key), roleId); + } + } + + public static void save() throws IOException { + JsonObject json = new JsonObject(); + + for (int color : COLOR_ROLE_MAP.keySet()) { + json.addProperty(String.valueOf(color), COLOR_ROLE_MAP.get(color)); + } + + FILE.delete(); + FILE.createNewFile(); + Files.write(FILE.toPath(), json.toString().getBytes(), StandardOpenOption.WRITE); + } + + public static Set retrieveVIPs() { + Set vips = new HashSet<>(); + new DatabaseQuery() + .query(new BasicQuery("SELECT linked_accounts.discord_id FROM linked_accounts, hypercube.ranks " + + "WHERE linked_accounts.player_uuid = ranks.uuid AND ranks.vip = 1")) + .compile() + .run(result -> { + ResultSet set = result.getResult(); + while (set.next()) { + vips.add(set.getLong("discord_id")); + } + }); + return vips; + } + + public static Role getRole(int color) { + if (color == Role.DEFAULT_COLOR_RAW) { + return null; + } + Guild guild = HelpBotInstance.getJda().getGuildById(HelpBotInstance.DF_GUILD); + if (!COLOR_ROLE_MAP.containsKey(color)) { + return null; + } + return guild.getRoleById(COLOR_ROLE_MAP.get(color)); + } + + +} diff --git a/src/main/java/com/diamondfire/helpbot/util/StarUtil.java b/src/main/java/com/diamondfire/helpbot/util/StarUtil.java new file mode 100644 index 00000000..f268069f --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/util/StarUtil.java @@ -0,0 +1,40 @@ +package com.diamondfire.helpbot.util; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; + +/** + * Creates a coloured star to be used as a role icon. + */ +public class StarUtil { + + private static final BufferedImage STAR; + private static final int SIZE = 64; + + static { + // Load the star from the resources. + InputStream inputStream = StarUtil.class.getResourceAsStream("/star.png"); + + try { + assert inputStream != null; + STAR = ImageIO.read(inputStream); + }catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static BufferedImage create(Color color) { + BufferedImage bufferedImage = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = bufferedImage.createGraphics(); + + g2d.drawImage(STAR, 0, 0, null); + g2d.setComposite(AlphaComposite.SrcAtop); + g2d.setColor(color); + g2d.fillRect(0, 0, SIZE, SIZE); + g2d.dispose(); + return bufferedImage; + } + +} diff --git a/src/main/resources/star.png b/src/main/resources/star.png new file mode 100644 index 0000000000000000000000000000000000000000..10d5e0f04741f87ba5dc43f34b3dbd3fd45f4c12 GIT binary patch literal 5336 zcmeHKYg7~07EU0FJOo8SL@XhQ2$CmxkrELDLWEdeA|Toh$qWqSMKVA@1(fTP)@Q9% z(Tf#|BG77!B1nN^MJp|66-5E@`ruI!r4=oL^h`j++pcw&Yu)~Hvi6)a`|SOlv%j;? z&diperGAr5Y)uFR!ep_(PY7ri;xcI>xEG>{Z3F^wIvgQJ#9~*%B%m_|3KD^c+W;Ys z>l+Xa35Gzo3y3+2pqy3YhKX23q_h$m%$)GIhjMfguc*kyB7Cj_fCv1Q7;Z2!s`2{8fu9$t)U^L38H$K_ndxw{ir?s&fQ*OQl2IoakfQjv2P@;bISo?CPx>%KYSByu`L+2&ff_>Y%G zmrOdSKgZ{vk9u~GZq`w{2QK-=&f79OV*Ml{D}LS)15;)cCnPWr^}2J%K6#LGMyAws3N13Siff1 zDpkT|$6VE{vNB~t-+SsahGxR9T@D^0nO{}~5!xC$4``~Zsg2(}=x@4N*JZfla7hTS zy2gPKp7$_mdrC@5e}C`3@C>iK#hUVR^HZOKJl3IM5mx0wngCEYo)XRzoj78O`fwW&%B(ovOKM;u}V!w1$% zHK-axRZ23B3B{Bk#>ubNr%+2IWAIAtC<}lOx(-s)nKTAnp`efV&|<#H0AzGQ zf9s(QOI5@45Ll~9(nw+7WLSwgj)#y*$Nbev8o53knUoI8VFfVNf?1hwOo^Y%F%O)A zSX80bdjYcFu*6X0HCb=04Ij~mGkzh!eGK;v>sPVsje(U!BJfd3lknwD*)gyOHHHr%RChMho$HS9*$jj|4oa-lVvte_<4^#ch5{Uf z=gx`YNSRb9hA*SC-MKK8&)~XKWo(GgfMskCE(00|@qq>fSqaI?;!@ds7Ka*xKps>XKZflg<-;tg2dsyZNd=2l8U+Nl6IDR5FkP*T)eqo=3%rBG zLJEtR<(v0(`~PBI9Cd_YwPpkviK>{Yd% z&tM7|BMZRcBq|w-r2a2!{P2)Hfj!uAe^iU9G^u*k$cYMt6Gxs#9_6V1D3QtfLm_~q zBOz#^WLTzOC%_sRlEy*GSQu1~(R6*KNB<@jIPOv@1L8=j92ntH*$AIW6g-5% zk--SUWpmy{*QyXK1=7IYv4BUw6-ZD0{}_3mexqF8v`&eG@m&CfQ5kG1lmFj@(MJQO z<2B<|#GdrOaN?;q7*}L~--r$rFHj5VW5sZkGra8lgV*R@{DU(9=y#L66~FK3dPmn= zG4NK#@3QM1U2ny}TN%I0uKycdCa*uIU?q49N&z2BFz5Ih@ToO1Ccw{!FpU3lD+_i5 zjj`H4QcEDv9C0D)^1YIQ(g+hve2qFumewTOvi>e-pqh#KMqnb90)Hzf{NFFJ}9Bwv=Bv|=!+wCVG?PWJ9zGY(Y;&FuoY2S}p!4_hIuw&s(icq@%`s zbGx*n-V$B1r|f2vK{A0(e1HDc9?~kaef^GPBzd|H+H#jSfp{b`%KJ0xMteiMsKv-U z*}$!>nV(;-Jn^EynU55#tBj2F4!3TceAdkF=%W6G7m`o!zWa@+Qt`B`_)(m*scy2( zG4FJeu5u-kaZsS_u~~k-)Q}h(?a>zZw8r8nubbSyQSkN63T=?{zG4v{SZ6P|8M3tm}uMOxBc)ZvyIKt0vip1m_pSYT~?=f^`K zs#8;lJWZU6Z?xhGDV-n z&*Q`y%RerXgx~qi?Q3d2yVcEF&A;2?t@^#09ngNpuD>nzx`5aKHb2qYzJ6V1)+dh* zZ6RXqPRj<{6<_qW7~6bOFMqGO{W9W^+qBnSTfMSf)UIi1D9+5Ry=PpyqH>jJ{k`Bh zu3x#Ge*}AMoFDw`=tk0or@Ae>XAxHyu6epLr1#kMtJC%j>Pn|1U0-x+|CH6yt-GCx z&Z6e~jF~l;B9juV6w1lXC!RmjlocGR-<=sSb$|HxIRi)19Ne6)H7d9EMsMam_{=z) zexLI^FTL>RaK^KW?$zBd)0*NQGG81iuCV&-2YKg?K635{Ll2l6zPv`i8f$Cy)!rTp z$L@~q+PZ;3?)nqaZtX`HwOzVt+IUXJli9=WI^Q9ufwNzwM{l2yC$PFnI%|8mImIP^ vUr~_--*Eam`;aBWSGQl1lqxF9Rt}?TT literal 0 HcmV?d00001 From bfe400f8c512c2c25950df72e9b8fec988ea99aa Mon Sep 17 00:00:00 2001 From: Reasonless <28310208+Reasonlesss@users.noreply.github.com> Date: Wed, 3 Jul 2024 21:19:46 +0100 Subject: [PATCH 26/27] changes (#102) --- build.gradle.kts | 3 +++ .../impl/other/fun/SamQuotesCommand.java | 2 +- .../impl/stats/individualized/PlotsCommand.java | 2 +- .../stats/individualized/ProfileCommand.java | 2 +- .../impl/stats/metrics/JoinsCommand.java | 2 +- .../impl/stats/plot/AbstractPlotCommand.java | 2 +- .../impl/stats/top/ActivePlotsCommand.java | 2 +- .../impl/stats/top/TrendingPlotsCommand.java | 2 +- .../helpbot/bot/events/MessageEvent.java | 2 +- .../viewables/embeds/IconEmbedBuilder.java | 3 ++- .../sys/rolereact/RoleReactListener.java | 1 + .../diamondfire/helpbot/util/StringUtil.java | 17 +++++++++++++++++ 12 files changed, 31 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6bf3b888..de420f34 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,6 +27,9 @@ dependencies { implementation ("com.github.Steveice10:MCProtocolLib:c5e4b66") implementation("mysql:mysql-connector-java:5.1.13") implementation("org.codehaus.groovy:groovy-jsr223:3.0.8") + implementation("net.kyori:adventure-api:4.16.0") + implementation("net.kyori:adventure-text-minimessage:4.16.0") + implementation("dev.vankka:mcdiscordreserializer:4.3.0") } tasks { diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java index d21ec2d5..8fa27032 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/fun/SamQuotesCommand.java @@ -54,7 +54,7 @@ public void run(CommandEvent event) { builder.setImage("attachment://quote.png"); builder.setColor(new Color(87, 177, 71)); - event.getChannel().sendMessageEmbeds(builder.build()).addFiles(FileUpload.fromData(file)).queue(); + event.getChannel().sendMessageEmbeds(builder.build()).addFiles(FileUpload.fromData(file).setName("quote.png")).queue(); } @Override diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/PlotsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/PlotsCommand.java index d7e4a7c6..42c599f8 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/PlotsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/PlotsCommand.java @@ -69,7 +69,7 @@ protected void execute(CommandEvent event, Player player) { "Votes: " + plot.getInt("votes"), "Players: " + plot.getInt("player_count") }; - embed.addField(StringUtil.display(plot.getString("name")) + + embed.addField(StringUtil.fromMiniMessage(plot.getString("name")) + String.format(" **(%s)**", plot.getInt("id")), String.join("\n", stats), false); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java index c0d9647a..1ad39852 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/individualized/ProfileCommand.java @@ -86,7 +86,7 @@ protected void execute(CommandEvent event, Player player) { embed.addField("Name", rankString + " " + StringUtil.display(playerName), false); embed.addField("UUID", playerUUID, false); - embed.addField("Whois", StringUtil.display(whois.isEmpty() ? "N/A" : whois).replace("\\n", "\n"), false); + embed.addField("Whois", StringUtil.fromMiniMessage(whois.isEmpty() ? "N/A" : whois).replace("\\n", "\n"), false); embed.addField("Pronouns", StringUtil.display(pronouns == null || pronouns.isEmpty() ? "N/A" : pronouns), false); Rank[] ranks = RankUtil.getRanks(set); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinsCommand.java index 3dce51b8..21aa02d3 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/metrics/JoinsCommand.java @@ -36,7 +36,7 @@ public void run(CommandEvent event) { // gets the total amount of players that have joined before new DatabaseQuery() - .query(new BasicQuery("SELECT COUNT(*) AS count FROM players")) + .query(new BasicQuery("SELECT COUNT(uuid) AS count FROM ranks")) .compile() .run((result) -> { String count = FormatUtil.formatNumber(result.getResult().getInt("count")); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java index 0c7cc316..4ded2fe1 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/plot/AbstractPlotCommand.java @@ -53,7 +53,7 @@ public void run(CommandEvent event) { PlotSize size = PlotSize.fromID(resultTablePlot.getInt("plotsize") - 1); embed.setTitle(String.format("Plot Information (%s)", plotID)); - embed.addField("Name", StringUtil.display(resultTablePlot.getString("name")), true); + embed.addField("Name", StringUtil.fromMiniMessage(resultTablePlot.getString("name")), true); embed.addField("Owner", resultTablePlot.getString("owner_name"), true); embed.addField("Node", "Node " + resultTablePlot.getInt("node"), true); embed.addField("Plot Size", StringUtil.smartCaps(size.name()), true); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/ActivePlotsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/ActivePlotsCommand.java index ff9a1bf1..dd74fd4e 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/ActivePlotsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/ActivePlotsCommand.java @@ -55,7 +55,7 @@ public void run(CommandEvent event) { .compile() .run((result) -> { for (ResultSet set : result) { - embed.addField(StringUtil.display(set.getString("name")) + + embed.addField(StringUtil.fromMiniMessage(set.getString("name")) + String.format(" **(%s)**", set.getInt("id")), "Players: " + set.getInt("player_count"), false); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/TrendingPlotsCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/TrendingPlotsCommand.java index 3e25f3ee..7f9cfa25 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/TrendingPlotsCommand.java +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/stats/top/TrendingPlotsCommand.java @@ -59,7 +59,7 @@ public void run(CommandEvent event) { stats.add("Players: " + count); } - embed.addField(StringUtil.display(set.getString("name")) + + embed.addField(StringUtil.fromMiniMessage(set.getString("name")) + String.format(" **(%s)**", set.getInt("id")), String.join("\n", stats), false); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java index a516b34d..bf29e880 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java +++ b/src/main/java/com/diamondfire/helpbot/bot/events/MessageEvent.java @@ -2,7 +2,7 @@ import com.diamondfire.helpbot.sys.message.acceptors.*; import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.events.message.*; import net.dv8tion.jda.api.hooks.ListenerAdapter; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java index 4f8bbfc4..18352881 100644 --- a/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java +++ b/src/main/java/com/diamondfire/helpbot/df/codeinfo/viewables/embeds/IconEmbedBuilder.java @@ -53,7 +53,8 @@ default void generateInfo(T data, EmbedBuilder builder) { enum ParamConverter { ANY_TYPE("Any Value"), - TEXT("Text"), + TEXT("String"), + COMPONENT("Styled Text"), NUMBER("Number"), LOCATION("Location"), VECTOR("Vector"), diff --git a/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java b/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java index af5bd748..d67c2e7d 100644 --- a/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java +++ b/src/main/java/com/diamondfire/helpbot/sys/rolereact/RoleReactListener.java @@ -6,6 +6,7 @@ import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; +import net.dv8tion.jda.api.interactions.components.ItemComponent; import net.dv8tion.jda.api.interactions.components.buttons.*; import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/diamondfire/helpbot/util/StringUtil.java b/src/main/java/com/diamondfire/helpbot/util/StringUtil.java index 3eae5405..390299db 100644 --- a/src/main/java/com/diamondfire/helpbot/util/StringUtil.java +++ b/src/main/java/com/diamondfire/helpbot/util/StringUtil.java @@ -1,11 +1,16 @@ package com.diamondfire.helpbot.util; import net.dv8tion.jda.api.utils.MarkdownSanitizer; +import net.kyori.adventure.text.*; +import net.kyori.adventure.text.minimessage.MiniMessage; import java.util.*; +import java.util.regex.*; public class StringUtil { + private static final Pattern UNICODE_PATTERN = Pattern.compile("§u([\\da-f]{5})"); + public static String listView(String pointer, boolean sanitize, Iterable array) { String view = listView(pointer, array); return sanitize ? StringUtil.display(view) : view; @@ -84,6 +89,18 @@ public static String display(String string) { return MarkdownSanitizer.escape(StringUtil.stripColorCodes(string)); } + public static String fromMiniMessage(String expression) { + Matcher matcher = UNICODE_PATTERN.matcher(expression); + StringBuilder builder = new StringBuilder(); + while (matcher.find()) { + int value = Integer.parseInt(matcher.group(1), 16); + matcher.appendReplacement(builder, Matcher.quoteReplacement(String.valueOf(Character.toChars(value)))); + } + matcher.appendTail(builder); + Component component = MiniMessage.miniMessage().deserialize(StringUtil.stripColorCodes(builder.toString())); + return MarkdownSanitizer.escape(PlainComponentSerializer.INSTANCE.serialize(component)); + } + public static String sCheck(String text, int number) { return number == 1 ? text : text + "s"; } From 8d2df10ad9c0fe31cd5b8be6ef7330bbb1950a65 Mon Sep 17 00:00:00 2001 From: RedVortex <58099979+RedVortexDev@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:42:47 -0800 Subject: [PATCH 27/27] Help Improvements (#104) * feat: in help forum, ?solve & lock closed posts * fix: duplicate behavior from ?solved * style: remove var usage & set event.getChannel()s to a variable --- .../helpbot/bot/HelpBotInstance.java | 3 +- .../impl/other/util/SolvedCommand.java | 84 +++++++++++++++++++ .../helpbot/bot/config/Config.java | 8 ++ .../bot/events/ChannelArchiveEvent.java | 24 ++++++ .../bot/events/ChannelCreatedEvent.java | 36 ++++++++ .../bot/events/PostAppliedTagsEvent.java | 41 +++++++++ 6 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/SolvedCommand.java create mode 100644 src/main/java/com/diamondfire/helpbot/bot/events/ChannelArchiveEvent.java create mode 100644 src/main/java/com/diamondfire/helpbot/bot/events/ChannelCreatedEvent.java create mode 100644 src/main/java/com/diamondfire/helpbot/bot/events/PostAppliedTagsEvent.java diff --git a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java index 9c6bb118..ff329378 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java +++ b/src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java @@ -53,6 +53,7 @@ public static void initialize() throws LoginException { // others //new CowsayCommand(), new MimicCommand(), + new SolvedCommand(), //new FetchDataCommand(), new InfoCommand(), new EvalCommand(), @@ -140,7 +141,7 @@ public static void initialize() throws LoginException { .setActivity(Activity.watching("for " + getConfig().getPrefix() + "help")) .setGatewayEncoding(GatewayEncoding.ETF) .disableCache(CacheFlag.ACTIVITY, CacheFlag.VOICE_STATE, CacheFlag.CLIENT_STATUS) - .addEventListeners(new MessageEvent(), new ReadyEvent(), new GuildJoinEvent(), new ButtonEvent(), new MessageEditEvent()); + .addEventListeners(new MessageEvent(), new ReadyEvent(), new GuildJoinEvent(), new ButtonEvent(), new MessageEditEvent(), new PostAppliedTagsEvent(), new ChannelCreatedEvent(), new ChannelArchiveEvent()); jda = builder.build(); CommandHandler.getInstance().initialize(); diff --git a/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/SolvedCommand.java b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/SolvedCommand.java new file mode 100644 index 00000000..3bf2d991 --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/bot/command/impl/other/util/SolvedCommand.java @@ -0,0 +1,84 @@ +package com.diamondfire.helpbot.bot.command.impl.other.util; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.bot.command.argument.ArgumentSet; +import com.diamondfire.helpbot.bot.command.help.*; +import com.diamondfire.helpbot.bot.command.impl.Command; +import com.diamondfire.helpbot.bot.command.permissions.Permission; +import com.diamondfire.helpbot.bot.command.reply.PresetBuilder; +import com.diamondfire.helpbot.bot.command.reply.feature.informative.*; +import com.diamondfire.helpbot.bot.events.CommandEvent; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.entities.channel.concrete.*; +import net.dv8tion.jda.api.entities.channel.forums.ForumTag; + +import java.util.*; + + +public class SolvedCommand extends Command { + + @Override + public String getName() { + return "solved"; + } + + @Override + public HelpContext getHelpContext() { + return new HelpContext() + .description("Marks the help post as solved.") + .category(CommandCategory.OTHER); + } + + @Override + public ArgumentSet compileArguments() { + return new ArgumentSet(); + } + + @Override + public Permission getPermission() { + return Permission.USER; + } + + @Override + public void run(CommandEvent event) { + // Limit to help forum. + if ( + event.getChannel().getType() != ChannelType.GUILD_PUBLIC_THREAD || + event.getChannel().asThreadChannel().getParentChannel().getIdLong() != HelpBotInstance.getConfig().getHelpChannel() + ) { + event.reply(new PresetBuilder() + .withPreset( + new InformativeReply(InformativeReplyType.ERROR, "Command can only be used in <#" + HelpBotInstance.getConfig().getHelpChannel() + ">") + )); + return; + } + + ThreadChannel threadChannel = event.getChannel().asThreadChannel(); + + // Check if the command is used by the post owner. + if (event.getMember() == null | threadChannel.getOwnerIdLong() != event.getMember().getIdLong()) { + event.reply(new PresetBuilder() + .withPreset( + new InformativeReply(InformativeReplyType.ERROR, "Command can only be used by the post owner.") + )); + return; + } + + // Check if the post is already locked. + if (threadChannel.isLocked()) { + event.reply(new PresetBuilder() + .withPreset( + new InformativeReply(InformativeReplyType.ERROR, "Post is already solved.") + )); + return; + } + + // Apply the solved tag, other behavior handled by PostAppliedTagsEvent. + ForumTag solvedTag = threadChannel.getParentChannel().asForumChannel().getAvailableTagById(HelpBotInstance.getConfig().getHelpChannelSolvedTag()); + ArrayList appliedTags = new ArrayList<>(threadChannel.getAppliedTags()); + if (!appliedTags.contains(solvedTag)) appliedTags.add(solvedTag); + + threadChannel.getManager().setAppliedTags(appliedTags).queue(); + } + +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java index 59fc8666..efd2756a 100644 --- a/src/main/java/com/diamondfire/helpbot/bot/config/Config.java +++ b/src/main/java/com/diamondfire/helpbot/bot/config/Config.java @@ -79,6 +79,14 @@ public long getPurgeEvidenceChannel() { return getPropertyLong("purge_evidence_channel"); } + public long getHelpChannel() { + return getPropertyLong("help_channel"); + } + + public long getHelpChannelSolvedTag() { + return getPropertyLong("help_channel_solved_tag"); + } + public long getMutedRole() { return getPropertyLong("muted_role"); } diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/ChannelArchiveEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/ChannelArchiveEvent.java new file mode 100644 index 00000000..6c13d58f --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/bot/events/ChannelArchiveEvent.java @@ -0,0 +1,24 @@ +package com.diamondfire.helpbot.bot.events; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.events.channel.update.ChannelUpdateArchivedEvent; +import net.dv8tion.jda.api.hooks.ListenerAdapter; + +public class ChannelArchiveEvent extends ListenerAdapter { + + @Override + public void onChannelUpdateArchived(ChannelUpdateArchivedEvent event) { + // Limit to help forum. + if ( + event.getChannel().getType() != ChannelType.GUILD_PUBLIC_THREAD || + event.getChannel().asThreadChannel().getParentChannel().getIdLong() != HelpBotInstance.getConfig().getHelpChannel() + ) { + return; + } + + // When a post is archived, it should be locked. + event.getChannel().asThreadChannel().getManager().setLocked(true).queue(); + } + +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/ChannelCreatedEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/ChannelCreatedEvent.java new file mode 100644 index 00000000..61166268 --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/bot/events/ChannelCreatedEvent.java @@ -0,0 +1,36 @@ +package com.diamondfire.helpbot.bot.events; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import net.dv8tion.jda.api.entities.channel.ChannelType; +import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel; +import net.dv8tion.jda.api.entities.channel.forums.ForumTag; +import net.dv8tion.jda.api.events.channel.ChannelCreateEvent; +import net.dv8tion.jda.api.hooks.ListenerAdapter; + +import java.util.ArrayList; + +public class ChannelCreatedEvent extends ListenerAdapter { + + @Override + public void onChannelCreate(ChannelCreateEvent event) { + // Limit to help forum. + if ( + event.getChannel().getType() != ChannelType.GUILD_PUBLIC_THREAD || + event.getChannel().asThreadChannel().getParentChannel().getIdLong() != HelpBotInstance.getConfig().getHelpChannel() + ) { + return; + } + + // Remove solved tag if post was created with it. + ThreadChannel threadChannel = event.getChannel().asThreadChannel(); + + ForumTag solvedTag = threadChannel.getParentChannel().asForumChannel().getAvailableTagById(HelpBotInstance.getConfig().getHelpChannelSolvedTag()); + if (threadChannel.getAppliedTags().contains(solvedTag)) { + ArrayList appliedTags = new ArrayList<>(threadChannel.getAppliedTags()); + appliedTags.remove(solvedTag); + threadChannel.getManager().setAppliedTags(appliedTags).queue(); + } + + } + +} diff --git a/src/main/java/com/diamondfire/helpbot/bot/events/PostAppliedTagsEvent.java b/src/main/java/com/diamondfire/helpbot/bot/events/PostAppliedTagsEvent.java new file mode 100644 index 00000000..48b7033c --- /dev/null +++ b/src/main/java/com/diamondfire/helpbot/bot/events/PostAppliedTagsEvent.java @@ -0,0 +1,41 @@ +package com.diamondfire.helpbot.bot.events; + +import com.diamondfire.helpbot.bot.HelpBotInstance; +import com.diamondfire.helpbot.bot.command.reply.*; +import com.diamondfire.helpbot.bot.command.reply.feature.informative.*; +import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel; +import net.dv8tion.jda.api.entities.channel.forums.ForumTag; +import net.dv8tion.jda.api.entities.channel.unions.ChannelUnion; +import net.dv8tion.jda.api.events.channel.update.ChannelUpdateAppliedTagsEvent; +import net.dv8tion.jda.api.hooks.ListenerAdapter; + +public class PostAppliedTagsEvent extends ListenerAdapter { + + @Override + public void onChannelUpdateAppliedTags(ChannelUpdateAppliedTagsEvent event) { + // Limit to help forum. + ChannelUnion channel = event.getChannel(); + ThreadChannel threadChannel = channel.asThreadChannel(); + if (threadChannel.getParentChannel().getIdLong() != HelpBotInstance.getConfig().getHelpChannel()) { + return; + } + + ForumTag solvedTag = threadChannel.getParentChannel().asForumChannel().getAvailableTagById(HelpBotInstance.getConfig().getHelpChannelSolvedTag()); + + // If the solved tag is added and the post is not locked, lock the thread. + if (event.getAddedTags().contains(solvedTag) && !threadChannel.isLocked()) { + threadChannel.getManager().setLocked(true).queue(); + threadChannel.sendMessageEmbeds( + new PresetBuilder() + .withPreset( + new InformativeReply(InformativeReplyType.SUCCESS, "Post marked as solved") + ).getEmbed().build() + ).queue(); + threadChannel.getManager().setName("[SOLVED] " + channel.getName()).queue(); + } else if (event.getRemovedTags().contains(solvedTag) && threadChannel.isLocked()) { + // If the solved tag is removed and the post is locked, put the old tags back. + threadChannel.getManager().setAppliedTags(event.getOldTags()).queue(); + } + } + +}