diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c097e..5f5abaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +#### v0.5.0 +\* Rewrote the buildscript and updated dependencies +\* Replaced the local static blog with an [updated online one](https://halotroop.github.io/MCUpdate) + #### v0.4.5 \* Fixed the resource proxy not working on old alpha versions. diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 23b841d..0000000 --- a/build.gradle +++ /dev/null @@ -1,70 +0,0 @@ -plugins { - id 'com.github.johnrengelman.shadow' version '5.2.0' - id 'java' -} - -allprojects{ - repositories { - mavenLocal() - jcenter() - maven { url "https://jitpack.io" } - maven { url "https://maven.glass-launcher.net/repo"} - } -} - -dependencies { - testCompile group: 'junit', name: 'junit', version: '4.12' - - compileOnly 'org.projectlombok:lombok:1.18.10' - annotationProcessor 'org.projectlombok:lombok:1.18.10' - - // https://github.com/adamfisk/LittleProxy/releases/download - testCompile group: 'org.littleshoot', name: 'littleproxy', version: '1.1.2' - // https://repo1.maven.org/maven2/com/github/ganskef/littleproxy-mitm - compile group: 'com.github.ganskef', name: 'littleproxy-mitm', version: '1.1.0' - // https://repo1.maven.org/maven2/com/google/code/gson/gson - implementation 'com.google.code.gson:gson:2.8.6' - // https://mvnrepository.com/artifact/commons-validator/commons-validator - compile group: 'commons-validator', name: 'commons-validator', version: '1.6' - - - compile group: "net.glasslauncher.repo", name: "glass-site-java-api", version: "0.2" - compile group: "net.glasslauncher", name: "commons", version: "1.0" - -} - -group 'glass-launcher' -version '0.4.5' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() -} - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -task listrepos { - doLast { - println "Repositories:" - project.repositories.each { println "Name: " + it.name + "; url: " + it.url } - } -} - -jar { - manifest { - attributes 'Implementation-Title': 'Gradle Quickstart', - 'Implementation-Version': version, - 'Main-Class': 'net.glasslauncher.legacy.Main' - } - - /*from { - configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } - }*/ - - from { - "dependencies.gradle" - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..9bad827 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,36 @@ +plugins { + java + application + alias(libs.plugins.shadow) + alias(libs.plugins.lombok) +} + +repositories { + mavenLocal() + maven("https://maven.glass-launcher.net/releases") + maven("https://maven.glass-launcher.net/snapshots") +} + +dependencies { + implementation(libs.bundles.implementation) +} + +group = "net.glass-launcher" +version = "0.5.0" + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +repositories { + mavenCentral() +} + +tasks.withType() { + options.encoding = "UTF-8" +} + +application { + mainClass = "net.glasslauncher.legacy.Main" +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..a5ebc62 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,31 @@ +[versions] +# Plugins +shadow = "9.0.0-rc1" +lombok-plugin = "8.14" +# Libraries +lombok = "1.18.38" +littleproxy = "1.1.2" +littleproxy-mitm = "1.1.0" +gson = "2.9.1" +commons-validator = "1.6" +glass-site-java-api = "0.7" +glasslauncher-commons = "1.4" + +[plugins] +shadow = { id = "com.gradleup.shadow", version.ref = "shadow" } +lombok = { id = "io.freefair.lombok", version.ref = "lombok-plugin" } + +[libraries] +littleproxy = { module = "org.littleshoot:littleproxy", version.ref = "littleproxy" } +littleproxy-mitm = { module = "com.github.ganskef:littleproxy-mitm", version.ref = "littleproxy-mitm" } +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +commons-validator = { module = "commons-validator:commons-validator", version.ref = "commons-validator" } +glass-site-java-api = { module = "net.glasslauncher.repo:glass-site-java-api", version.ref = "glass-site-java-api" } +glasslauncher-commons = { module = "net.glasslauncher:commons", version.ref = "glasslauncher-commons" } + +[bundles] +implementation = [ + "littleproxy", "littleproxy-mitm", + "gson", "commons-validator", + "glass-site-java-api", "glasslauncher-commons" +] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 87b738c..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cf17258..ff23a68 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Sun Oct 06 22:13:54 BST 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index af6708f..23d15a9 100644 --- a/gradlew +++ b/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/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. +# +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# 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/platforms/jvm/plugins-application/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 -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -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='"-Xmx64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +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 - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +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 +CLASSPATH="\\\"\\\"" + # 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" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,92 +132,120 @@ 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. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + 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 fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +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=SC2039,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=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -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" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + 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 - i=$((i+1)) + # 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 - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# 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")" +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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 index 6d57edc..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,22 @@ -@if "%DEBUG%" == "" @echo off +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -9,25 +27,29 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +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" +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%" == "0" goto init +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. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -35,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +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. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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 diff --git a/l4jconfig.xml b/l4jconfig.xml index 7c7dda7..ae0138e 100644 --- a/l4jconfig.xml +++ b/l4jconfig.xml @@ -2,8 +2,8 @@ false gui - build\libs\glass-launcher-legacy-0.4.5-all.jar - build\libs\glass-launcher-legacy-0.4.5.exe + build\libs\glass-launcher-legacy-0.5.0-all.jar + build\libs\glass-launcher-legacy-0.5.0.exe diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 023b052..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'glass-launcher-legacy' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..34b00ae --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "glass-launcher" diff --git a/src/main/java/net/glasslauncher/legacy/Config.java b/src/main/java/net/glasslauncher/legacy/Config.java index d97fc67..b25a954 100644 --- a/src/main/java/net/glasslauncher/legacy/Config.java +++ b/src/main/java/net/glasslauncher/legacy/Config.java @@ -20,9 +20,9 @@ public class Config { public static void loadConfigFiles() { Gson gson = new Gson(); mcVersions = gson.fromJson(new InputStreamReader(Main.class.getResourceAsStream("assets/mcversions.json")), MCVersions.class); - launcherConfig = (LauncherConfig) JsonConfig.loadConfig(CommonConfig.GLASS_PATH + "launcher_config.json", LauncherConfig.class); + launcherConfig = (LauncherConfig) JsonConfig.loadConfig(CommonConfig.getGlassPath() + "launcher_config.json", LauncherConfig.class); if (launcherConfig == null) { - launcherConfig = new LauncherConfig(CommonConfig.GLASS_PATH + "launcher_config.json"); + launcherConfig = new LauncherConfig(CommonConfig.getGlassPath() + "launcher_config.json"); } } @@ -72,12 +72,12 @@ public static void loadConfigFiles() { /** * The version of the launcher. */ - public static final String VERSION = "v0.4.5"; + public static final String VERSION = "v0.5.0"; /** * The path of the launcher's cache files. */ - public static final String CACHE_PATH = CommonConfig.GLASS_PATH + "cache/"; + public static final String CACHE_PATH = CommonConfig.getGlassPath() + "cache/"; /** * The path of the Java binary running the launcher. @@ -129,7 +129,7 @@ public static String getInstancePath(String instance) throws IllegalArgumentExce if (instance == null || instance.isEmpty()) { throw new IllegalArgumentException("Instance cannot be empty or null!"); } - return CommonConfig.GLASS_PATH + "instances/" + instance + "/"; + return CommonConfig.getGlassPath() + "instances/" + instance + "/"; } @Getter private static final Map GLASS_DEPS = Collections.unmodifiableMap(new HashMap() {{ diff --git a/src/main/java/net/glasslauncher/legacy/InstanceManagerWindow.java b/src/main/java/net/glasslauncher/legacy/InstanceManagerWindow.java index f04cbd6..1fd7c46 100644 --- a/src/main/java/net/glasslauncher/legacy/InstanceManagerWindow.java +++ b/src/main/java/net/glasslauncher/legacy/InstanceManagerWindow.java @@ -145,7 +145,7 @@ private JPanel makeCreateTab() { instanceFolderButton.addActionListener((e) -> { Main.getLogger().info("Opening instances folder..."); try { - Desktop.getDesktop().open(new File(CommonConfig.GLASS_PATH + "instances")); + Desktop.getDesktop().open(new File(CommonConfig.getGlassPath(), "instances")); } catch (IOException ex) { ex.printStackTrace(); } @@ -173,10 +173,10 @@ private JScrollPane makeDeleteTab() { } private void updateInstanceList() { - (new File(CommonConfig.GLASS_PATH + "instances")).mkdirs(); + (new File(CommonConfig.getGlassPath() + "instances")).mkdirs(); deletePanel.removeAll(); deletePanel.repaint(); - for (File instance : (Objects.requireNonNull(new File(CommonConfig.GLASS_PATH + "instances").listFiles()))) { + for (File instance : (Objects.requireNonNull(new File(CommonConfig.getGlassPath(), "instances").listFiles()))) { if (instance.isDirectory()) { ScalingButton deleteButton = new ScalingButton(); deleteButton.setText("Delete \"" + instance.getName() + "\"."); diff --git a/src/main/java/net/glasslauncher/legacy/Main.java b/src/main/java/net/glasslauncher/legacy/Main.java index 9490e28..037778d 100644 --- a/src/main/java/net/glasslauncher/legacy/Main.java +++ b/src/main/java/net/glasslauncher/legacy/Main.java @@ -3,16 +3,16 @@ import lombok.Getter; import net.glasslauncher.common.CommonConfig; import net.glasslauncher.common.FileUtils; -import net.glasslauncher.repo.api.mod.RepoReader; +import net.glasslauncher.common.LoggerFactory; import javax.swing.UIManager; import java.util.ArrayList; import java.util.logging.Logger; public class Main { - @Getter private static Logger logger = CommonConfig.makeLogger("GlassLauncher", "glass-launcher"); - private static ArrayList libs = new ArrayList<>(); - public static MainWindow mainwin; + @Getter private static final Logger logger = LoggerFactory.makeLogger("GlassLauncher", "glass-launcher"); + private static final ArrayList libs = new ArrayList<>(); + public static MainWindow mainWindow; public static void main(String[] args) { try { @@ -53,21 +53,21 @@ public static void main(String[] args) { } catch (Exception e) { e.printStackTrace(); }*/ - mainwin = new MainWindow(console); + mainWindow = new MainWindow(console); } /** * Downloads all dependencies listed in Config.Deps.cactusDeps. */ private static void getDeps() { - getLogger().info("Checking dependencies..."); + logger.info("Checking dependencies..."); for (String dep : Config.getGLASS_DEPS().keySet()) { try { - FileUtils.downloadFile(dep, CommonConfig.GLASS_PATH + "/lib/", Config.getGLASS_DEPS().get(dep)); + FileUtils.downloadFile(dep, CommonConfig.getGlassPath() + "/lib/", Config.getGLASS_DEPS().get(dep)); libs.add(dep.substring(dep.lastIndexOf('/') + 1)); } catch (Exception e) { - getLogger().info("Failed to download dependency. Invalid formatting?"); + logger.info("Failed to download dependency. Invalid formatting?"); e.printStackTrace(); } } @@ -79,6 +79,6 @@ private static void getDeps() { * @return True if active, False otherwise. */ public static boolean isLauncherActive() { - return mainwin != null; + return mainWindow != null; } } diff --git a/src/main/java/net/glasslauncher/legacy/MainWindow.java b/src/main/java/net/glasslauncher/legacy/MainWindow.java index ae0ed1a..e421041 100644 --- a/src/main/java/net/glasslauncher/legacy/MainWindow.java +++ b/src/main/java/net/glasslauncher/legacy/MainWindow.java @@ -28,14 +28,12 @@ import java.awt.Panel; import java.awt.Rectangle; import java.awt.Toolkit; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.io.File; -import java.util.Scanner; +import java.io.*; +import java.net.URL; -class MainWindow extends JFrame { +public class MainWindow extends JFrame { private int orgWidth = 854; private int orgHeight = 480; @@ -176,12 +174,15 @@ public void windowOpened(WindowEvent e){ setVisible(true); } - private JScrollPane makeBlog() { - String page = new Scanner(MainWindow.class.getResourceAsStream("assets/blog.html"), "UTF-8").useDelimiter("\\A").next(); - page = page.replaceAll("\\$\\{root}\\$", MainWindow.class.getResource("assets/").toString()); + private JScrollPane makeBlog() { JTextPane blog = new JTextPane(); - blog.setContentType("text/html"); - blog.setText(page); + try { + blog.setPage(new URL("https://halotroop2288.github.io/MCUpdate")); + blog.setContentType("text/html"); + } catch (Throwable ignored) { + Main.getLogger().warning("Couldn't load MCUpdate Blog."); + } + blog.setBorder(BorderFactory.createEmptyBorder()); blog.setEditable(false); blog.addHyperlinkListener(event -> { @@ -193,16 +194,16 @@ private JScrollPane makeBlog() { } } }); - JScrollPane blogcontainer = new JScrollPane(blog); - blogcontainer.setBorder(BorderFactory.createEmptyBorder()); - blogcontainer.setBounds(new Rectangle(0, 0, mainPanel.getWidth(), mainPanel.getHeight() - 200)); - return blogcontainer; + JScrollPane blogContainer = new JScrollPane(blog); + blogContainer.setBorder(BorderFactory.createEmptyBorder()); + blogContainer.setBounds(new Rectangle(0, 0, mainPanel.getWidth(), mainPanel.getHeight() - 200)); + return blogContainer; } public void refreshInstanceList() { Main.getLogger().info("Refreshing instance list..."); instsel.setModel(new DefaultComboBoxModel<>()); - File file = new File(CommonConfig.GLASS_PATH + "instances"); + File file = new File(CommonConfig.getGlassPath() + "instances"); String[] instances = file.list((current, name) -> new File(current, name).isDirectory()); String lastUsedInstance = Config.getLauncherConfig().getLastUsedInstance(); boolean exists = false; diff --git a/src/main/java/net/glasslauncher/legacy/OpenLinkWindow.java b/src/main/java/net/glasslauncher/legacy/OpenLinkWindow.java index a76bd5d..fef427a 100644 --- a/src/main/java/net/glasslauncher/legacy/OpenLinkWindow.java +++ b/src/main/java/net/glasslauncher/legacy/OpenLinkWindow.java @@ -12,8 +12,6 @@ public class OpenLinkWindow extends JOptionPane { /** * Used to make a pop-up clickable link. - * @param comp - * @param url */ OpenLinkWindow(Component comp, String url) { JLabel label = new JLabel(); diff --git a/src/main/java/net/glasslauncher/legacy/OptionsWindow.java b/src/main/java/net/glasslauncher/legacy/OptionsWindow.java index 0622ba8..8fd3522 100644 --- a/src/main/java/net/glasslauncher/legacy/OptionsWindow.java +++ b/src/main/java/net/glasslauncher/legacy/OptionsWindow.java @@ -63,7 +63,7 @@ public OptionsWindow(Frame panel, String instance) { add(this.panel); instName = instance; - instpath = CommonConfig.GLASS_PATH + "instances/" + instance + "/"; + instpath = CommonConfig.getGlassPath() + "instances/" + instance + "/"; if (!(new File(instpath)).exists()) { JOptionPane.showMessageDialog(this, "Selected instance does not exist, or one hasn't been selected.", "Warning", JOptionPane.WARNING_MESSAGE); return; diff --git a/src/main/java/net/glasslauncher/legacy/ProxyStandalone.java b/src/main/java/net/glasslauncher/legacy/ProxyStandalone.java index e71c391..c430e92 100644 --- a/src/main/java/net/glasslauncher/legacy/ProxyStandalone.java +++ b/src/main/java/net/glasslauncher/legacy/ProxyStandalone.java @@ -7,7 +7,6 @@ public class ProxyStandalone { /** * Main function of the standalone proxy - * @param args */ public static void main(String[] args) { boolean doSound = false; @@ -15,15 +14,20 @@ public static void main(String[] args) { boolean doCape = false; boolean doLogin = false; for (String arg : args) { - if (arg.toLowerCase().equals("-dosound")) { - doSound = true; - } else if (arg.toLowerCase().equals("-doskin")) { - doSkin = true; - } else if (arg.toLowerCase().equals("-docape")) { - doCape = true; - } else if (arg.toLowerCase().equals("-dologin")) { - doLogin = true; - } + switch (arg.toLowerCase()) { + case "-dosound": + doSound = true; + break; + case "-doskin": + doSkin = true; + break; + case "-docape": + doCape = true; + break; + case "-dologin": + doLogin = true; + break; + } } if (!doSound && !doSkin && !doCape && !doLogin) { Main.getLogger().info("No proxy arguments provided! Defaulting to all enabled."); @@ -36,7 +40,12 @@ public static void main(String[] args) { } catch (Exception e) { e.printStackTrace(); } - Proxy proxy = new Proxy(new boolean[]{doSound, doSkin, doCape, doLogin}); + Proxy proxy = new Proxy(new boolean[]{doSound, doSkin, doCape, doLogin}) { + @Override + public void run() { + super.run(); + } + }; proxy.start(); } } diff --git a/src/main/java/net/glasslauncher/legacy/VerifyAccountWindow.java b/src/main/java/net/glasslauncher/legacy/VerifyAccountWindow.java index 4768950..2c5faff 100644 --- a/src/main/java/net/glasslauncher/legacy/VerifyAccountWindow.java +++ b/src/main/java/net/glasslauncher/legacy/VerifyAccountWindow.java @@ -14,8 +14,6 @@ import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Window; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; public class VerifyAccountWindow extends JDialog { @Getter boolean loginValid = false; diff --git a/src/main/java/net/glasslauncher/legacy/components/DragDropHandler.java b/src/main/java/net/glasslauncher/legacy/components/DragDropHandler.java index 7efe00c..018f246 100644 --- a/src/main/java/net/glasslauncher/legacy/components/DragDropHandler.java +++ b/src/main/java/net/glasslauncher/legacy/components/DragDropHandler.java @@ -1,5 +1,7 @@ package net.glasslauncher.legacy.components; +import net.glasslauncher.legacy.jsontemplate.Mod; + import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.TransferHandler; @@ -31,8 +33,8 @@ public boolean importData(TransferSupport support) { int draggedImageIndex = Integer.parseInt((String) transferable.getTransferData(DataFlavor.stringFlavor)); JList.DropLocation dl = (JList.DropLocation) support.getDropLocation(); - DefaultListModel model = list.model; - Object draggedObject = model.get(draggedImageIndex); + DefaultListModel model = list.model; + Mod draggedObject = model.get(draggedImageIndex); int dropIndex = dl.getIndex(); if (model.indexOf(draggedObject) < dropIndex) { dropIndex--; diff --git a/src/main/java/net/glasslauncher/legacy/components/DragDropList.java b/src/main/java/net/glasslauncher/legacy/components/DragDropList.java index 3cbd579..628b186 100644 --- a/src/main/java/net/glasslauncher/legacy/components/DragDropList.java +++ b/src/main/java/net/glasslauncher/legacy/components/DragDropList.java @@ -10,11 +10,11 @@ import java.awt.Component; import java.util.ArrayList; -public class DragDropList extends JList { +public class DragDropList extends JList { public DefaultListModel model; public DragDropList(ArrayList list) { - super(new DefaultListModel()); + super(new DefaultListModel<>()); model = (DefaultListModel) getModel(); for (Mod element : list) { model.addElement(element); diff --git a/src/main/java/net/glasslauncher/legacy/components/HintPasswordField.java b/src/main/java/net/glasslauncher/legacy/components/HintPasswordField.java index 203f2cc..125ae71 100644 --- a/src/main/java/net/glasslauncher/legacy/components/HintPasswordField.java +++ b/src/main/java/net/glasslauncher/legacy/components/HintPasswordField.java @@ -55,11 +55,7 @@ public void setText(String text) { } public char[] getPassword() { - if (defaultColor != getForeground() && super.getText().equals(hint)) { - return new char[]{}; - } - else { - return super.getPassword(); - } + return defaultColor != getForeground() && Arrays.equals(super.getPassword(), hint.toCharArray()) + ? new char[]{} : super.getPassword(); } } \ No newline at end of file diff --git a/src/main/java/net/glasslauncher/legacy/components/JBackgroundImageTabbedPane.java b/src/main/java/net/glasslauncher/legacy/components/JBackgroundImageTabbedPane.java index f049ece..4ffa570 100644 --- a/src/main/java/net/glasslauncher/legacy/components/JBackgroundImageTabbedPane.java +++ b/src/main/java/net/glasslauncher/legacy/components/JBackgroundImageTabbedPane.java @@ -7,7 +7,6 @@ import java.net.URL; public class JBackgroundImageTabbedPane extends JTabbedPane { - private BufferedImage tileImage; public JBackgroundImageTabbedPane(URL imagePath) { diff --git a/src/main/java/net/glasslauncher/legacy/components/ScalingButton.java b/src/main/java/net/glasslauncher/legacy/components/ScalingButton.java index 2203f6e..7a9818a 100644 --- a/src/main/java/net/glasslauncher/legacy/components/ScalingButton.java +++ b/src/main/java/net/glasslauncher/legacy/components/ScalingButton.java @@ -4,7 +4,6 @@ import java.awt.Insets; public class ScalingButton extends JButton { - /** * Creates a button with no set text or icon. */ diff --git a/src/main/java/net/glasslauncher/legacy/mc/LaunchArgs.java b/src/main/java/net/glasslauncher/legacy/mc/LaunchArgs.java index 4e4c449..cc2d181 100644 --- a/src/main/java/net/glasslauncher/legacy/mc/LaunchArgs.java +++ b/src/main/java/net/glasslauncher/legacy/mc/LaunchArgs.java @@ -3,14 +3,12 @@ import com.google.gson.Gson; import net.glasslauncher.common.CommonConfig; import net.glasslauncher.legacy.jsontemplate.InstanceConfig; -import net.glasslauncher.legacy.Config; import net.glasslauncher.legacy.Main; import net.glasslauncher.legacy.jsontemplate.LoginCreds; import net.glasslauncher.legacy.jsontemplate.LoginResponse; import net.glasslauncher.legacy.jsontemplate.LoginResponseAgent; import javax.swing.JOptionPane; -import javax.xml.ws.http.HTTPException; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -40,7 +38,7 @@ public String[] getArgs(String[] args) { return null; } String instance = args[2]; - instpath = CommonConfig.GLASS_PATH + "instances/" + instance; + instpath = CommonConfig.getGlassPath() + "instances/" + instance; try { if (!(new File(instpath, "instance_config.json")).exists()) { instjson = new InstanceConfig(instpath + "/instance_config.json"); @@ -101,7 +99,7 @@ public String[] login(String username, String password) { Main.getLogger().severe("Error sending request!"); Main.getLogger().severe("Code: " + req.getResponseCode()); Main.getLogger().severe("Error: " + session.getError()); - throw new HTTPException(req.getResponseCode()); + throw new Exception("HTTP Error: " + req.getResponseCode()); } LoginResponseAgent profile = session.getSelectedProfile(); return new String[]{session.getAccessToken(), profile.getName()}; diff --git a/src/main/java/net/glasslauncher/legacy/mc/Wrapper.java b/src/main/java/net/glasslauncher/legacy/mc/Wrapper.java index a8e7b56..6526e9b 100644 --- a/src/main/java/net/glasslauncher/legacy/mc/Wrapper.java +++ b/src/main/java/net/glasslauncher/legacy/mc/Wrapper.java @@ -25,7 +25,7 @@ public Wrapper(String[] launchArgs) { Main.getLogger().severe("Got " + launchArgs.length + " args, expected 5."); } this.instance = launchArgs[4]; - String instPath = CommonConfig.GLASS_PATH + "instances/" + instance + "/.minecraft"; + String instPath = CommonConfig.getGlassPath() + "instances/" + instance + "/.minecraft"; this.getConfig(); @@ -52,7 +52,7 @@ public Wrapper(String[] launchArgs) { args.add("-Xmx" + instJson.getMaxRam()); args.add("-Xms" + instJson.getMinRam()); args.add("-jar"); - args.add(CommonConfig.GLASS_PATH + "lib/" + Config.getEasyMineLauncherFile()); + args.add(CommonConfig.getGlassPath() + "lib/" + Config.getEasyMineLauncherFile()); args.add("--lwjgl-dir=" + instPath + "/bin"); args.add("--jar=" + instPath + "/bin/minecraft.jar"); args.add("--native-dir=" + instPath + "/bin/natives"); @@ -65,7 +65,7 @@ public Wrapper(String[] launchArgs) { } private void getConfig() { - String instPath = CommonConfig.GLASS_PATH + "instances/" + instance; + String instPath = CommonConfig.getGlassPath() + "instances/" + instance; File confFile = new File(instPath + "/instance_config.json"); if (!confFile.exists()) { @@ -88,7 +88,7 @@ public void startMC() { ProcessBuilder mcInit = new ProcessBuilder(args); Map mcEnv = mcInit.environment(); - String newAppData = CommonConfig.GLASS_PATH + "instances/" + instance; + String newAppData = CommonConfig.getGlassPath() + "instances/" + instance; mcEnv.put("appdata", newAppData); mcEnv.put("home", newAppData); mcEnv.put("user.home", newAppData); diff --git a/src/main/java/net/glasslauncher/legacy/util/InstanceManager.java b/src/main/java/net/glasslauncher/legacy/util/InstanceManager.java index 26d7137..cf2b826 100644 --- a/src/main/java/net/glasslauncher/legacy/util/InstanceManager.java +++ b/src/main/java/net/glasslauncher/legacy/util/InstanceManager.java @@ -34,7 +34,7 @@ public class InstanceManager { /** - * Detects what kind of modpack zip has been provided and then calls the related install function for the type. + * Detects what kind of modpack zip has been provided and then calls the related installation function for the type. * @param path Path to instance zip file. */ public static void installModpack(String path, ProgressWindow progressWindow) { @@ -87,7 +87,7 @@ private static void installModpackZip(String path, String filename, ProgressWind } } - if ((new File(CommonConfig.GLASS_PATH + "instances/" + instanceName)).exists()) { + if ((new File(CommonConfig.getGlassPath() + "instances/" + instanceName)).exists()) { Main.getLogger().info("Instance \"" + instanceName + "\" already exists!"); return; } @@ -178,17 +178,15 @@ public static void createBlankInstance(String version, String instance, Progress return; } } - } - else if (version.equals("custom")) {} - else { - try { - FileUtils.delete(new File(minecraftFolder)); - } catch (Exception e) { - e.printStackTrace(); - } - } + } else if (!version.equals("custom")) { + try { + FileUtils.delete(new File(minecraftFolder)); + } catch (Exception e) { + e.printStackTrace(); + } + } - progressWindow.increaseProgress(); + progressWindow.increaseProgress(); progressWindow.setProgressText("Adding sounds..."); addSounds(instance); progressWindow.increaseProgress(); @@ -218,7 +216,7 @@ else if (moddedJar.exists()) { } zips.add(vanillaJar); FileUtils.mergeZips(moddedJar, zips); - FileSystem jarFs = FileSystems.newFileSystem(moddedJar.toPath(), null); + FileSystem jarFs = FileSystems.newFileSystem(moddedJar.toPath(), (ClassLoader) null); try { Files.delete(jarFs.getPath("META-INF/MOJANG_C.DSA")); Files.delete(jarFs.getPath("META-INF/MOJANG_C.SF")); @@ -250,14 +248,14 @@ private static void importMultiMC(TempZipFile mmcZip, String instance, String mm if (component.isImportant()) { instanceConfig.setVersion(component.getCachedVersion()); } - else if (component.isDependencyOnly() || (component.getUid().equals("customjar") && component.isDisabled())) {} - else if (component.getUid().equals("customjar") && !component.isDisabled()) { - hasCustomJar = true; - } - else if (component.getCachedName() != null) { - modList.getJarMods().add(modList.getJarMods().size(), new Mod(component.getUid().replace("org.multimc.jarmod.", "") + ".jar", component.getCachedName(), 0, !component.isDisabled())); - } - } + else if (!component.isDependencyOnly() && (!component.getUid().equals("customjar") || !component.isDisabled())) { + if (component.getUid().equals("customjar") && !component.isDisabled()) { + hasCustomJar = true; + } else if (component.getCachedName() != null) { + modList.getJarMods().add(modList.getJarMods().size(), new Mod(component.getUid().replace("org.multimc.jarmod.", "") + ".jar", component.getCachedName(), 0, !component.isDisabled())); + } + } + } createBlankInstance(instanceConfig.getVersion(), instance, progressWindow); if (!(new File(instPath)).exists()) { @@ -271,7 +269,7 @@ else if (component.getCachedName() != null) { for (Mod mod : modList.getJarMods()) { try { - org.apache.commons.io.FileUtils.copyFile(mmcZip.getFile(mmcZipInstDir + "/jarmods/" + mod.getFileName()), new File(instPath + "/mods/" + mod.getFileName())); + Files.copy(mmcZip.getFile(mmcZipInstDir + "/jarmods/" + mod.getFileName()).toPath(), new File(instPath + "/mods/" + mod.getFileName()).toPath()); } catch (Exception e) { e.printStackTrace(); } @@ -331,7 +329,7 @@ private static void addSounds(String instance) { try { for (MinecraftResource minecraftResource : minecraftResources.getFiles()) { File file = new File(basePath + minecraftResource.getFile()); - File cacheFile = new File(CommonConfig.GLASS_PATH + "cache/resources/" + minecraftResource.getFile()); + File cacheFile = new File(CommonConfig.getGlassPath(), "cache/resources/" + minecraftResource.getFile()); String md5 = minecraftResource.getMd5(); String url = baseURL + minecraftResource.getFile().replace(" ", "%20"); diff --git a/src/main/java/net/glasslauncher/legacy/util/TempZipFile.java b/src/main/java/net/glasslauncher/legacy/util/TempZipFile.java index bbf23ad..3e9ae8f 100644 --- a/src/main/java/net/glasslauncher/legacy/util/TempZipFile.java +++ b/src/main/java/net/glasslauncher/legacy/util/TempZipFile.java @@ -20,7 +20,7 @@ public class TempZipFile { public TempZipFile(String zipFilePath) { File zipFile = new File(zipFilePath); originalPath = zipFilePath; - tempPath = CommonConfig.GLASS_PATH + "temp/" + zipFile.getName(); + tempPath = CommonConfig.getGlassPath() + "temp/" + zipFile.getName(); File tempFile = new File(destDirBypass + tempPath); if (tempFile.exists()) { try { diff --git a/src/main/resources/net/glasslauncher/legacy/assets/blog.css b/src/main/resources/net/glasslauncher/legacy/assets/blog.css deleted file mode 100644 index a47290e..0000000 --- a/src/main/resources/net/glasslauncher/legacy/assets/blog.css +++ /dev/null @@ -1,43 +0,0 @@ -body { - font-family: sans-serif; - background-color: #222222; - background-image: url("blogbackground.png"); - color: #e0d0d0; - margin: 0; -} - -a { - color: #aaaaff; - cursor: pointer; -} - -hr { - border: 0; - color: #111111; - background-color: #111111; - height: 2px; -} - -h3 { - color: #ffffff; - font-size: 16px; -} - -img { - border: 0; - margin: 0; -} - -.sidebar { - padding: 10px; - vertical-align: top; - width: 100px; -} - -.alert { - background-color: #aa0000; - color: #ffffff; - font-weight: bold; - padding: 6px 10px; - width: 500px; -} diff --git a/src/main/resources/net/glasslauncher/legacy/assets/blog.html b/src/main/resources/net/glasslauncher/legacy/assets/blog.html deleted file mode 100644 index ed7f7c7..0000000 --- a/src/main/resources/net/glasslauncher/legacy/assets/blog.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - -
- - - - -
-

Minecraft News

-
-
-
-
-
-

Minecraft Beta 1.7.3

-

Bug fixes, bug fixes and bug fixes.

-

- Corrected a block duplication bug when using pistons
- Corrected a redstone torch duplication bug when using pistons
- Corrected a client crash when placing a sign in front of the piston, powering the piston and then removing the block beneath the sign
- Ice blocks are now pushed without causing water streams breaking everything
- Booster rails are no longer being powered magically without a power source
- Pistons connected to the end of a piston-transistor via redstone are now properly closed when the power goes out
- Doors no longer create purple particles
- Hacking clients can no longer edit texts of placed signs in multiplayer
- Changed so that paintings pushed by pistons will pop off

-
- -
-
-
-
-

Minecraft Beta 1.7

-

1.7:

+ Added pistons
+ Fire or redstone is now required to trigger TNT
+ Fences can be stacked
+ Added shears
+ Shears can be used to pick up leaf blocks
+ Shears can be used to shear sheep without hurting them
* Sheep no longer drop wool from being punched
- Removed Herobrine

-
- -
-
-
-
-

Minecraft Beta 1.6.6

-

1.6.6:

+ Added a new use for bonemeal
* Changed the material of glowstone from “glass” to “stone”. This means you need a pickaxe to get resources from it
* Made glowstone drop more loot
* Made the recipe sizes for creating cloth blocks and glowstone blocks smaller (2x2 instead of 3x3)
* Re-introduced unlimited FPS, renamed the option again
* Fixed beds not working very well at all in SMP
* Fixed destroying a boat spawning the player too low, causing them to sometimes fall through the ground
* Boats float up to the surface quicker
* Boats falling down into water lose their vertical momentum very fast
* Removed Herobrine

-
- -
-
-
-
-

Minecraft Beta 1.6.5

-

There are some annoying bed bugs in multiplayer in this version, I’ll fix those next week.

-

1.6.5:

* Tweaked the connection reading code a lot. Hopefully this helps.
* Changed the “limit framerate” option to a “framerate cap” option.
* Added “Advanced OpenGL” again
* Players riding anything or sleeping in anything will stop doing so when they leave the game now
* Removed the minecraft version number from the main game window. It’s still available in the title screen
* Fixed some entities appearing to fall through the ground repeatedly in multiplayer (some might still do so)
* Fixed the server sometimes thinking the player hit a corner when walking when they didn’t
* Fixed dropped damaged items vanishing after a single use after being picked up
* Fixed dropped items not getting ejected from blocks properly
* Fixed the achievements window rendering some graphics outside the clip window
* Fixed players saving while sneaking being loaded too high up
* Fixed shift+click transferring items causing a crash when the target container is full
* Fixed lighting updates sometimes not happening correctly
* Fixed the players health appearing to be full when entering/exiting the nether
* Fixed a couple of instances where beds would act strange in multiplayer, primarily the “already occupied” bug

-
- -
-
-
-
-

Minecraft Beta 1.6.4

-

* Fixed 1.6.3 using more CPU despite it claiming to use less
* Totally professional

-
- -
-
-
-
-

Minecraft Beta 1.6.3

-

1.6.3:

+ The renderer is now capped at 100 fps while there are chunks to be generated. The excess time will be spent generating chunks instead of rendering frames
+ The “limit framerate” option now limits the game to 40 fps and will spend at least 10 ms per frame sleeping
+ The “limit framerate” option has been reset to “off” for all players, enable it again if you want it
* Fixed some block updates not updating lighting properly under some circumstances by reverting the “don’t always send block data” fix in 1.6
* Fixed a major CPU load issue in the server where a very tight loop would starve all other threads
* Fixed furnaces dropping/duplicating their contents when they change state from lit to unlit or back

1.6.2:

* Fixed an ACTUAL item duplication bug while picking up some items

1.6.1:

* Fixed a visual item duplication bug when trying to pick up items while the inventory is full

-
- -
-
-
-
-

Minecraft Beta 1.6

-

New features:
+ Added Nether support to multiplayer
+ The client will ask minecraft.net if the current login is valid. If the server says “no”, a warning message appears in the client. You can still play the game even if this happens.
+ Added craftable maps
+ Added hatches
+ Added tall grass in some biomes
+ Mushrooms now spreads (very) slowly
+ Added server property view-distance. Sets the radius of terrain updates (in chunks) to send to the players. Range 3-15, default 10.
+ Added dead shrubs in deserts
+ Added allow-nether (set to true or false) in server.properties
+ Blocks destroyed by other players in multiplayer now shows the breaking block particle effect
+ Doors make sound for other players in multiplayer
+ The record player now supports more than 15 different songs (you can’t get the records yet, though)
+ Activated dispensers make sounds and trigger particles in multiplayer
+ Players stuck in walls will slide towards the nearest gap if there is one

Changes:
* Disabled Advanced OpenGL until we can fix some bugs with it
* It’s no longer possible to build solid blocks on the top layer of the maps (sorry!)
* Made booster tracks speedier
* Severely nerfed fire so it spread slower, and doesn’t spread infinitely
* Seeds are now found in tall grass, using a hoe on the ground no longer works
* Compressed network traffic more agressively
* Blocks that don’t change appearance when the data changes don’t send block updates when their data changes now
* Arrows shot by players can now be picked up by all players
* Nothing riding anything or being ridden by anything can enter portals

Bugfixes:
* Fixed running out of memory corrupting the current level
* Fixed the side textures of grass getting extra dark when mining them
* Fixed anaglyph 3d rendering mode having severe visual bugs
* Fixed the crash screen vanishing immediately
* Fixed not being able to target blocks when at x or z pos 1000
* Fixed the achievements screen messing up the sky color
* Fixed saving while sneaking dropping the player through the ground
* Fixed a system clock change messing up the game speed
* Fixed rain sounds not playing with fast graphics enabled
* Fixed hair and cloaks being rendered in the wrong locations on sneaking players
* Fixed the attack/swing animation not being applied to the armor layer
* Fixed player rotation not being loaded correctly when loading a saved game
* Fixed arrow physics, making them not get stuck midair when you open a door
* Fixed arrows hitting reeds, portals, and other non-solid blocks
* Fixed keybindings not getting saved properly under certain conditions
* Fixed the player not being able to sneak off lowered blocks like cacti
* Fixed a bug where the player could mine without swinging their arm
* Fixed boats placed on snow being placed too far up
* Fixed submerged boats rising very very fast
* Fixed sand dropping onto boats getting stuck in a falling animation
* Fixed a game crash when riding a vehicle or animal into the nether
* Fixed falling while riding not dealing damage to the rider
* Fixed buttons and levers too close to the player being impossible to use
* Fixed dispensers shooting through walls
* Fixed fire hurting through wall corners
* Fixed entities reaching water through wall corners
* Fixed placing doors next to cacti creating half-doors
* Fixed buttons and levers being placeable on leaves in “fast graphics” mode
* Fixed furnaces and dispensers not dropping their contents when destroyed
* Fixed dispensers biasing later slots
* Fixed farmland taking too long to dig
* Fixed tilling below some blocks being possible
* Fixed tilling the underside of blocks somehow working
* Fixed fences and stairs sometimes becoming invisible
* Fixed walking on top of fences not producing step sounds
* Fixed fire sometimes existing mid-air as an invisible block of pain
* Fixed fences and wooden stairs not being flammable
* Fixed fire effect on burning entities sometimes getting rendered in the wrong location
* Fixed fishing rod rendering being a bit lacking
* Fixed fishing rods being stackable
* Fixed mining glass hiding the clouds behind the glass
* Fixed rain falling through liquids
* Fixed items in glass blocks not getting ejected properly
* Fixed water interacting strangely with glass
* Fixed glass not blocking rain sound
* Fixed fences and signs preventing grass from growing
* Fixed rain and snow being incorrectly lit
* Fixed grass staying alive below stair blocks
* Fixed the achievement screen not pausing the game
* Fixed some screens breaking the sky tint color
* Fixed fullscreen mode switching causing mouse issues and screen closes
* Fixed chat messages surviving through game switches
* Fixed ice so it regenerates regardless of whether it’s snowing or not
* Fixed rain falling too slowly
* Fixed levers being placeable on weird locations
* Fixed floor levers sometimes not delivering a signal downwards
* Fixed floor levers sometimes not being removed when the floor is removed
* Fixed rail tiles sometimes not properly connecting to a new neighbor
* Fixed minecarts next to each other causing extreme velocities (sorry!)
* Fixed wolves not following their owner if the name has different caps
* Fixed creepers retaining charge level when they can’t see their target
* Fixed dying in the nether spawning new portals
* “Fixed” beds in the nether
* Fixed inventory acting weird when portaling by making the portal close all screens
* Fixed wooden pressure plates being mined with pickaxes
* Fixed redstone repeaters having the wrong particles
* Fixed saplings being plantable through snow onto non-grass blocks
* Fixed ore density varying per quadrant from the center of the world
* Fixed dispenser graphics being one pixel off. ONE PIXEL!!!
* Fixed mushrooms spawning everywhere during nights
* Fixed animals only spawning near light during the night
* Fixed the multiplayer join screen input field being too short
* Fixed IPv6 addresses being parsed wrongly. To connect to a specific port in IPv6, use the format [1234:567::1]:25565
* Fixed network packets being sent unbuffered, causing huge amounts of packets being sent
* Fixed entity positions going out of synch sometimes. They get re-synched every 20 seconds now.
* Fixed inventory icons not animating after being picked up in multiplayer
* Fixed mushroom soup not leaving a bowl in multiplayer
* Fixed entities above the map height limit becoming invisible
* Fixed healing not flashing the health bar in multiplayer
* Fixed arrows being animated really strangely in multiplayer
* Fixed arrows triggering too many entity move updates in multiplayer
* Fixed the compass not pointing at the spawn location in multiplayer
* Fixed fires being impossible to put out in multiplayer
* Fixed record players spawning client-side fake records in multiplayer
* Fixed records not playing for other players in multiplayer
* Fixed players spawning in the wrong location and quickly lerping to the correct location
* Fixed monsters not being visible for players with their difficulty set to peaceful
* Fixed pigs getting hit by lightning in multiplayer spawning client-side zombie pigmen
* Fixed loads of exploding tnt generating way too many particles, possibly crashing the client
* Fixed bonemeal use in multiplayer sometimes spawning fake client-side trees
* Fixed saplings sometimes spawning trees client-side in multiplayer
* Fixed weather sometimes changing client-side in multiplayer
* Fixed grasscolor.png and foliagecolor.png not being read from texture packs
* Fixed stats getting saved to different files in offline mode if the caps in the player name differ from the true spelling
* Fixed fireballs not being visible in multiplayer
* Fixed ghasts’ fireing animation not being visible in multiplayer
* Fixed receiving more items than the maximum stack size sometimes causing an oversized stack in the inventory

-
- -
-
-
-
-

Minecraft Beta 1.5

-

(You will need to update your servers as well)

-

* Weather (rain, snow, thunder)
* Statistics
* Achievements
* Detector rail
* Booster rail
* Performance improvements

-

More statistics and achievements will be added over time as we develop the game. They’re only stored locally at the moment, but we’ll slowly be rolling out online storing of achievements over time.

-
- -
-
-
-
-

Minecraft Beta 1.4_01

-

* Removed the April fools joke

-

(The server was updated as well, but it’s an optional update)

-
- -
-
-
-
-

Minecraft Beta 1.4

-

* Added tameable wolves
* Added cookies
* Sleeping in a bed now resets your spawn position
* New Minecraft logo
* Holding shift while climbing will hang on to the ladder
* Spiders will no longer trample crops
* Lots and lots of infrastructure for Statistics lists and Achievements

-

While most of the code is written, statistics and achievements won’t show up until the next update. We didn’t quite have time to finish them this week, and didn’t want to delay the update longer.

-
- -
-
-
-
-

Minecraft Beta 1.3

-

* Implemented a new lighting engine with the help of MrMessiahs (can be turned off)
* Changed the options around, added a new “Graphics options” button
* Added beds. If all players in a map sleeps in a bed during night, the game immediately skips until morning
* Added three new half-size blocks
* Added Delay/Repeater redstone dust blocks
* Added whitelisting to the server. To use, enter “whitelist <cmd>” where cmd is “on”, “off”, “add <player>”, “remove <player>”, “list” or “reload”
* New save file format, old maps need to be converted (that might take a while..)
* It’s now possible to have more than five save slots, and to rename saves
* Scrollbars in both the texture pack list, and in the map selection screen
* Replaced the Mojang splash image to reflect the new logo colors
* .. and a bunch of bug fixes and tweaks!

-
- -
-
-
-
-

Welcome to the new Minecraft Launcher

-

This area will be used to inform you about game updates and other important news about the game. It’s highly likely we’ll also use it to promote things we like, such as any future games we make, or where to get the latest merchandise for the game. Marketing will be kept tasteful, though.

-

One cool feature about the new launcher you might want to know about is that you can pass it command-line features! The syntax is:

-

Minecraft <username> <password> <server:port>

-

<username> is the username you wish to log in as
<password> is your password. If this is set, the launcher will automatically start the game without waiting for you to press the button
<server:port> is an ip to a minecraft server. If this is set, the game will automatically connect to that server once the game has started.

-
- -
-
-
-
-

Thanks for helping test this!

-

The biggest problem so far seems to be the “too many failed log in attempts” bug. That’s caused by the server getting every one connecting to the server mixed up

-
- -
-
-
-
-
-