diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..0a0e74f --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,32 @@ +name: Java CI + +on: + push: + branches: + - master + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build with Gradle + run: ./gradlew build + - uses: webfactory/ssh-agent@v0.1.1 + with: + ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} + - name: Push jar + run: | + mv ./build/libs/*.jar ./mineweb_bridge-$VERSION.jar + git add mineweb_bridge-$VERSION.jar + git commit -m "build: Add mineweb_bridge-$VERSION.jar" + git push $REPO master + env: + REPO: git@github.com:${{github.repository}}.git + VERSION: "3.0.0" diff --git a/.gitignore b/.gitignore index cc6aa89..6034355 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,5 @@ *.class /target/ .gradle -gradle/ build/ /bin/ diff --git a/build.gradle b/build.gradle index 1340eab..3b167f0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,19 @@ buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath 'me.tatarka:gradle-retrolambda:3.2.5' - } + repositories { + jcenter() + } + dependencies { + classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0' + } } apply plugin: 'java' +apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'eclipse' apply plugin: 'maven' -apply plugin: 'me.tatarka.retrolambda' group = 'fr.vmarchaud' -version = '2.0.0' +version = '3.0.0' description = "mineweb_bridge" @@ -27,6 +26,9 @@ repositories { maven { url "http://repo.dmulloy2.net/content/groups/public/" } mavenCentral() jcenter() + flatDir { + dirs 'dependencies' + } } dependencies { @@ -34,22 +36,18 @@ dependencies { //compile files('/Users/valentin/Sites/mineweb_bridge/guava-17.0.jar') //compile group: 'com.google.guava', name: 'guava', version: '17.0' compile "com.google.code.gson:gson:2.5" - compile ("com.comphenix.protocol:ProtocolLib-API:4.0-SNAPSHOT") { - exclude group: "com.comphenix.executors" + compile ("com.comphenix.protocol:ProtocolLib:4.4.0") { + exclude group: "com.comphenix.executors" + // For + exclude group: "cglib" } compile 'com.annimon:stream:1.1.1' - compileOnly "org.spigotmc:spigot:1.8-R0.1-SNAPSHOT" - compileOnly "org.projectlombok:lombok:1.16.6" - compileOnly "net.md-5:bungeecord-bootstrap:1.8-SNAPSHOT" -} - -task fatJar(type: Jar) { - from { - configurations.compile.collect { - it.isDirectory() ? it : zipTree(it) - } - } - with jar + compile 'javax.xml.bind:jaxb-api:2.3.0' + compileOnly "org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT" + compileOnly 'org.projectlombok:lombok:1.18.10' + annotationProcessor 'org.projectlombok:lombok:1.18.10' + compileOnly group: 'io.netty', name: 'netty-all', version: '4.1.43.Final' + compileOnly fileTree(include: ['*.jar'], dir: 'dependencies') } task moveIntoBukkit(type: Copy) { diff --git a/dependencies/BungeeCord.jar b/dependencies/BungeeCord.jar new file mode 100644 index 0000000..af4ed7d Binary files /dev/null and b/dependencies/BungeeCord.jar differ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..87b738c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..44e7c4d --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index 27309d9..af6708f --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -28,16 +28,16 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 3cb01f1..6d57edc 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,26 +1,3 @@ -@rem *************************************************************************** -@rem MIT License -@rem -@rem Copyright (c) 2016 Valentin 'ThisIsMac' Marchaud -@rem -@rem Permission is hereby granted, free of charge, to any person obtaining a copy -@rem of this software and associated documentation files (the "Software"), to deal -@rem in the Software without restriction, including without limitation the rights -@rem to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -@rem copies of the Software, and to permit persons to whom the Software is -@rem furnished to do so, subject to the following conditions: -@rem -@rem The above copyright notice and this permission notice shall be included in all -@rem copies or substantial portions of the Software. -@rem -@rem THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -@rem IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -@rem FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -@rem AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -@rem LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -@rem OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -@rem SOFTWARE. -@rem *************************************************************************** @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -37,7 +14,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -72,7 +49,6 @@ goto fail @rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -83,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/mineweb_bridge-3.0.0.jar b/mineweb_bridge-3.0.0.jar new file mode 100644 index 0000000..22203d6 Binary files /dev/null and b/mineweb_bridge-3.0.0.jar differ diff --git a/src/main/java/fr/vmarchaud/mineweb/bukkit/MinewebCommandSender.java b/src/main/java/fr/vmarchaud/mineweb/bukkit/MinewebCommandSender.java deleted file mode 100644 index cfd70d1..0000000 --- a/src/main/java/fr/vmarchaud/mineweb/bukkit/MinewebCommandSender.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * MIT License - * - * Copyright (c) 2016 Valentin 'ThisIsMac' Marchaud - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *******************************************************************************/ -package fr.vmarchaud.mineweb.bukkit; - -import org.bukkit.craftbukkit.v1_8_R1.command.ServerCommandSender; - -public class MinewebCommandSender extends ServerCommandSender { - - @Override - public void sendMessage(String message) { - //RemoteControlCommandListener.instance.sendMessage(message + "\n"); // Send a newline after each message, to preserve formatting. - - } - - @Override - public void sendMessage(String[] messages) { - for (String message : messages) { - sendMessage(message); - } - } - - @Override - public String getName() { - return "Rcon"; - } - - @Override - public boolean isOp() { - return true; - } - - @Override - public void setOp(boolean value) { - // unsupported - return ; - } -}