diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 176a458..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/.gitignore b/.gitignore index 3baf9e7..c476faf 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,3 @@ hs_err_*.log replay_*.log *.hprof *.jfr - -# bukkit -craftbukkit-0.0.1-SNAPSHOT.jar diff --git a/babric/build.gradle b/babric/build.gradle deleted file mode 100644 index c2f24eb..0000000 --- a/babric/build.gradle +++ /dev/null @@ -1,71 +0,0 @@ -plugins { - id 'babric-loom' version '1.5-SNAPSHOT' - id 'maven-publish' -} - -archivesBaseName = project.archives_base_name -version = project.mod_version -group = project.maven_group - -loom { - gluedMinecraftJar() - customMinecraftManifest.set("https://babric.github.io/manifest-polyfill/${minecraft_version}.json") - intermediaryUrl.set("https://maven.glass-launcher.net/babric/babric/intermediary/%1\$s/intermediary-%1\$s-v2.jar") -} - -repositories { - maven { - name = 'Babric' - url = 'https://maven.glass-launcher.net/babric' - } -} - -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "babric:barn:${project.yarn_mappings}:v2" - modImplementation "babric:fabric-loader:${project.loader_version}" - - implementation 'org.slf4j:slf4j-api:1.8.0-beta4' - implementation 'org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0' - implementation 'com.googlecode.json-simple:json-simple:1.1.1' -} - -processResources { - inputs.property "version", project.version - - filesMatching('fabric.mod.json') { - expand "version": project.version - } -} - -java { - withSourcesJar() - - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 -} - -jar { - from('../LICENSE') { - rename { "${it}_${project.archivesBaseName}" } - } -} - -sourceSets { - main { - java { - srcDirs = [ - '../src/shared', - '../src/fabric-shared', - '../src/rpc-simple', - '../src/babric', - ] - include '**/*.java' - } - resources { - srcDirs = ['../src', '../src/babric'] - include 'fabric.mod.json' - include 'flashii-extensions.mixins.json' - include 'assets/icon.png' - } - } -} diff --git a/babric/gradle.properties b/babric/gradle.properties deleted file mode 100644 index b51da88..0000000 --- a/babric/gradle.properties +++ /dev/null @@ -1,14 +0,0 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G -org.gradle.parallel=true - -# Fabric Properties -# check these on https://babric.github.io/develop/ -minecraft_version=b1.7.3 -yarn_mappings=b1.7.3+build.9 -loader_version=0.15.6-babric.2 - -# Mod Properties -mod_version=1.1.0 -maven_group=net.flashii.mcexts -archives_base_name=flashii-extensions-babric diff --git a/babric/gradle/wrapper/gradle-wrapper.jar b/babric/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index d64cd49..0000000 Binary files a/babric/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/babric/gradle/wrapper/gradle-wrapper.properties b/babric/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index a80b22c..0000000 --- a/babric/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/babric/gradlew b/babric/gradlew deleted file mode 100644 index 1aa94a4..0000000 --- a/babric/gradlew +++ /dev/null @@ -1,249 +0,0 @@ -#!/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##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - -# 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 - 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" && ! "$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 - -# 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 - - -# 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, 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" \ - 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/babric/gradlew.bat b/babric/gradlew.bat deleted file mode 100644 index 25da30d..0000000 --- a/babric/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@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. 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 - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -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 - -: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/babric/settings.gradle b/babric/settings.gradle deleted file mode 100644 index 75c7305..0000000 --- a/babric/settings.gradle +++ /dev/null @@ -1,14 +0,0 @@ -pluginManagement { - repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - maven { - name = 'Babric' - url = 'https://maven.glass-launcher.net/babric' - } - mavenCentral() - gradlePluginPortal() - } -} diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..e6afdb5 --- /dev/null +++ b/build.gradle @@ -0,0 +1,47 @@ +plugins { + id 'fabric-loom' version '1.3-SNAPSHOT' + id 'maven-publish' +} + +version = project.mod_version +group = project.maven_group + +base { + archivesName = project.archives_base_name +} + +repositories {} + +dependencies { + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + implementation 'com.google.code.gson:gson:2.10.1' +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.encoding = "UTF-8" + it.options.release = 17 + it.options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked'] +} + +java { + withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +jar { + from("LICENSE") { + rename { "${it}_${project.base.archivesName.get()}"} + } +} diff --git a/bukkit173/build.gradle b/bukkit173/build.gradle deleted file mode 100644 index 2c8b7d3..0000000 --- a/bukkit173/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -apply plugin: 'java' - -repositories { - mavenCentral() -} - -dependencies { - implementation files('craftbukkit-0.0.1-SNAPSHOT.jar') -} - -tasks.withType(JavaCompile).configureEach { - it.options.encoding = "UTF-8" - it.options.release = 8 - it.options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked'] -} - -java { - withSourcesJar() - - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 -} - -sourceSets { - main { - java { - srcDirs = [ - '../src/shared', - '../src/rpc-simple', - '../src/bukkitb173', - ] - include '**/*.java' - } - resources { - srcDirs = ['../src/bukkitb173'] - include 'plugin.yml' - } - } -} diff --git a/bukkit173/gradle.properties b/bukkit173/gradle.properties deleted file mode 100644 index 9c0a032..0000000 --- a/bukkit173/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G -org.gradle.parallel=true diff --git a/fabric/build.gradle b/fabric/build.gradle deleted file mode 100644 index b164c9c..0000000 --- a/fabric/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -plugins { - id 'fabric-loom' version '1.5-SNAPSHOT' - id 'maven-publish' -} - -version = project.mod_version -group = project.maven_group - -base { - archivesName = project.archives_base_name -} - -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - implementation 'com.google.code.gson:gson:2.10.1' -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -tasks.withType(JavaCompile).configureEach { - it.options.encoding = "UTF-8" - it.options.release = 17 - it.options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked'] -} - -java { - withSourcesJar() - - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 -} - -jar { - from('../LICENSE') { - rename { "${it}_${project.base.archivesName.get()}"} - } -} - -sourceSets { - main { - java { - srcDirs = [ - '../src/shared', - '../src/fabric-shared', - '../src/rpc-gson', - '../src/fabric', - ] - include '**/*.java' - } - resources { - srcDirs = ['../src', '../src/fabric'] - include 'fabric.mod.json' - include 'flashii-extensions.mixins.json' - include 'assets/icon.png' - } - } -} diff --git a/fabric/gradle/wrapper/gradle-wrapper.jar b/fabric/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index d64cd49..0000000 Binary files a/fabric/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/fabric/gradle/wrapper/gradle-wrapper.properties b/fabric/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index a80b22c..0000000 --- a/fabric/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/fabric/gradlew b/fabric/gradlew deleted file mode 100644 index 1aa94a4..0000000 --- a/fabric/gradlew +++ /dev/null @@ -1,249 +0,0 @@ -#!/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##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - -# 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 - 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" && ! "$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 - -# 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 - - -# 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, 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" \ - 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/fabric/gradlew.bat b/fabric/gradlew.bat deleted file mode 100644 index 25da30d..0000000 --- a/fabric/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@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. 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 - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -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 - -: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/fabric/gradle.properties b/gradle.properties similarity index 88% rename from fabric/gradle.properties rename to gradle.properties index 42bdfac..65dcd5a 100644 --- a/fabric/gradle.properties +++ b/gradle.properties @@ -6,9 +6,9 @@ org.gradle.parallel=true # check these on https://fabricmc.net/develop minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 -loader_version=0.15.7 +loader_version=0.14.22 # Mod Properties -mod_version=1.1.0 +mod_version=1.0.1 maven_group=net.flashii.mcexts archives_base_name=flashii-extensions diff --git a/bukkit173/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from bukkit173/gradle/wrapper/gradle-wrapper.jar rename to gradle/wrapper/gradle-wrapper.jar diff --git a/bukkit173/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from bukkit173/gradle/wrapper/gradle-wrapper.properties rename to gradle/wrapper/gradle-wrapper.properties diff --git a/bukkit173/gradlew b/gradlew similarity index 100% rename from bukkit173/gradlew rename to gradlew diff --git a/bukkit173/gradlew.bat b/gradlew.bat similarity index 100% rename from bukkit173/gradlew.bat rename to gradlew.bat diff --git a/fabric/settings.gradle b/settings.gradle similarity index 100% rename from fabric/settings.gradle rename to settings.gradle diff --git a/src/babric/fabric.mod.json b/src/babric/fabric.mod.json deleted file mode 100644 index 110a269..0000000 --- a/src/babric/fabric.mod.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "schemaVersion": 1, - "id": "flashii-extensions-babric", - "version": "${version}", - "name": "Flashii Extensions", - "description": "This mod provides extensions for the Flashii.net Minecraft servers.", - "authors": [ - "flashwave" - ], - "contact": { - "homepage": "https://mc.flashii.net/", - "sources": "https://patchii.net/flashii/mcexts" - }, - "license": "BSD-3-Clause-Clear", - "icon": "assets/icon.png", - "environment": "*", - "mixins": [ - "flashii-extensions.mixins.json" - ], - "depends": { - "fabricloader": ">=0.13.3", - "minecraft": "1.0.0-beta.7.3" - } -} diff --git a/src/babric/flashii-extensions.mixins.json b/src/babric/flashii-extensions.mixins.json deleted file mode 100644 index c0ec844..0000000 --- a/src/babric/flashii-extensions.mixins.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "required": true, - "package": "net.flashii.mcexts.mixin", - "compatibilityLevel": "JAVA_8", - "mixins": [ - ], - "server": [ - ], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/src/bukkitb173/ConfigPath.java b/src/bukkitb173/ConfigPath.java deleted file mode 100644 index f63a6b2..0000000 --- a/src/bukkitb173/ConfigPath.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.flashii.mcexts; - -import java.io.File; -import java.nio.file.Path; - -public class ConfigPath { - private static Path configPath = null; - - public static Path getPath() { - return configPath; - } - - public static Path getPath(String name) { - return configPath.resolve(name); - } - - public static void setPath(File path) { - configPath = path.toPath().toAbsolutePath(); - } -} diff --git a/src/bukkitb173/JoinListener.java b/src/bukkitb173/JoinListener.java deleted file mode 100644 index d28d30c..0000000 --- a/src/bukkitb173/JoinListener.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.flashii.mcexts; - -import org.bukkit.event.player.PlayerListener; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerLoginEvent.Result; - -public class JoinListener extends PlayerListener { - @Override - public void onPlayerLogin(PlayerLoginEvent ev) { - if(ev.getResult() != Result.ALLOWED) - return; - - String authText = null; - - try { - RPCPayload payload = RPC.postAuth(ev.getPlayer().getDisplayName(), ev.getKickMessage()); - - if(!payload.is("auth:ok")) { - if(payload.is("error")) { - authText = payload.getAttrStr(payload.hasAttr("text") ? "text" : "code"); - } else if(payload.is("auth:authorise")) { - String userName = payload.getAttrStr("user_name"); - String url = payload.getAttrStr("url"); - - if(userName.length() > 20) - userName = userName.substring(0, 20); - - authText = "Welcome back, " + userName + "! Go to " + url + " to verify yourself."; - } else if(payload.is("auth:link")) { - String code = payload.getAttrStr("code"); - String url = payload.getAttrStr("url"); - - authText = "Visit " + url + " to connect your Flashii ID. Link code: " + code; - } else { - authText = "Flashii server returned unknown response, yell at flashwave about this."; - } - } - } catch(Exception ex) { - authText = "There was a serious problem during authentication, yell at flashwave about this."; - ex.printStackTrace(); - } - - if(authText == null) - ev.allow(); - else - ev.disallow(Result.KICK_OTHER, authText); - } -} diff --git a/src/bukkitb173/PluginMain.java b/src/bukkitb173/PluginMain.java deleted file mode 100644 index b35b601..0000000 --- a/src/bukkitb173/PluginMain.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.flashii.mcexts; - -import java.util.logging.Logger; -import org.bukkit.Bukkit; -import org.bukkit.event.Event; -import org.bukkit.event.Event.Priority; -import org.bukkit.plugin.java.JavaPlugin; - -public class PluginMain extends JavaPlugin { - public final static Logger logger = Logger.getLogger("FIIEXTS"); - - private final JoinListener joinListener = new JoinListener(); - - @Override - public void onEnable() { - logger.info("Flashii extensions enabled!"); - - ConfigPath.setPath(getDataFolder()); - Bukkit.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_LOGIN, joinListener, Priority.Highest, this); - } - - @Override - public void onDisable() { - logger.info("Flashii extensions disabled!"); - } -} diff --git a/src/bukkitb173/plugin.yml b/src/bukkitb173/plugin.yml deleted file mode 100644 index e5ef302..0000000 --- a/src/bukkitb173/plugin.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: fiiexts -main: net.flashii.mcexts.PluginMain -version: 1.1.0 diff --git a/src/fabric-shared/ConfigPath.java b/src/fabric-shared/ConfigPath.java deleted file mode 100644 index b589ba5..0000000 --- a/src/fabric-shared/ConfigPath.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.flashii.mcexts; - -import java.nio.file.Path; -import net.fabricmc.loader.api.FabricLoader; - -public class ConfigPath { - private static Path configPath = null; - - public static Path getPath() { - if(configPath == null) - configPath = FabricLoader.getInstance().getGameDir().resolve("config").resolve("fiiexts"); - return configPath; - } - - public static Path getPath(String name) { - return getPath().resolve(name); - } -} diff --git a/src/shared/Config.java b/src/main/java/net/flashii/mcexts/Config.java similarity index 71% rename from src/shared/Config.java rename to src/main/java/net/flashii/mcexts/Config.java index 22a49d2..6a13893 100644 --- a/src/shared/Config.java +++ b/src/main/java/net/flashii/mcexts/Config.java @@ -3,7 +3,9 @@ package net.flashii.mcexts; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.HashMap; +import net.fabricmc.loader.api.FabricLoader; public class Config { static class ConfigCache { @@ -22,14 +24,25 @@ public class Config { } } + private static Path configPath = null; private static HashMap cache = new HashMap<>(); + private static Path getConfigPath() { + if(configPath == null) + configPath = FabricLoader.getInstance().getGameDir().resolve("config").resolve("fiiexts"); + return configPath; + } + + private static Path getConfigPath(String name) { + return getConfigPath().resolve(name); + } + public static String getValue(String name) { return getValue(name, null); } public static String getValue(String name, String fallback) { - return getFileContentsCached(ConfigPath.getPath(name), fallback); + return getFileContentsCached(getConfigPath(name), fallback); } private static String getFileContentsCached(Path path, String fallback) { @@ -44,7 +57,7 @@ public class Config { if(output == null) { try { - output = Files.exists(path) ? new String(Files.readAllBytes(path)).trim() : fallback; + output = Files.exists(path) ? Files.readString(path).trim() : fallback; } catch(IOException ex) { ex.printStackTrace(); output = fallback; diff --git a/src/shared/HMAC.java b/src/main/java/net/flashii/mcexts/HMAC.java similarity index 100% rename from src/shared/HMAC.java rename to src/main/java/net/flashii/mcexts/HMAC.java diff --git a/src/shared/RNG.java b/src/main/java/net/flashii/mcexts/RNG.java similarity index 100% rename from src/shared/RNG.java rename to src/main/java/net/flashii/mcexts/RNG.java diff --git a/src/shared/RPC.java b/src/main/java/net/flashii/mcexts/RPC.java similarity index 75% rename from src/shared/RPC.java rename to src/main/java/net/flashii/mcexts/RPC.java index 6e1ac95..1ee64fa 100644 --- a/src/shared/RPC.java +++ b/src/main/java/net/flashii/mcexts/RPC.java @@ -2,8 +2,8 @@ package net.flashii.mcexts; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.io.IOException; import java.io.OutputStream; -import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.InetAddress; import java.net.InetSocketAddress; @@ -11,20 +11,25 @@ import java.net.SocketAddress; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.security.GeneralSecurityException; import java.util.Base64; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; public class RPC { private static final String DEFAULT_SECRET = "meow"; - private static RPCPayloadParser parser = null; + private static Gson gson = null; - public static RPCPayloadParser getParser() { - if(parser == null) - parser = new RPCPayloadParser(); - return parser; + public static Gson getGson() { + if(gson == null) + gson = new GsonBuilder() + .registerTypeAdapter(RPCPayload.class, new RPCPayloadDeserialiser()) + .create(); + return gson; } public static String getSecretKey() { @@ -41,9 +46,7 @@ public class RPC { params.forEach((key, value) -> { sb.append(key); sb.append('='); - try { - sb.append(URLEncoder.encode(value.toString(), "UTF-8")); - } catch(UnsupportedEncodingException ex) {} + sb.append(URLEncoder.encode(value.toString(), StandardCharsets.UTF_8)); sb.append('&'); }); @@ -56,7 +59,7 @@ public class RPC { } public static String createRequestSignature(String time, String path, String params) - throws Exception { + throws GeneralSecurityException { return Base64.getEncoder().encodeToString(HMAC.calculate( HMAC.SHA256, getSecretKey(), String.format("%s#%s?%s", time, path, params) )); @@ -64,7 +67,7 @@ public class RPC { // sigStr and bodyStr because sigStr must also include the query params if those are present public static RPCPayload callRpc(String path, String sigStr, String bodyStr) - throws Exception { + throws GeneralSecurityException, IOException { boolean hasBody = bodyStr != null; String time = getRequestTimestamp(); String hash = createRequestSignature(time, URLs.getRpcPath(path), sigStr); @@ -91,48 +94,31 @@ public class RPC { sb.append(line); } - return getParser().parse(sb.toString()); + return getGson().fromJson(sb.toString(), RPCPayload.class); } public static RPCPayload callRpc(String path, String paramStr) - throws Exception { + throws GeneralSecurityException, IOException { return callRpc(path, paramStr, paramStr); } public static RPCPayload callRpc(String path, Map params) - throws Exception { + throws GeneralSecurityException, IOException { return callRpc(path, createParamString(params)); } - public static UUID createOfflinePlayerUUID(String name) { - return UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes()); - } - - public static RPCPayload postAuth(String name, String remoteAddr) - throws Exception { - return postAuth( - createOfflinePlayerUUID(name), - name, remoteAddr - ); - } - - public static RPCPayload postAuth(UUID id, String name, String remoteAddr) - throws Exception { + public static RPCPayload postAuth(UUID id, String name, InetAddress remoteAddr) + throws GeneralSecurityException, IOException { HashMap params = new HashMap<>(); params.put("id", id); params.put("name", name); - params.put("ip", remoteAddr); + params.put("ip", remoteAddr.getHostAddress()); return callRpc("/auth", params); } - public static RPCPayload postAuth(UUID id, String name, InetAddress remoteAddr) - throws Exception { - return postAuth(id, name, remoteAddr.getHostAddress()); - } - public static RPCPayload postAuth(UUID id, String name, SocketAddress sockAddr) - throws Exception { + throws GeneralSecurityException, IOException { InetAddress remoteAddr = sockAddr instanceof InetSocketAddress ? ((InetSocketAddress)sockAddr).getAddress() : InetAddress.getLoopbackAddress(); diff --git a/src/shared/RPCPayload.java b/src/main/java/net/flashii/mcexts/RPCPayload.java similarity index 100% rename from src/shared/RPCPayload.java rename to src/main/java/net/flashii/mcexts/RPCPayload.java diff --git a/src/rpc-gson/RPCPayloadDeserialiser.java b/src/main/java/net/flashii/mcexts/RPCPayloadDeserialiser.java similarity index 100% rename from src/rpc-gson/RPCPayloadDeserialiser.java rename to src/main/java/net/flashii/mcexts/RPCPayloadDeserialiser.java diff --git a/src/shared/URLs.java b/src/main/java/net/flashii/mcexts/URLs.java similarity index 100% rename from src/shared/URLs.java rename to src/main/java/net/flashii/mcexts/URLs.java diff --git a/src/fabric/mixin/EnvironmentMixin.java b/src/main/java/net/flashii/mcexts/mixin/EnvironmentMixin.java similarity index 100% rename from src/fabric/mixin/EnvironmentMixin.java rename to src/main/java/net/flashii/mcexts/mixin/EnvironmentMixin.java diff --git a/src/main/java/net/flashii/mcexts/mixin/PlayerListHudMixin.java b/src/main/java/net/flashii/mcexts/mixin/PlayerListHudMixin.java new file mode 100644 index 0000000..ef407fc --- /dev/null +++ b/src/main/java/net/flashii/mcexts/mixin/PlayerListHudMixin.java @@ -0,0 +1,16 @@ +package net.flashii.mcexts.mixin; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.hud.PlayerListHud; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(PlayerListHud.class) +public abstract class PlayerListHudMixin { + @Redirect(method = "render(Lnet/minecraft/client/gui/DrawContext;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;isInSingleplayer()Z")) + public boolean redirectIsInSinglePlayer(MinecraftClient client) { + // always enable BL + return true; + } +} diff --git a/src/fabric/mixin/PlayerManagerMixin.java b/src/main/java/net/flashii/mcexts/mixin/PlayerManagerMixin.java similarity index 87% rename from src/fabric/mixin/PlayerManagerMixin.java rename to src/main/java/net/flashii/mcexts/mixin/PlayerManagerMixin.java index 42e65f5..a734995 100644 --- a/src/fabric/mixin/PlayerManagerMixin.java +++ b/src/main/java/net/flashii/mcexts/mixin/PlayerManagerMixin.java @@ -1,6 +1,8 @@ package net.flashii.mcexts.mixin; +import java.io.IOException; import java.net.SocketAddress; +import java.security.GeneralSecurityException; import com.mojang.authlib.GameProfile; import net.flashii.mcexts.RPC; import net.flashii.mcexts.RPCPayload; @@ -52,8 +54,11 @@ public abstract class PlayerManagerMixin { authText = Text.literal("Flashii authentication server returned an unknown response, yell at flashwave about this.").formatted(Formatting.RED); } } - } catch(Exception ex) { - authText = Text.literal("There was a serious problem during authentication, yell at flashwave about this.").formatted(Formatting.RED); + } catch(IOException ex) { + authText = Text.literal("Flashii authentication server failed to respond, yell at flashwave about this.").formatted(Formatting.RED); + ex.printStackTrace(); + } catch(GeneralSecurityException ex) { + authText = Text.literal("Problem with request verification, yell at flashwave about this.").formatted(Formatting.RED); ex.printStackTrace(); } diff --git a/src/fabric/mixin/ServerMetadataMixin.java b/src/main/java/net/flashii/mcexts/mixin/ServerMetadataMixin.java similarity index 100% rename from src/fabric/mixin/ServerMetadataMixin.java rename to src/main/java/net/flashii/mcexts/mixin/ServerMetadataMixin.java diff --git a/src/fabric/mixin/TextureUrlCheckerMixin.java b/src/main/java/net/flashii/mcexts/mixin/TextureUrlCheckerMixin.java similarity index 100% rename from src/fabric/mixin/TextureUrlCheckerMixin.java rename to src/main/java/net/flashii/mcexts/mixin/TextureUrlCheckerMixin.java diff --git a/src/fabric/mixin/YggdrasilMinecraftSessionServiceMixin.java b/src/main/java/net/flashii/mcexts/mixin/YggdrasilMinecraftSessionServiceMixin.java similarity index 100% rename from src/fabric/mixin/YggdrasilMinecraftSessionServiceMixin.java rename to src/main/java/net/flashii/mcexts/mixin/YggdrasilMinecraftSessionServiceMixin.java diff --git a/src/assets/icon.png b/src/main/resources/assets/flashii-extensions/icon.png similarity index 100% rename from src/assets/icon.png rename to src/main/resources/assets/flashii-extensions/icon.png diff --git a/src/fabric/fabric.mod.json b/src/main/resources/fabric.mod.json similarity index 86% rename from src/fabric/fabric.mod.json rename to src/main/resources/fabric.mod.json index 0202043..7c3d804 100644 --- a/src/fabric/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -12,13 +12,13 @@ "sources": "https://patchii.net/flashii/mcexts" }, "license": "BSD-3-Clause-Clear", - "icon": "assets/icon.png", + "icon": "assets/flashii-extensions/icon.png", "environment": "*", "mixins": [ "flashii-extensions.mixins.json" ], "depends": { - "fabricloader": ">=0.15.7", + "fabricloader": ">=0.14.22", "minecraft": "~1.20.1", "java": ">=17" } diff --git a/src/fabric/flashii-extensions.mixins.json b/src/main/resources/flashii-extensions.mixins.json similarity index 92% rename from src/fabric/flashii-extensions.mixins.json rename to src/main/resources/flashii-extensions.mixins.json index af2e292..46b07ae 100644 --- a/src/fabric/flashii-extensions.mixins.json +++ b/src/main/resources/flashii-extensions.mixins.json @@ -4,6 +4,7 @@ "compatibilityLevel": "JAVA_17", "mixins": [ "EnvironmentMixin", + "PlayerListHudMixin", "TextureUrlCheckerMixin", "YggdrasilMinecraftSessionServiceMixin" ], diff --git a/src/rpc-gson/RPCPayloadParser.java b/src/rpc-gson/RPCPayloadParser.java deleted file mode 100644 index 5088753..0000000 --- a/src/rpc-gson/RPCPayloadParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.flashii.mcexts; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class RPCPayloadParser { - private final Gson gson; - - public RPCPayloadParser() { - gson = new GsonBuilder() - .registerTypeAdapter(RPCPayload.class, new RPCPayloadDeserialiser()) - .create(); - } - - public RPCPayload parse(String body) { - return gson.fromJson(body, RPCPayload.class); - } -} diff --git a/src/rpc-simple/RPCPayloadParser.java b/src/rpc-simple/RPCPayloadParser.java deleted file mode 100644 index 9d1a802..0000000 --- a/src/rpc-simple/RPCPayloadParser.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.flashii.mcexts; - -import java.util.HashMap; -import java.util.Iterator; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.ParseException; -import org.json.simple.parser.JSONParser; - -public class RPCPayloadParser { - private final JSONParser parser = new JSONParser(); - - public RPCPayload parse(String body) - throws ParseException { - JSONObject root = (JSONObject)parser.parse(body); - String name = (String)root.get("name"); - HashMap attrs = new HashMap<>(); - - @SuppressWarnings("unchecked") - Iterator attrsIterator = ((JSONArray)root.get("attrs")).iterator(); - while(attrsIterator.hasNext()) { - JSONObject attrInfo = attrsIterator.next(); - attrs.put( - (String)attrInfo.get("name"), - attrInfo.get("value") - ); - } - - return new RPCPayload(name, attrs); - } -}