├── ExecuteCommand ├── .gitignore ├── README.md ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── java │ └── de │ │ └── erdbeerbaerlp │ │ └── dcintegrationExecCmd │ │ ├── ExecCommand.java │ │ ├── ExecCommandAddon.java │ │ └── ExecuteCommandConfig.java │ └── resources │ └── DiscordIntegrationAddon.toml ├── MySQL ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── java │ └── de │ │ └── erdbeerbaerlp │ │ └── dcintegrationMySQL │ │ ├── MySQLAddon.java │ │ ├── MySQLConfig.java │ │ └── MySQLInterface.java │ └── resources │ └── DiscordIntegrationAddon.toml ├── README.md ├── VoiceNotifications ├── .gitignore ├── README.md ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── messages.png ├── settings.gradle └── src │ └── main │ ├── java │ └── de │ │ └── erdbeerbaerlp │ │ └── dcintegrationVoiceNotif │ │ ├── VoiceConfig.java │ │ └── VoiceNotificationAddon.java │ └── resources │ └── DiscordIntegrationAddon.toml └── _Releases ├── DiscordIntegration-ExecuteCommand-1.0.1.jar ├── DiscordIntegration-ExecuteCommand-1.0.3.jar ├── DiscordIntegration-ExecuteCommand-1.0.4-SNAPSHOT.jar ├── DiscordIntegration-ExecuteCommand-1.1.0.jar ├── DiscordIntegration-VoiceNotifications-1.0.2.jar ├── DiscordIntegration-VoiceNotifications-1.0.3.jar ├── DiscordIntegration-VoiceNotifications-1.0.4-SNAPSHOT.jar ├── DiscordIntegration-VoiceNotifications-1.1.0.jar ├── MySQL-1.0.0.jar ├── MySQL-1.1.0.jar ├── README.md └── Translations ├── ExecuteCommand ├── English.toml └── German.toml └── VoiceNotifications ├── English.toml └── German.toml /ExecuteCommand/.gitignore: -------------------------------------------------------------------------------- 1 | # Project exclude paths 2 | /.gradle/ 3 | /build/ -------------------------------------------------------------------------------- /ExecuteCommand/README.md: -------------------------------------------------------------------------------- 1 | Discord Integration Execute Command Addon 2 | ----- 3 | This Addon for [DiscordIntegration](https://github.com/ErdbeerbaerLP/Discord-Chat-Integration) adds an /exec command, allowing to run any console command from discord 4 | -------------------------------------------------------------------------------- /ExecuteCommand/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | group 'de.erdbeerbaerlp.dcintegration-executecommand' 6 | version '1.1.1' 7 | 8 | repositories { 9 | mavenCentral() 10 | maven { url 'https://repo.erdbeerbaerlp.de/repository/maven-public/' } 11 | } 12 | 13 | dependencies { 14 | compileOnly 'de.erdbeerbaerlp:dcintegration.common:3.1.0' 15 | compileOnly group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1' 16 | } 17 | -------------------------------------------------------------------------------- /ExecuteCommand/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/ExecuteCommand/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ExecuteCommand/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /ExecuteCommand/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /ExecuteCommand/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | 88 | @rem Execute Gradle 89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 90 | 91 | :end 92 | @rem End local scope for the variables with windows NT shell 93 | if "%ERRORLEVEL%"=="0" goto mainEnd 94 | 95 | :fail 96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 97 | rem the _cmd.exe /c_ return code! 98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 99 | exit /b 1 100 | 101 | :mainEnd 102 | if "%OS%"=="Windows_NT" endlocal 103 | 104 | :omega 105 | -------------------------------------------------------------------------------- /ExecuteCommand/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'DiscordIntegration-ExecuteCommand' 2 | 3 | -------------------------------------------------------------------------------- /ExecuteCommand/src/main/java/de/erdbeerbaerlp/dcintegrationExecCmd/ExecCommand.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationExecCmd; 2 | 3 | import de.erdbeerbaerlp.dcintegration.common.DiscordIntegration; 4 | import de.erdbeerbaerlp.dcintegration.common.discordCommands.DiscordCommand; 5 | import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; 6 | import net.dv8tion.jda.api.interactions.InteractionHook; 7 | import net.dv8tion.jda.api.interactions.commands.OptionMapping; 8 | import net.dv8tion.jda.api.interactions.commands.OptionType; 9 | import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction; 10 | 11 | import java.util.concurrent.CompletableFuture; 12 | 13 | public class ExecCommand extends DiscordCommand { 14 | 15 | protected ExecCommand() { 16 | super("exec", ExecCommandAddon.cfg.commandDescription); 17 | addOption(OptionType.STRING,"cmd",ExecCommandAddon.cfg.commandArgDescription, true); 18 | } 19 | 20 | @Override 21 | public boolean adminOnly() { 22 | return ExecCommandAddon.cfg.adminOnly; 23 | } 24 | 25 | @Override 26 | public void execute(SlashCommandInteractionEvent ev, ReplyCallbackAction reply) { 27 | final OptionMapping cmd = ev.getOption("cmd"); 28 | DiscordIntegration.INSTANCE.getServerInterface().runMcCommand(cmd.getAsString(),reply.submit(),ev.getUser()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ExecuteCommand/src/main/java/de/erdbeerbaerlp/dcintegrationExecCmd/ExecCommandAddon.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationExecCmd; 2 | 3 | 4 | import de.erdbeerbaerlp.dcintegration.common.DiscordIntegration; 5 | import de.erdbeerbaerlp.dcintegration.common.addon.AddonConfigRegistry; 6 | import de.erdbeerbaerlp.dcintegration.common.addon.DiscordIntegrationAddon; 7 | import de.erdbeerbaerlp.dcintegration.common.storage.CommandRegistry; 8 | 9 | public class ExecCommandAddon implements DiscordIntegrationAddon { 10 | static ExecuteCommandConfig cfg; 11 | DiscordIntegration discord; 12 | 13 | @Override 14 | public void load(DiscordIntegration dc) { 15 | cfg = AddonConfigRegistry.loadConfig(ExecuteCommandConfig.class, this); 16 | discord = dc; 17 | System.out.println("Addon loaded"); 18 | if (dc.getJDA() != null) { 19 | CommandRegistry.registerCommand(new ExecCommand()); 20 | } 21 | } 22 | 23 | @Override 24 | public void reload() { 25 | cfg = AddonConfigRegistry.loadConfig(cfg, this); 26 | } 27 | 28 | @Override 29 | public void unload(DiscordIntegration dc) { 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /ExecuteCommand/src/main/java/de/erdbeerbaerlp/dcintegrationExecCmd/ExecuteCommandConfig.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationExecCmd; 2 | 3 | import dcshadow.com.moandjiezana.toml.TomlComment; 4 | 5 | 6 | public class ExecuteCommandConfig { 7 | @TomlComment("Command description of the execute command") 8 | public String commandDescription = "Executes an ingame command"; 9 | public String commandArgDescription = "Command to execute (without slash)"; 10 | 11 | @TomlComment({"Should this command only be available to admin roles?","Giving it to non-admins is NOT RECOMMENDED"}) 12 | public boolean adminOnly = true; 13 | } 14 | -------------------------------------------------------------------------------- /ExecuteCommand/src/main/resources/DiscordIntegrationAddon.toml: -------------------------------------------------------------------------------- 1 | # Name of the addon 2 | name = "Execute Command" 3 | 4 | # Version of the addon 5 | version = "1.0.2" 6 | # Path to the main class of the addon 7 | # Example: "com.example.exampleaddon.ExampleAddon" 8 | # 9 | # If this parameter is missing, your addon will not load 10 | classPath = "de.erdbeerbaerlp.dcintegrationExecCmd.ExecCommandAddon" 11 | 12 | # Author of the Addon (optional) 13 | author = "ErdbeerbaerLP" 14 | 15 | # Description of the Addon (optional) 16 | description = "Adds an /exec command to discord, allowing to run ANY in-game command from discord" 17 | 18 | APIVersion = 3 -------------------------------------------------------------------------------- /MySQL/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'com.github.johnrengelman.shadow' version "7.1.2" 4 | } 5 | 6 | group 'de.erdbeerbaerlp.dcintegration-mysql' 7 | version '1.1.0' 8 | configurations { 9 | embed 10 | compileOnly.extendsFrom(embed) 11 | } 12 | shadowJar { 13 | //noinspection GroovyAccessibility 14 | archiveClassifier = "" 15 | configurations = [project.configurations.embed] 16 | } 17 | repositories { 18 | mavenCentral() 19 | maven { url 'https://repo.erdbeerbaerlp.de/repository/maven-public/' } 20 | } 21 | 22 | configurations.all { 23 | resolutionStrategy { 24 | cacheChangingModulesFor 5, 'minutes' 25 | } 26 | } 27 | artifacts { 28 | archives tasks.shadowJar 29 | } 30 | dependencies { 31 | compileOnly 'de.erdbeerbaerlp:dcintegration.common:3.0.0' 32 | compileOnly group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1' 33 | compileOnly group: 'com.google.code.gson', name: 'gson', version: '2.8.9' 34 | embed group: 'mysql', name: 'mysql-connector-java', version: '8.0.23' 35 | } 36 | tasks.build.dependsOn(shadowJar) 37 | -------------------------------------------------------------------------------- /MySQL/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/MySQL/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /MySQL/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /MySQL/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /MySQL/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /MySQL/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'MySQL' 2 | 3 | -------------------------------------------------------------------------------- /MySQL/src/main/java/de/erdbeerbaerlp/dcintegrationMySQL/MySQLAddon.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationMySQL; 2 | 3 | import de.erdbeerbaerlp.dcintegration.common.DiscordIntegration; 4 | import de.erdbeerbaerlp.dcintegration.common.addon.AddonConfigRegistry; 5 | import de.erdbeerbaerlp.dcintegration.common.addon.DiscordIntegrationAddon; 6 | 7 | public class MySQLAddon implements DiscordIntegrationAddon { 8 | static MySQLConfig cfg; 9 | @Override 10 | public void load(DiscordIntegration dc) { 11 | cfg = AddonConfigRegistry.loadConfig(MySQLConfig.class,this); 12 | } 13 | 14 | @Override 15 | public void reload() { 16 | cfg = AddonConfigRegistry.loadConfig(cfg, this); 17 | } 18 | 19 | @Override 20 | public void unload(DiscordIntegration dc) { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MySQL/src/main/java/de/erdbeerbaerlp/dcintegrationMySQL/MySQLConfig.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationMySQL; 2 | 3 | public class MySQLConfig { 4 | public String host = "localhost"; 5 | public int port = 3306; 6 | public String user = "user"; 7 | public String password = "password"; 8 | public String database = "discordintegration"; 9 | } 10 | -------------------------------------------------------------------------------- /MySQL/src/main/java/de/erdbeerbaerlp/dcintegrationMySQL/MySQLInterface.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationMySQL; 2 | 3 | import de.erdbeerbaerlp.dcintegration.common.storage.linking.PlayerLink; 4 | import de.erdbeerbaerlp.dcintegration.common.storage.linking.PlayerSettings; 5 | import de.erdbeerbaerlp.dcintegration.common.storage.linking.database.DBInterface; 6 | 7 | import java.sql.*; 8 | import java.util.ArrayList; 9 | 10 | public class MySQLInterface extends DBInterface { 11 | Connection connection = null; 12 | 13 | @Override 14 | public void connect() { 15 | try { 16 | Class.forName("com.mysql.cj.jdbc.Driver"); 17 | connection = DriverManager.getConnection("jdbc:mysql://" + MySQLAddon.cfg.host + ":" + MySQLAddon.cfg.port + "/" + MySQLAddon.cfg.database, MySQLAddon.cfg.user, MySQLAddon.cfg.password); 18 | } catch (SQLException | ClassNotFoundException e) { 19 | e.printStackTrace(); 20 | } 21 | } 22 | 23 | @Override 24 | public void initialize() { 25 | try { 26 | final Statement statement = connection.createStatement(); 27 | statement.executeUpdate("CREATE TABLE IF NOT EXISTS PlayerLinks(id BIGINT not null primary key,mcuuid text,fluuid text,settings json not null)"); 28 | statement.closeOnCompletion(); 29 | } catch (SQLException e) { 30 | e.printStackTrace(); 31 | } 32 | } 33 | 34 | 35 | @Override 36 | public boolean isConnected() { 37 | if (connection == null) return false; 38 | try { 39 | return connection.isValid(10); 40 | } catch (SQLException e) { 41 | return false; 42 | } 43 | } 44 | 45 | @Override 46 | public void addLink(PlayerLink link) { 47 | try { 48 | final Statement statement = connection.createStatement(); 49 | statement.executeUpdate("replace into PlayerLinks(id,mcuuid,fluuid,settings) values('" + link.discordID + "', '" + link.mcPlayerUUID + "', '" + link.floodgateUUID + "','" + gson.toJson(link.settings) + "')"); 50 | statement.closeOnCompletion(); 51 | } catch (SQLException e) { 52 | e.printStackTrace(); 53 | } 54 | 55 | } 56 | 57 | @Override 58 | public void removeLink(String id) { 59 | try { 60 | final Statement statement = connection.createStatement(); 61 | statement.executeUpdate("delete from PlayerLinks where id='" + id + "'"); 62 | statement.closeOnCompletion(); 63 | } catch (SQLException e) { 64 | e.printStackTrace(); 65 | } 66 | } 67 | private PlayerLink getLink(ResultSet res) throws SQLException { 68 | if (res != null && res.next()) { 69 | if (res.wasNull()) 70 | return null; 71 | return new PlayerLink(res.getString(1), res.getString(2), res.getString(3), gson.fromJson(res.getString(4), PlayerSettings.class)); 72 | } 73 | return null; 74 | } 75 | 76 | @Override 77 | public PlayerLink[] getAllLinks() { 78 | final ArrayList links = new ArrayList<>(); 79 | try { 80 | final Statement statement = connection.createStatement(); 81 | final ResultSet res = statement.executeQuery("SELECT id,mcuuid,fluuid,settings FROM PlayerLinks"); 82 | statement.closeOnCompletion(); 83 | while (res != null && res.next()) { 84 | if (res.wasNull()) 85 | return links.toArray(new PlayerLink[0]); 86 | links.add(new PlayerLink(res.getString(1), res.getString(2), res.getString(3), gson.fromJson(res.getString(4), PlayerSettings.class))); 87 | } 88 | 89 | } catch (SQLException e) { 90 | e.printStackTrace(); 91 | } 92 | return links.toArray(new PlayerLink[0]); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /MySQL/src/main/resources/DiscordIntegrationAddon.toml: -------------------------------------------------------------------------------- 1 | # Name of the addon 2 | name = "MySQL" 3 | 4 | # Version of the addon 5 | version = "1.1.0" 6 | # Path to the main class of the addon 7 | # Example: "com.example.exampleaddon.ExampleAddon" 8 | # 9 | # If this parameter is missing, your addon will not load 10 | classPath = "de.erdbeerbaerlp.dcintegrationMySQL.MySQLAddon" 11 | 12 | # Author of the Addon (optional) 13 | author = "ErdbeerbaerLP" 14 | 15 | # Description of the Addon (optional) 16 | description = "Adds MySQL as a Database integration type" 17 | 18 | APIVersion = 3 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DiscordIntegration Addons 2 | === 3 | 4 | This repository contains all DiscordIntegration addons I made 5 | 6 | **Download** releases and translated configs [HERE](https://github.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/tree/master/_Releases) 7 | 8 | INSTALLATION 9 | --- 10 | Addons are installed to `SERVER/DiscordIntegration-Data/addons` 11 | 12 | If you are using an older mod version with java 11 or higer and you are getting errors, please start the server with ``java --add-opens java.base/java.io=ALL-UNNAMED -jar SERVER.jar`` 13 | -------------------------------------------------------------------------------- /VoiceNotifications/.gitignore: -------------------------------------------------------------------------------- 1 | # Project exclude paths 2 | /.gradle/ 3 | /build/ -------------------------------------------------------------------------------- /VoiceNotifications/README.md: -------------------------------------------------------------------------------- 1 | Discord Integration Voice Notification Addon 2 | ----- 3 | This Addon for [DiscordIntegration](https://github.com/ErdbeerbaerLP/Discord-Chat-Integration) adds voice channel notifications to the game. 4 | 5 | Those notifications will show when someone joins, leaves or moves between voice channels. 6 | 7 | You can filter which voice channels should get messages, or just get messages for all voice channels 8 | 9 | ![](https://github.com/ErdbeerbaerLP/DiscordIntegration-Voice-Notifications/raw/master/VoiceNotifications/messages.png) -------------------------------------------------------------------------------- /VoiceNotifications/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | group 'de.erdbeerbaerlp.dcintegration-voiceaddon' 6 | version '1.1.0' 7 | 8 | repositories { 9 | mavenCentral() 10 | maven { url 'https://repo.erdbeerbaerlp.de/repository/maven-public/' } 11 | } 12 | 13 | configurations.all { 14 | resolutionStrategy { 15 | cacheChangingModulesFor 1, 'minutes' 16 | } 17 | } 18 | dependencies { 19 | compileOnly 'de.erdbeerbaerlp:dcintegration.common:3.0.0' 20 | compileOnly group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1' 21 | } 22 | -------------------------------------------------------------------------------- /VoiceNotifications/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/VoiceNotifications/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /VoiceNotifications/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /VoiceNotifications/gradlew: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/VoiceNotifications/gradlew -------------------------------------------------------------------------------- /VoiceNotifications/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | 88 | @rem Execute Gradle 89 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 90 | 91 | :end 92 | @rem End local scope for the variables with windows NT shell 93 | if "%ERRORLEVEL%"=="0" goto mainEnd 94 | 95 | :fail 96 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 97 | rem the _cmd.exe /c_ return code! 98 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 99 | exit /b 1 100 | 101 | :mainEnd 102 | if "%OS%"=="Windows_NT" endlocal 103 | 104 | :omega 105 | -------------------------------------------------------------------------------- /VoiceNotifications/messages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/VoiceNotifications/messages.png -------------------------------------------------------------------------------- /VoiceNotifications/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'DiscordIntegration-VoiceNotifications' 2 | 3 | -------------------------------------------------------------------------------- /VoiceNotifications/src/main/java/de/erdbeerbaerlp/dcintegrationVoiceNotif/VoiceConfig.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationVoiceNotif; 2 | 3 | import dcshadow.com.moandjiezana.toml.TomlComment; 4 | 5 | 6 | public class VoiceConfig { 7 | @TomlComment({"Message sent to Minecraft when someone joins an voice channel", "", "Placeholders:", "%dstName% - Destination Channel of the move", "%name% - Display name (Nickname or account name) of the Discord user"}) 8 | public String joinMessage = "\u00A76[\u00A75DISCORD\u00A76]\u00A7a + \u00A77 %name% joined the voice channel \"\u00A73%dstName%\u00A77\""; 9 | 10 | @TomlComment({"Message sent to Minecraft when someone left an voice channel", "", "Placeholders:", "%sourceName% - Source Channel of the move", "%name% - Display name (Nickname or account name) of the Discord user"}) 11 | public String leaveMessage = "\u00A76[\u00A75DISCORD\u00A76]\u00A7c - \u00A77 %name% left the voice channel \"\u00A73%sourceName%\u00A77\""; 12 | 13 | @TomlComment({"Message sent to Minecraft when someone moved between two channels", "", "Placeholders:", "%sourceName% - Source Channel of the move", "%dstName% - Destination Channel of the move", "%name% - Display name (Nickname or account name) of the Discord user"}) 14 | public String moveMessage = "\u00A76[\u00A75DISCORD\u00A76]\u00A77 %name% moved from the voice channel \"\u00A73%sourceName%\u00A77\" to \"\u00A73%dstName%\u00A77\""; 15 | 16 | @TomlComment({"Voice channels to listen for events", "Leave empty to allow all voice channels"}) 17 | public String[] voiceChannels = new String[0]; 18 | } 19 | -------------------------------------------------------------------------------- /VoiceNotifications/src/main/java/de/erdbeerbaerlp/dcintegrationVoiceNotif/VoiceNotificationAddon.java: -------------------------------------------------------------------------------- 1 | package de.erdbeerbaerlp.dcintegrationVoiceNotif; 2 | 3 | 4 | import dcshadow.net.kyori.adventure.text.Component; 5 | import dcshadow.net.kyori.adventure.text.event.ClickEvent; 6 | import dcshadow.net.kyori.adventure.text.event.HoverEvent; 7 | import dcshadow.net.kyori.adventure.text.format.Style; 8 | import dcshadow.net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; 9 | import dcshadow.org.apache.commons.lang3.ArrayUtils; 10 | import de.erdbeerbaerlp.dcintegration.common.DiscordIntegration; 11 | import de.erdbeerbaerlp.dcintegration.common.addon.AddonConfigRegistry; 12 | import de.erdbeerbaerlp.dcintegration.common.addon.DiscordIntegrationAddon; 13 | import de.erdbeerbaerlp.dcintegration.common.storage.Localization; 14 | import de.erdbeerbaerlp.dcintegration.common.util.ComponentUtils; 15 | import net.dv8tion.jda.api.entities.Member; 16 | import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; 17 | import net.dv8tion.jda.api.events.guild.voice.GuildVoiceUpdateEvent; 18 | import net.dv8tion.jda.api.hooks.ListenerAdapter; 19 | 20 | import java.lang.reflect.InvocationTargetException; 21 | 22 | public class VoiceNotificationAddon extends ListenerAdapter implements DiscordIntegrationAddon { 23 | private VoiceConfig cfg; 24 | DiscordIntegration discord; 25 | 26 | @Override 27 | public void load(DiscordIntegration dc) { 28 | cfg = AddonConfigRegistry.loadConfig(VoiceConfig.class, this); 29 | discord = dc; 30 | DiscordIntegration.LOGGER.info("Voice-Notifications Addon loaded"); 31 | if (dc.getJDA() != null) 32 | dc.getJDA().addEventListener(this); 33 | } 34 | 35 | @Override 36 | public void reload() { 37 | cfg = AddonConfigRegistry.loadConfig(cfg,this); 38 | } 39 | 40 | @Override 41 | public void unload(DiscordIntegration dc) { 42 | if (dc.getJDA() != null) 43 | dc.getJDA().removeEventListener(this); 44 | } 45 | 46 | @Override 47 | public void onGuildVoiceUpdate(GuildVoiceUpdateEvent event) { 48 | final Class aClass = event.getClass(); 49 | AudioChannel joinedChannel,leftChannel; 50 | Member member; 51 | try { 52 | joinedChannel= (AudioChannel) aClass.getMethod("getChannelJoined").invoke(event); 53 | leftChannel = (AudioChannel) aClass.getMethod("getChannelLeft").invoke(event); 54 | member = (Member) aClass.getMethod("getMember").invoke(event); 55 | } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { 56 | throw new RuntimeException(e); 57 | } 58 | if (cfg.voiceChannels.length == 0 || (joinedChannel != null && ArrayUtils.contains(cfg.voiceChannels, joinedChannel.getId())) || (leftChannel != null && ArrayUtils.contains(cfg.voiceChannels, leftChannel.getId()))) { 59 | if (joinedChannel != null && leftChannel == null) { 60 | discord.getServerInterface().sendIngameMessage(LegacyComponentSerializer.legacySection().deserialize(cfg.joinMessage.replace("%dstName%", joinedChannel.getName())).replaceText(ComponentUtils.replace("%name%", Component.text(member.getEffectiveName()).style(Style.empty().clickEvent(ClickEvent.suggestCommand("<@" + member.getId() + ">")).hoverEvent(HoverEvent.showText(Component.text(Localization.instance().discordUserHover.replace("%user#tag%", member.getUser().getAsTag()).replace("%user%", member.getEffectiveName()).replace("%id%", member.getId())))))))); 61 | } else if (leftChannel != null && joinedChannel == null) { 62 | discord.getServerInterface().sendIngameMessage(LegacyComponentSerializer.legacySection().deserialize(cfg.leaveMessage.replace("%sourceName%", leftChannel.getName())).replaceText(ComponentUtils.replace("%name%", Component.text(member.getEffectiveName()).style(Style.empty().clickEvent(ClickEvent.suggestCommand("<@" + member.getId() + ">")).hoverEvent(HoverEvent.showText(Component.text(Localization.instance().discordUserHover.replace("%user#tag%", member.getUser().getAsTag()).replace("%user%", member.getEffectiveName()).replace("%id%", member.getId())))))))); 63 | 64 | } else{ 65 | discord.getServerInterface().sendIngameMessage(LegacyComponentSerializer.legacySection().deserialize(cfg.moveMessage.replace("%sourceName%", leftChannel.getName()).replace("%dstName%", joinedChannel.getName())).replaceText(ComponentUtils.replace("%name%", Component.text(member.getEffectiveName()).style(Style.empty().clickEvent(ClickEvent.suggestCommand("<@" + member.getId() + ">")).hoverEvent(HoverEvent.showText(Component.text(Localization.instance().discordUserHover.replace("%user#tag%", member.getUser().getAsTag()).replace("%user%", member.getEffectiveName()).replace("%id%", member.getId())))))))); 66 | } 67 | } 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /VoiceNotifications/src/main/resources/DiscordIntegrationAddon.toml: -------------------------------------------------------------------------------- 1 | # Name of the addon 2 | name = "Voice Notification" 3 | 4 | # Version of the addon 5 | version = "1.0.2" 6 | # Path to the main class of the addon 7 | # Example: "com.example.exampleaddon.ExampleAddon" 8 | # 9 | # If this parameter is missing, your addon will not load 10 | classPath = "de.erdbeerbaerlp.dcintegrationVoiceNotif.VoiceNotificationAddon" 11 | 12 | # Author of the Addon (optional) 13 | author = "ErdbeerbaerLP" 14 | 15 | # Description of the Addon (optional) 16 | description = "Sends ingame messages when users join voice channels" 17 | 18 | APIVersion = 3 -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-ExecuteCommand-1.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-ExecuteCommand-1.0.1.jar -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-ExecuteCommand-1.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-ExecuteCommand-1.0.3.jar -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-ExecuteCommand-1.0.4-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-ExecuteCommand-1.0.4-SNAPSHOT.jar -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-ExecuteCommand-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-ExecuteCommand-1.1.0.jar -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-VoiceNotifications-1.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-VoiceNotifications-1.0.2.jar -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-VoiceNotifications-1.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-VoiceNotifications-1.0.3.jar -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-VoiceNotifications-1.0.4-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-VoiceNotifications-1.0.4-SNAPSHOT.jar -------------------------------------------------------------------------------- /_Releases/DiscordIntegration-VoiceNotifications-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/DiscordIntegration-VoiceNotifications-1.1.0.jar -------------------------------------------------------------------------------- /_Releases/MySQL-1.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/MySQL-1.0.0.jar -------------------------------------------------------------------------------- /_Releases/MySQL-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErdbeerbaerLP/DiscordIntegration-Addon-Repository/e2c6dd27ebfe812fb3d05c4d504f5b2900b38e36/_Releases/MySQL-1.1.0.jar -------------------------------------------------------------------------------- /_Releases/README.md: -------------------------------------------------------------------------------- 1 | Voice Notifications 2 | == 3 | Sends notifications into ingame-chat when someone joins/leaves Voice Channels 4 | 5 | ![](https://github.com/ErdbeerbaerLP/DiscordIntegration-Voice-Notifications/raw/master/VoiceNotifications/messages.png) 6 | 7 | #### 1.0.3 was released to support 2.4.x versions 8 | #### 1.0.4 supports 2.5.x 9 | #### 1.1.0 supports 3.x.x 10 | 11 | Execute Command 12 | == 13 | Adds an /exec command to discord, allowing to run *any* server command from discord 14 | 15 | #### 1.0.3 was released to support 2.4.x versions 16 | #### 1.0.4 supports 2.5.x 17 | #### 1.1.0 supports 3.x.x 18 | #### 1.1.1 Security fix! 19 | 20 | MySQL 21 | == 22 | #### 1.0.0 supports 2.6.x 23 | #### 1.1.0 supports 3.x.x 24 | 25 | Adds MySQL implementation to the link feature. Only useful with version 2.6.0+ 26 | Use `databaseClass = "de.erdbeerbaerlp.dcintegrationMySQL.MySQLInterface"` -------------------------------------------------------------------------------- /_Releases/Translations/ExecuteCommand/English.toml: -------------------------------------------------------------------------------- 1 | # Command description of the execute command 2 | commandDescription = "Executes an ingame command" 3 | commandArgDescription = "Command to execute (without slash)" -------------------------------------------------------------------------------- /_Releases/Translations/ExecuteCommand/German.toml: -------------------------------------------------------------------------------- 1 | # Command description of the execute command 2 | commandDescription = "Führt einen in-game Befehl aus" 3 | commandArgDescription = "Befehl zum Asuführen (ohne Slash)" -------------------------------------------------------------------------------- /_Releases/Translations/VoiceNotifications/English.toml: -------------------------------------------------------------------------------- 1 | # Message sent to Minecraft when someone joins an voice channel 2 | # 3 | # Placeholders: 4 | # %dstName% - Destination Channel of the move 5 | # %name% - Display name (Nickname or account name) of the Discord user 6 | joinMessage = "§6[§5DISCORD§6]§a + §7%name% joined the voice channel \"§3%dstName%§7\"" 7 | # Message sent to Minecraft when someone left an voice channel 8 | # 9 | # Placeholders: 10 | # %sourceName% - Source Channel of the move 11 | # %name% - Display name (Nickname or account name) of the Discord user 12 | leaveMessage = "§6[§5DISCORD§6]§c - §7%name% left the voice channel \"§3%sourceName%§7\"" 13 | # Message sent to Minecraft when someone moved between two channels 14 | # 15 | # Placeholders: 16 | # %sourceName% - Source Channel of the move 17 | # %dstName% - Destination Channel of the move 18 | # %name% - Display name (Nickname or account name) of the Discord user 19 | moveMessage = "§6[§5DISCORD§6]§7 %name% moved from the voice channel \"§3%sourceName%§7\" to \"§3%dstName%§7\"" 20 | -------------------------------------------------------------------------------- /_Releases/Translations/VoiceNotifications/German.toml: -------------------------------------------------------------------------------- 1 | # Message sent to Minecraft when someone joins an voice channel 2 | # 3 | # Placeholders: 4 | # %dstName% - Destination Channel of the move 5 | # %name% - Display name (Nickname or account name) of the Discord user 6 | joinMessage = "§6[§5DISCORD§6]§a + §7%name% hat den Sprachkanal \"§3%dstName%§7\" betreten" 7 | # Message sent to Minecraft when someone left an voice channel 8 | # 9 | # Placeholders: 10 | # %sourceName% - Source Channel of the move 11 | # %name% - Display name (Nickname or account name) of the Discord user 12 | leaveMessage = "§6[§5DISCORD§6]§c - §7%name% hat den Sprachkanal \"§3%sourceName%§7\" verlassen" 13 | # Message sent to Minecraft when someone moved between two channels 14 | # 15 | # Placeholders: 16 | # %sourceName% - Source Channel of the move 17 | # %dstName% - Destination Channel of the move 18 | # %name% - Display name (Nickname or account name) of the Discord user 19 | moveMessage = "§6[§5DISCORD§6]§7 %name% ist von Sprachkanal \"§3%sourceName%§7\" zu \"§3%dstName%§7\" gewechselt" 20 | --------------------------------------------------------------------------------