diff --git a/.gitignore b/.gitignore index 42a87ea..23130f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,3 @@ -### Maven template -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -# https://github.com/takari/maven-wrapper#usage-without-binary-jar -.mvn/wrapper/maven-wrapper.jar - ### Java template # Compiled class file *.class @@ -35,52 +22,19 @@ buildNumber.properties # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* +replay_pid* ### JetBrains template # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf -.idea/** - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr +.idea +*.iml +*.ipr # CMake cmake-build-*/ - -# Mongo Explorer plugin .idea/**/mongoSettings.xml # File-based project format @@ -95,9 +49,6 @@ out/ # JIRA plugin atlassian-ide-plugin.xml -# Cursive Clojure plugin -.idea/replstate.xml - # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties @@ -110,114 +61,29 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser -### Java template -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar +### Gradle template +.gradle +**/build/ +!src/**/build/ -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* +# Ignore Gradle GUI config +gradle-app.setting -### Maven template -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -# https://github.com/takari/maven-wrapper#usage-without-binary-jar -.mvn/wrapper/maven-wrapper.jar +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr +# Cache of project +.gradletasknamecache -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath +# Paper run +run/ +**/run/ \ No newline at end of file diff --git a/adventure/build.gradle.kts b/adventure/build.gradle.kts new file mode 100644 index 0000000..6bb398d --- /dev/null +++ b/adventure/build.gradle.kts @@ -0,0 +1,4 @@ +dependencies { + implementation(project(":i18n-common")) + compileOnly("net.kyori:adventure-api:4.15.0") +} \ No newline at end of file diff --git a/i18n-adventure/src/main/java/de/helixdevs/i18n/adventure/AdventureTranslationConsumer.java b/adventure/src/main/java/de/helixdevs/i18n/adventure/AdventureTranslationConsumer.java similarity index 100% rename from i18n-adventure/src/main/java/de/helixdevs/i18n/adventure/AdventureTranslationConsumer.java rename to adventure/src/main/java/de/helixdevs/i18n/adventure/AdventureTranslationConsumer.java diff --git a/api/build.gradle.kts b/api/build.gradle.kts new file mode 100644 index 0000000..e69de29 diff --git a/i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationConsumer.java b/api/src/main/java/de/helixdevs/i18n/api/TranslationConsumer.java similarity index 100% rename from i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationConsumer.java rename to api/src/main/java/de/helixdevs/i18n/api/TranslationConsumer.java diff --git a/i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationEntry.java b/api/src/main/java/de/helixdevs/i18n/api/TranslationEntry.java similarity index 100% rename from i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationEntry.java rename to api/src/main/java/de/helixdevs/i18n/api/TranslationEntry.java diff --git a/i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationManager.java b/api/src/main/java/de/helixdevs/i18n/api/TranslationManager.java similarity index 100% rename from i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationManager.java rename to api/src/main/java/de/helixdevs/i18n/api/TranslationManager.java diff --git a/i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationRepository.java b/api/src/main/java/de/helixdevs/i18n/api/TranslationRepository.java similarity index 100% rename from i18n-api/src/main/java/de/helixdevs/i18n/api/TranslationRepository.java rename to api/src/main/java/de/helixdevs/i18n/api/TranslationRepository.java diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..d8738e2 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + `java-library` +} + +group = "de.mcmdev" +version = "1.3" + +subprojects { + apply(plugin = "java-library") + + group = rootProject.group + version = rootProject.version + + repositories { + mavenCentral() + maven("https://repo.papermc.io/repository/maven-public/") + } + + java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } + } +} \ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts new file mode 100644 index 0000000..0026c1b --- /dev/null +++ b/common/build.gradle.kts @@ -0,0 +1,3 @@ +dependencies { + api(project(":i18n-api")) +} \ No newline at end of file diff --git a/i18n-common/src/main/java/de/helixdevs/i18n/common/TranslationManagerImpl.java b/common/src/main/java/de/helixdevs/i18n/common/TranslationManagerImpl.java similarity index 100% rename from i18n-common/src/main/java/de/helixdevs/i18n/common/TranslationManagerImpl.java rename to common/src/main/java/de/helixdevs/i18n/common/TranslationManagerImpl.java index 9b9c17d..f55ba59 100644 --- a/i18n-common/src/main/java/de/helixdevs/i18n/common/TranslationManagerImpl.java +++ b/common/src/main/java/de/helixdevs/i18n/common/TranslationManagerImpl.java @@ -1,7 +1,7 @@ package de.helixdevs.i18n.common; -import de.helixdevs.i18n.api.TranslationManager; import de.helixdevs.i18n.api.TranslationConsumer; +import de.helixdevs.i18n.api.TranslationManager; import de.helixdevs.i18n.api.TranslationRepository; import java.util.Set; diff --git a/i18n-common/src/main/java/de/helixdevs/i18n/common/command/CommandReloadtranslations.java b/common/src/main/java/de/helixdevs/i18n/common/command/CommandReloadtranslations.java similarity index 100% rename from i18n-common/src/main/java/de/helixdevs/i18n/common/command/CommandReloadtranslations.java rename to common/src/main/java/de/helixdevs/i18n/common/command/CommandReloadtranslations.java diff --git a/i18n-common/src/main/java/de/helixdevs/i18n/common/command/api/Command.java b/common/src/main/java/de/helixdevs/i18n/common/command/api/Command.java similarity index 100% rename from i18n-common/src/main/java/de/helixdevs/i18n/common/command/api/Command.java rename to common/src/main/java/de/helixdevs/i18n/common/command/api/Command.java diff --git a/i18n-common/src/main/java/de/helixdevs/i18n/common/command/api/Sender.java b/common/src/main/java/de/helixdevs/i18n/common/command/api/Sender.java similarity index 100% rename from i18n-common/src/main/java/de/helixdevs/i18n/common/command/api/Sender.java rename to common/src/main/java/de/helixdevs/i18n/common/command/api/Sender.java diff --git a/i18n-common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlatform.java b/common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlatform.java similarity index 100% rename from i18n-common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlatform.java rename to common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlatform.java diff --git a/i18n-common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlugin.java b/common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlugin.java similarity index 100% rename from i18n-common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlugin.java rename to common/src/main/java/de/helixdevs/i18n/common/platform/I18nPlugin.java diff --git a/i18n-common/src/main/java/de/helixdevs/i18n/common/repositories/FilesTranslationRepository.java b/common/src/main/java/de/helixdevs/i18n/common/repositories/FilesTranslationRepository.java similarity index 100% rename from i18n-common/src/main/java/de/helixdevs/i18n/common/repositories/FilesTranslationRepository.java rename to common/src/main/java/de/helixdevs/i18n/common/repositories/FilesTranslationRepository.java diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d720357 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Dec 29 23:28:09 CET 2023 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/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/master/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 + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@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=. +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%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/i18n-adventure/pom.xml b/i18n-adventure/pom.xml deleted file mode 100644 index ac95e22..0000000 --- a/i18n-adventure/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - i18n - de.helixdevs - 1.2 - - 4.0.0 - - i18n-adventure - - - 8 - 8 - - - - - net.kyori - adventure-api - 4.11.0 - provided - - - de.helixdevs - i18n-common - 1.2 - - - - \ No newline at end of file diff --git a/i18n-api/pom.xml b/i18n-api/pom.xml deleted file mode 100644 index a2f4053..0000000 --- a/i18n-api/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - i18n - de.helixdevs - 1.2 - - 4.0.0 - - i18n-api - - - 8 - 8 - - - \ No newline at end of file diff --git a/i18n-common/pom.xml b/i18n-common/pom.xml deleted file mode 100644 index 2bfa24e..0000000 --- a/i18n-common/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - i18n - de.helixdevs - 1.2 - - 4.0.0 - - i18n-common - - - 8 - 8 - - - - - de.helixdevs - i18n-api - 1.2 - - - - \ No newline at end of file diff --git a/i18n-paper/pom.xml b/i18n-paper/pom.xml deleted file mode 100644 index 6927b4e..0000000 --- a/i18n-paper/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - i18n - de.helixdevs - 1.2 - - 4.0.0 - - i18n-paper - - - 17 - 17 - - - - - io.papermc.paper - paper-api - 1.19-R0.1-SNAPSHOT - provided - - - com.comphenix.protocol - ProtocolLib - 5.0.0-SNAPSHOT - provided - - - de.helixdevs - i18n-adventure - 1.2 - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - - \ No newline at end of file diff --git a/i18n-paper/src/main/resources/plugin.yml b/i18n-paper/src/main/resources/plugin.yml deleted file mode 100644 index 4425f97..0000000 --- a/i18n-paper/src/main/resources/plugin.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: i18n -version: 0.1 -api-version: 1.16 -author: MCMDEV -main: de.helixdevs.i18n.paper.I18nPaperPlugin -depend: - - ProtocolLib - -commands: - reloadtranslations: - description: Reload translations - permission: i18n.reloadtranslations \ No newline at end of file diff --git a/i18n-velocity/pom.xml b/i18n-velocity/pom.xml deleted file mode 100644 index 11ed47e..0000000 --- a/i18n-velocity/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - i18n - de.helixdevs - 1.2 - - 4.0.0 - - i18n-velocity - - - 17 - 17 - - - - - papermc - https://papermc.io/repo/repository/maven-public/ - - - - - - de.helixdevs - i18n-adventure - 1.2 - - - com.velocitypowered - velocity-api - 3.1.2-SNAPSHOT - provided - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - - \ No newline at end of file diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts new file mode 100644 index 0000000..79751c7 --- /dev/null +++ b/paper/build.gradle.kts @@ -0,0 +1,36 @@ +plugins { + id("io.papermc.paperweight.userdev") version "1.5.5" + id("xyz.jpenilla.run-paper") version "2.2.0" + id("net.minecrell.plugin-yml.bukkit") version "0.6.0" + id("com.github.johnrengelman.shadow") version "8.1.1" +} + +repositories { + maven("https://repo.dmulloy2.net/repository/public/") +} + +dependencies { + paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT") + implementation(project(":i18n-adventure")) + implementation(project(":i18n-common")) + compileOnly("com.comphenix.protocol:ProtocolLib:5.2.0-SNAPSHOT") +} + +bukkit { + main = "de.helixdevs.i18n.paper.I18nPaperPlugin" + apiVersion = "1.20" + + depend = listOf("ProtocolLib") + commands { + register("reloadtranslations") { + description = "Reloads all translations" + permission = "i18n.reloadtranslations" + } + } +} + +tasks { + assemble { + dependsOn("reobfJar", "shadowJar") + } +} \ No newline at end of file diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/I18nPaperPlugin.java b/paper/src/main/java/de/helixdevs/i18n/paper/I18nPaperPlugin.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/I18nPaperPlugin.java rename to paper/src/main/java/de/helixdevs/i18n/paper/I18nPaperPlugin.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/command/BukkitSender.java b/paper/src/main/java/de/helixdevs/i18n/paper/command/BukkitSender.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/command/BukkitSender.java rename to paper/src/main/java/de/helixdevs/i18n/paper/command/BukkitSender.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/BossbarAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/BossbarAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/BossbarAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/BossbarAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ChatAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ChatAdapter.java similarity index 93% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ChatAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ChatAdapter.java index f935348..f01fd1d 100644 --- a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ChatAdapter.java +++ b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ChatAdapter.java @@ -2,7 +2,6 @@ import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import org.bukkit.plugin.Plugin; diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/DisconnectAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/DisconnectAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/DisconnectAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/DisconnectAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EntityMetadataAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EntityMetadataAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EntityMetadataAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EntityMetadataAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EquipmentAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EquipmentAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EquipmentAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/EquipmentAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/HeaderFooterAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/HeaderFooterAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/HeaderFooterAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/HeaderFooterAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ITranslationAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ITranslationAdapter.java similarity index 86% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ITranslationAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ITranslationAdapter.java index b52d954..4305177 100644 --- a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ITranslationAdapter.java +++ b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ITranslationAdapter.java @@ -3,7 +3,6 @@ import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.AbstractStructure; import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.wrappers.AdventureComponentConverter; import com.comphenix.protocol.wrappers.EnumWrappers; import com.comphenix.protocol.wrappers.Pair; import com.comphenix.protocol.wrappers.WrappedChatComponent; @@ -59,18 +58,9 @@ default void handleChatComponent(Player player, PacketType type, PacketContainer return; } if (type == PacketType.Play.Server.SYSTEM_CHAT) { - var read = packet.getStrings().read(0); - if (read != null) { - var translate = translate(player, WrappedChatComponent.fromJson(read)); - packet.getStrings().write(0, translate.getJson()); - return; - } - var handle = packet.getStructures().read(0).getHandle(); - var translate = translate(player, AdventureComponentConverter.fromComponent( - AdventureComponentConverter.clone(handle) - )); - packet.getModifier().write(0, null); - packet.getStrings().write(0, translate.getJson()); + var handle = WrappedChatComponent.fromHandle(packet.getStructures().readSafely(0).getHandle()); + WrappedChatComponent translated = translate(player, handle); + packet.getModifier().write(0, translated.getHandle()); } } diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ObjectiveAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ObjectiveAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ObjectiveAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/ObjectiveAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/OpenWindowAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/OpenWindowAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/OpenWindowAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/OpenWindowAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/PlayerInfoAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/PlayerInfoAdapter.java similarity index 84% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/PlayerInfoAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/PlayerInfoAdapter.java index 0b2a618..a8e2511 100644 --- a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/PlayerInfoAdapter.java +++ b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/PlayerInfoAdapter.java @@ -17,11 +17,12 @@ public PlayerInfoAdapter(Plugin plugin) { @Override public void onPacketSending(PacketEvent event) { List playerInfoData = new ArrayList<>(); - event.getPacket().getPlayerInfoDataLists().read(0).forEach(data -> { + event.getPacket().getPlayerInfoDataLists().read(1).forEach(data -> { + if(data == null) return; playerInfoData.add(new PlayerInfoData(data.getProfile(), data.getLatency(), data.getGameMode(), translate(event.getPlayer(), data.getDisplayName())) ); }); - event.getPacket().getPlayerInfoDataLists().write(0, playerInfoData); + event.getPacket().getPlayerInfoDataLists().write(1, playerInfoData); } } diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/SetSlotAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/SetSlotAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/SetSlotAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/SetSlotAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TeamAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TeamAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TeamAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TeamAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TitleAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TitleAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TitleAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/TitleAdapter.java diff --git a/i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/WindowItemsAdapter.java b/paper/src/main/java/de/helixdevs/i18n/paper/protocollib/WindowItemsAdapter.java similarity index 100% rename from i18n-paper/src/main/java/de/helixdevs/i18n/paper/protocollib/WindowItemsAdapter.java rename to paper/src/main/java/de/helixdevs/i18n/paper/protocollib/WindowItemsAdapter.java diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 4c39485..0000000 --- a/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - de.helixdevs - i18n - pom - 1.2 - - i18n-common - i18n-paper - i18n-api - i18n-adventure - i18n-velocity - - - - 8 - 8 - - - - - sonatype-oss-snapshots - https://oss.sonatype.org/content/repositories/snapshots/ - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - dmulloy2-repo - https://repo.dmulloy2.net/repository/public/ - - - papermc - https://papermc.io/repo/repository/maven-public/ - - - - \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..47804d1 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,15 @@ +rootProject.name = "i18n" + +includePrefixed("adventure") +includePrefixed("api") +includePrefixed("common") +includePrefixed("paper") +includePrefixed("velocity") + +fun includePrefixed(name: String) { + val projectPath = "${rootProject.name}-${name.replace(':', '-')}" + val projectDir = file(name.replace(':', '/')) + + include(projectPath) + project(":$projectPath").projectDir = projectDir +} \ No newline at end of file diff --git a/velocity/build.gradle.kts b/velocity/build.gradle.kts new file mode 100644 index 0000000..3ae683d --- /dev/null +++ b/velocity/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("xyz.jpenilla.run-velocity") version "2.2.0" + id("com.github.johnrengelman.shadow") version "8.1.1" +} + +dependencies { + compileOnly("com.velocitypowered:velocity-api:3.2.0-SNAPSHOT") + annotationProcessor("com.velocitypowered:velocity-api:3.2.0-SNAPSHOT") + + implementation(project(":i18n-adventure")) + implementation(project(":i18n-common")) +} + +tasks { + assemble { + dependsOn("shadowJar") + } + runVelocity { + velocityVersion("3.2.0-SNAPSHOT") + } +} \ No newline at end of file diff --git a/velocity/i18n_repo/test/en_US.properties b/velocity/i18n_repo/test/en_US.properties new file mode 100644 index 0000000..8330e65 --- /dev/null +++ b/velocity/i18n_repo/test/en_US.properties @@ -0,0 +1 @@ +test=Test! \ No newline at end of file diff --git a/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java b/velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java similarity index 98% rename from i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java rename to velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java index 855a066..0f84261 100644 --- a/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java +++ b/velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java @@ -2,7 +2,6 @@ import com.google.common.reflect.TypeToken; import com.google.inject.Inject; -import com.velocitypowered.api.command.RawCommand; import com.velocitypowered.api.command.SimpleCommand; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; diff --git a/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/command/VelocitySender.java b/velocity/src/main/java/de/helixdevs/i18n/velocity/command/VelocitySender.java similarity index 100% rename from i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/command/VelocitySender.java rename to velocity/src/main/java/de/helixdevs/i18n/velocity/command/VelocitySender.java