diff --git a/.gitignore b/.gitignore index 09130b2..606ccc8 100644 --- a/.gitignore +++ b/.gitignore @@ -24,11 +24,10 @@ hs_err_pid* ## Gradle .gradle/ build/ -gradle/ -gradlew out/ output/ run/ +!gradle/wrapper/gradle-wrapper.jar ## sublime *.sublime* @@ -53,4 +52,4 @@ target/ *~ -run \ No newline at end of file +Library \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e7bbd57..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: java -install: mvn install -DskipTests=true -Dgpg.skip=true -jdk: - - oraclejdk8 - - oraclejdk9 -cache: - directories: - - $HOME/.m2 diff --git a/LICENSE b/LICENSE index 88f3f72..442e942 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 to2mbn +Copyright (c) 2016-2023 yushijinhun, xfl03 and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index daa9184..0deea44 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # JMCCC -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Southern-InfinityStudio/JMCCC?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.org/to2mbn/JMCCC.svg?branch=master)](https://travis-ci.org/to2mbn/JMCCC)
+[![Maven Central](https://img.shields.io/maven-central/v/dev.3-3/jmccc)](https://central.sonatype.com/search?q=jmccc&namespace=dev.3-3) +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Southern-InfinityStudio/JMCCC?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + A powerful open-source library for launching and downloading Minecraft. ## License @@ -35,15 +37,14 @@ JMCCC is licensed under [the MIT license](https://github.com/xfl03/JMCCC/LICENSE | `dev.3-3:jmccc-mcdownloader` | Minecraft downloading feature. | | `dev.3-3:jmccc-mojang-api` | Mojang API client. | -The snapshot repository: -```xml - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots/ - - true - - +JMCCC **RELEASE** version has been uploaded to **MAVEN CENTRAL**: +``` +https://repo1.maven.org/maven2/ +``` + +If you do need the snapshot repository: +``` +https://s01.oss.sonatype.org/content/repositories/snapshots/ ``` ### Launching Minecraft diff --git a/README.zh_CN.md b/README.zh_CN.md index 14e2b3f..33071fa 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -1,5 +1,7 @@ # JMCCC -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Southern-InfinityStudio/JMCCC?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build Status](https://travis-ci.org/to2mbn/JMCCC.svg?branch=master)](https://travis-ci.org/to2mbn/JMCCC)
+[![Maven Central](https://img.shields.io/maven-central/v/dev.3-3/jmccc)](https://central.sonatype.com/search?q=jmccc&namespace=dev.3-3) +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Southern-InfinityStudio/JMCCC?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + 一个用来下载并启动Minecraft的强大的开源类库。 ## 许可证 @@ -35,15 +37,14 @@ JMCCC使用[MIT许可证](https://github.com/xfl03/JMCCC/LICENSE)。 | `dev.3-3:jmccc-mcdownloader` | 提供下载Minecraft的功能 | | `dev.3-3:jmccc-mojang-api` | Mojang API客户端 | -快照版本(snapshot)的Maven仓库: -```xml - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots/ - - true - - +JMCCC的**正式版本**(release) 已上传至 **Maven Central**: +``` +https://repo1.maven.org/maven2/ +``` + +快照版本(snapshot)的Maven仓库: +``` +https://s01.oss.sonatype.org/content/repositories/snapshots/ ``` ### 启动Minecraft diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..44284fd --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,10 @@ +plugins { + base +} + +version = "3.0.1" + +subprojects { + //Real subproject DSL is located at `buildSrc/src/main/kotlin/dev.3-3.jmccc.gradle.kts` + apply(plugin = "dev.3-3.jmccc") +} \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..50cec87 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + // Support convention plugins written in Kotlin. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. + `kotlin-dsl` +} + +repositories { + // Use the plugin portal to apply community plugins in convention plugins. + gradlePluginPortal() +} diff --git a/buildSrc/src/main/kotlin/dev.3-3.jmccc.gradle.kts b/buildSrc/src/main/kotlin/dev.3-3.jmccc.gradle.kts new file mode 100644 index 0000000..d923431 --- /dev/null +++ b/buildSrc/src/main/kotlin/dev.3-3.jmccc.gradle.kts @@ -0,0 +1,122 @@ +plugins { + `java-library` + `maven-publish` +} + +dependencies { + testImplementation("junit:junit:4.13.1") +} + +group = "dev.3-3" +version = rootProject.version + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + withSourcesJar() + withJavadocJar() +} + +tasks { + compileJava { + options.encoding = "UTF-8" + } + javadoc { + if (JavaVersion.current().isJava9Compatible) { + (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) + } + options { + encoding = "UTF-8" + (this as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") + } + } +} + +publishing { + publications { + create("mavenJava") { + from(components["java"]) + if (tasks.findByName("shadowJar") != null) { + artifact(tasks["shadowJar"]) + } + pom { + description.set("JMCCC is a powerful open-source library for launching and downloading Minecraft.") + url.set("https://github.com/xfl03/JMCCC") + licenses { + license { + name.set("MIT") + url.set("https://github.com/xfl03/JMCCC/LICENSE") + distribution.set("repo") + comments.set( + """ + The MIT License (MIT) + + Copyright (c) 2016-2023 yushijinhun, xfl03 and contributors + + 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. + """.trimIndent() + ) + } + } + developers { + developer { + id.set("darkyoooooo") + name.set("Qiyun Zhou") + email.set("2569766005@qq.com") + url.set("https://github.com/darkyoooooo") + } + developer { + id.set("yushijinhun") + name.set("Haowei Wen") + email.set("yushijinhun@gmail.com") + url.set("https://github.com/yushijinhun") + } + developer { + id.set("xfl03") + name.set("xfl03") + email.set("moe@3-3.dev") + url.set("https://github.com/xfl03") + } + } + scm { + connection.set("scm:git:git://github.com/xfl03/JMCCC.git") + developerConnection.set("scm:git:git@github.com:xfl03/JMCCC.git") + tag.set("master") + url.set("https://github.com/xfl03/JMCCC") + } + issueManagement { + system.set("GitHub Issues") + url.set("https://github.com/xfl03/JMCCC/issues") + } + } + } + } + repositories { + maven { + name = "ossrh" + val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl) + credentials { + username = System.getenv("OSSRH_USERNAME") + password = System.getenv("OSSRH_PASSWORD") + } + } + } +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..943f0cb 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..f398c33 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..65dcd68 --- /dev/null +++ b/gradlew @@ -0,0 +1,244 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..93e3f59 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jmccc-cli/build.gradle.kts b/jmccc-cli/build.gradle.kts new file mode 100644 index 0000000..f8386b5 --- /dev/null +++ b/jmccc-cli/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + id("com.github.johnrengelman.shadow") +} + +description = "jmccc cli" + +dependencies { + implementation(project(":jmccc")) + implementation(project(":jmccc-mcdownloader")) + implementation("net.sf.jopt-simple:jopt-simple:5.0.4") +} +tasks { + shadowJar { + manifest { + attributes("Main-Class" to "jmccc.cli.Main") + } + minimize { + exclude(dependency("commons-logging:commons-logging:.*")) + exclude(dependency("org.ehcache.modules:ehcache-impl:.*")) + } + } +} \ No newline at end of file diff --git a/jmccc-cli/pom.xml b/jmccc-cli/pom.xml deleted file mode 100644 index 63b095a..0000000 --- a/jmccc-cli/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - - dev.3-3 - jmccc-parent - ${revision} - - jmccc-cli - jmccc cli - CLI for JMCCC - - - dev.3-3 - jmccc - - - - dev.3-3 - jmccc-mcdownloader - - - - net.sf.jopt-simple - jopt-simple - 5.0.4 - - - - diff --git a/jmccc-cli/src/main/java/jmccc/cli/launch/SimpleLauncher.java b/jmccc-cli/src/main/java/jmccc/cli/launch/SimpleLauncher.java index b19166e..964ab33 100644 --- a/jmccc-cli/src/main/java/jmccc/cli/launch/SimpleLauncher.java +++ b/jmccc-cli/src/main/java/jmccc/cli/launch/SimpleLauncher.java @@ -45,7 +45,9 @@ public void onErrorLog(String log) { @Override public void onExit(int code) { - System.out.println(code); + System.out.println("Game exited with " + code); + SimpleDownloader.downloader.shutdown(); + System.exit(0); } } } diff --git a/jmccc-mcdownloader/build.gradle.kts b/jmccc-mcdownloader/build.gradle.kts new file mode 100644 index 0000000..907db9c --- /dev/null +++ b/jmccc-mcdownloader/build.gradle.kts @@ -0,0 +1,15 @@ +dependencies { + api(project(":jmccc")) + implementation("org.tukaani:xz:1.9") + implementation("org.apache.httpcomponents:httpasyncclient:4.1.5") + implementation("org.ehcache.modules:ehcache-impl:3.10.8") + implementation("javax.cache:cache-api:1.1.1") + implementation("org.apache.commons:commons-compress:1.22") + implementation("org.ow2.asm:asm:9.4") +} + +description = "jmccc mcdownloader" + +java { + withJavadocJar() +} diff --git a/jmccc-mcdownloader/pom.xml b/jmccc-mcdownloader/pom.xml deleted file mode 100644 index 26e2f8a..0000000 --- a/jmccc-mcdownloader/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - - dev.3-3 - jmccc-parent - ${revision} - - jmccc-mcdownloader - jmccc mcdownloader - The download feature of jmccc - - - dev.3-3 - jmccc - - - - org.tukaani - xz - 1.5 - - - org.apache.httpcomponents - httpasyncclient - 4.1.5 - true - - - org.ehcache.modules - ehcache-impl - 3.1.1 - true - - - javax.cache - cache-api - 1.0.0 - true - - - org.apache.commons - commons-compress - 1.22 - - - org.ow2.asm - asm - 9.4 - - - - diff --git a/jmccc-mcdownloader/src/main/java/org/to2mbn/jmccc/mcdownloader/download/cache/CachedDownloaderBuilder.java b/jmccc-mcdownloader/src/main/java/org/to2mbn/jmccc/mcdownloader/download/cache/CachedDownloaderBuilder.java index 3551a88..9885310 100644 --- a/jmccc-mcdownloader/src/main/java/org/to2mbn/jmccc/mcdownloader/download/cache/CachedDownloaderBuilder.java +++ b/jmccc-mcdownloader/src/main/java/org/to2mbn/jmccc/mcdownloader/download/cache/CachedDownloaderBuilder.java @@ -1,5 +1,8 @@ package org.to2mbn.jmccc.mcdownloader.download.cache; +import org.ehcache.config.builders.CacheConfigurationBuilder; +import org.ehcache.config.builders.ResourcePoolsBuilder; +import org.ehcache.config.units.MemoryUnit; import org.to2mbn.jmccc.mcdownloader.download.Downloader; import org.to2mbn.jmccc.mcdownloader.download.cache.provider.CacheProvider; import org.to2mbn.jmccc.mcdownloader.download.cache.provider.EhcacheProvider; @@ -8,6 +11,7 @@ import org.to2mbn.jmccc.util.Builders; import java.net.URI; +import java.time.Duration; import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; @@ -22,6 +26,7 @@ public class CachedDownloaderBuilder implements Builder { private static final String DEFAULT_CACHE_HEAP_UNIT = "MB"; protected final Builder underlying; protected Builder> cacheProvider; + protected CachedDownloaderBuilder(Builder underlying) { this.underlying = Objects.requireNonNull(underlying); } @@ -199,10 +204,10 @@ static CacheProvider adapt(org.ehcache.CacheManager manager, boolea static org.ehcache.config.Builder defaultCacheManagerBuilder() { return org.ehcache.config.builders.CacheManagerBuilder.newCacheManagerBuilder() - .withCache(CacheNames.DEFAULT, org.ehcache.config.builders.CacheConfigurationBuilder.newCacheConfigurationBuilder(URI.class, byte[].class, - org.ehcache.config.builders.ResourcePoolsBuilder.newResourcePoolsBuilder() - .heap(DEFAULT_CACHE_HEAP, org.ehcache.config.units.MemoryUnit.valueOf(DEFAULT_CACHE_HEAP_UNIT))) - .withExpiry(org.ehcache.expiry.Expirations.timeToLiveExpiration(new org.ehcache.expiry.Duration(DEFAULT_CACHE_TTL, DEFAULT_CACHE_TTL_UNIT)))); + .withCache(CacheNames.DEFAULT, CacheConfigurationBuilder.newCacheConfigurationBuilder(URI.class, byte[].class, + ResourcePoolsBuilder.newResourcePoolsBuilder() + .heap(DEFAULT_CACHE_HEAP, MemoryUnit.valueOf(DEFAULT_CACHE_HEAP_UNIT))) + .withExpiry(org.ehcache.config.builders.ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(DEFAULT_CACHE_TTL_UNIT.toSeconds(DEFAULT_CACHE_TTL))))); } static CacheProvider createDefault() { diff --git a/jmccc-mojang-api/build.gradle.kts b/jmccc-mojang-api/build.gradle.kts new file mode 100644 index 0000000..e044441 --- /dev/null +++ b/jmccc-mojang-api/build.gradle.kts @@ -0,0 +1,5 @@ +dependencies { + api(project(":jmccc-yggdrasil-authenticator")) +} + +description = "jmccc-mojang-api" \ No newline at end of file diff --git a/jmccc-mojang-api/pom.xml b/jmccc-mojang-api/pom.xml deleted file mode 100644 index 1caeab6..0000000 --- a/jmccc-mojang-api/pom.xml +++ /dev/null @@ -1,18 +0,0 @@ - - 4.0.0 - - dev.3-3 - jmccc-parent - ${revision} - - jmccc-mojang-api - jmccc-mojang-api - JMCCC's Mojang API client - - - dev.3-3 - jmccc-yggdrasil-authenticator - - - - diff --git a/jmccc-yggdrasil-authenticator/build.gradle.kts b/jmccc-yggdrasil-authenticator/build.gradle.kts new file mode 100644 index 0000000..396a474 --- /dev/null +++ b/jmccc-yggdrasil-authenticator/build.gradle.kts @@ -0,0 +1,5 @@ +dependencies { + api(project(":jmccc")) +} + +description = "jmccc yggdrasil authenticator" \ No newline at end of file diff --git a/jmccc-yggdrasil-authenticator/pom.xml b/jmccc-yggdrasil-authenticator/pom.xml deleted file mode 100644 index fccd326..0000000 --- a/jmccc-yggdrasil-authenticator/pom.xml +++ /dev/null @@ -1,18 +0,0 @@ - - 4.0.0 - - dev.3-3 - jmccc-parent - ${revision} - - jmccc-yggdrasil-authenticator - jmccc yggdrasil authenticator - The yggdrasil authentication feature of jmccc - - - dev.3-3 - jmccc - - - - diff --git a/jmccc/build.gradle.kts b/jmccc/build.gradle.kts new file mode 100644 index 0000000..f3fe967 --- /dev/null +++ b/jmccc/build.gradle.kts @@ -0,0 +1 @@ +description = "jmccc" \ No newline at end of file diff --git a/jmccc/pom.xml b/jmccc/pom.xml deleted file mode 100644 index fda19e8..0000000 --- a/jmccc/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - - dev.3-3 - jmccc-parent - ${revision} - - jmccc - jmccc - The launching feature of jmccc - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - diff --git a/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONArray.java b/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONArray.java index ec2fc8e..fac3b0e 100644 --- a/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONArray.java +++ b/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONArray.java @@ -704,7 +704,7 @@ public JSONArray put(Collection value) { * @throws JSONException if the value is not finite. */ public JSONArray put(double value) throws JSONException { - Double d = new Double(value); + Double d = Double.valueOf(value); JSONObject.testValidity(d); this.put(d); return this; @@ -717,7 +717,7 @@ public JSONArray put(double value) throws JSONException { * @return this. */ public JSONArray put(int value) { - this.put(new Integer(value)); + this.put(Integer.valueOf(value)); return this; } @@ -728,7 +728,7 @@ public JSONArray put(int value) { * @return this. */ public JSONArray put(long value) { - this.put(new Long(value)); + this.put(Long.valueOf(value)); return this; } @@ -799,7 +799,7 @@ public JSONArray put(int index, Collection value) throws JSONException { * finite. */ public JSONArray put(int index, double value) throws JSONException { - this.put(index, new Double(value)); + this.put(index, Double.valueOf(value)); return this; } @@ -814,7 +814,7 @@ public JSONArray put(int index, double value) throws JSONException { * @throws JSONException If the index is negative. */ public JSONArray put(int index, int value) throws JSONException { - this.put(index, new Integer(value)); + this.put(index, Integer.valueOf(value)); return this; } @@ -829,7 +829,7 @@ public JSONArray put(int index, int value) throws JSONException { * @throws JSONException If the index is negative. */ public JSONArray put(int index, long value) throws JSONException { - this.put(index, new Long(value)); + this.put(index, Long.valueOf(value)); return this; } diff --git a/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONObject.java b/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONObject.java index 0810261..ff9dbd7 100644 --- a/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONObject.java +++ b/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONObject.java @@ -469,7 +469,7 @@ public static Object stringToValue(String string) { return d; } } else { - Long myLong = new Long(string); + Long myLong = Long.valueOf(string); if (string.equals(myLong.toString())) { if (myLong.longValue() == myLong.intValue()) { return Integer.valueOf(myLong.intValue()); @@ -1322,7 +1322,7 @@ public JSONObject put(String key, Collection value) throws JSONException { * @throws JSONException If the key is null or if the number is invalid. */ public JSONObject put(String key, double value) throws JSONException { - this.put(key, new Double(value)); + this.put(key, Double.valueOf(value)); return this; } @@ -1335,7 +1335,7 @@ public JSONObject put(String key, double value) throws JSONException { * @throws JSONException If the key is null. */ public JSONObject put(String key, int value) throws JSONException { - this.put(key, new Integer(value)); + this.put(key, Integer.valueOf(value)); return this; } @@ -1348,7 +1348,7 @@ public JSONObject put(String key, int value) throws JSONException { * @throws JSONException If the key is null. */ public JSONObject put(String key, long value) throws JSONException { - this.put(key, new Long(value)); + this.put(key, Long.valueOf(value)); return this; } diff --git a/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONWriter.java b/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONWriter.java index 9fb4f6f..e013645 100644 --- a/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONWriter.java +++ b/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONWriter.java @@ -310,7 +310,7 @@ public JSONWriter value(boolean b) throws JSONException { * @throws JSONException If the number is not finite. */ public JSONWriter value(double d) throws JSONException { - return this.value(new Double(d)); + return this.value(Double.valueOf(d)); } /** diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 03db939..0000000 --- a/pom.xml +++ /dev/null @@ -1,235 +0,0 @@ - - 4.0.0 - dev.3-3 - ${revision} - jmccc-parent - https://github.com/xfl03/JMCCC - pom - jmccc-parent - JMCCC is a powerful open-source library for launching and downloading Minecraft. - - UTF-8 - 1.8 - 1.8 - 3.0-SNAPSHOT - - - https://github.com/xfl03/JMCCC/issues - GitHub Issues - - - - MIT - https://github.com/xfl03/JMCCC/LICENSE - repo - - The MIT License (MIT) - - Copyright (c) 2016 to2mbn - - 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. - - - - - https://github.com/xfl03/JMCCC - scm:git:git://github.com/xfl03/JMCCC.git - scm:git:git@github.com:xfl03/JMCCC.git - master - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - 2569766005@qq.com - Qiyun Zhou - https://github.com/darkyoooooo - darkyoooooo - - - yushijinhun@gmail.com - Haowei Wen - https://github.com/yushijinhun - yushijinhun - - - moe@3-3.dev - xfl03 - https://github.com/xfl03 - xfl03 - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.2 - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-source-plugin - 2.4 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - - attach-javadocs - - jar - - - - - en_US - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.6 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - UTF-8 - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - true - true - false - @{project.version} - - - - org.apache.felix - maven-bundle-plugin - 3.0.1 - true - - - org.to2mbn.jmccc.* - - - - - bundle-manifest - process-classes - - manifest - - - - - - - - - junit - junit - 4.13.1 - test - - - - - - dev.3-3 - jmccc - ${revision} - - - dev.3-3 - jmccc-mcdownloader - ${revision} - - - dev.3-3 - jmccc-yggdrasil-authenticator - ${revision} - - - dev.3-3 - jmccc-mojang-api - ${revision} - - - - - jmccc - jmccc-yggdrasil-authenticator - jmccc-mcdownloader - jmccc-mojang-api - jmccc-cli - - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..06f7e48 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,18 @@ +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} + +pluginManagement { + plugins { + id("com.github.johnrengelman.shadow") version "7.1.2" + } +} + +rootProject.name = "jmccc-parent" +include(":jmccc-yggdrasil-authenticator") +include(":jmccc-mojang-api") +include(":jmccc") +include(":jmccc-mcdownloader") +include(":jmccc-cli")