Initial gradle configuration

This commit is contained in:
libraryaddict 2024-08-05 23:12:51 +12:00
parent 069ae4be5b
commit 0c369a4cc3
52 changed files with 1163 additions and 2312 deletions

21
.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
.gradle
**/build/
!src/**/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties
# Cache of project
.gradletasknamecache
# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

51
build.gradle.kts Normal file
View File

@ -0,0 +1,51 @@
plugins {
`java-library`
}
subprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
url = uri("https://repo.md-5.net/content/groups/public/")
}
maven {
url = uri("https://papermc.io/repo/repository/maven-public/")
}
maven {
url = uri("https://mvn.lumine.io/repository/maven-public/")
}
maven {
url = uri("https://repo.codemc.io/repository/maven-releases/")
}
maven {
url = uri("https://repo.codemc.io/repository/maven-snapshots/")
}
}
apply(plugin = "java-library")
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = "1.8"
}
group = "me.libraryaddict.disguises"
version = "1.0-SNAPSHOT"
dependencies {
implementation(rootProject.libs.org.spigotmc.spigot.api)
compileOnly(rootProject.libs.org.projectlombok.lombok)
annotationProcessor(rootProject.libs.org.projectlombok.lombok)
}
}

45
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,45 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
[versions]
com-mojang-authlib = "6.0.54"
commons-lang-commons-lang = "2.6"
io-netty-netty-buffer = "4.1.90.Final"
io-netty-netty-codec = "4.1.90.Final"
io-papermc-paper-paper-api = "1.20.3-R0.1-SNAPSHOT"
net-kyori-adventure-api = "4.17.0"
net-kyori-adventure-text-minimessage = "4.17.0"
net-kyori-adventure-text-serializer-gson = "4.17.0"
net-kyori-adventure-text-serializer-json = "4.17.0"
net-md-v5-bungeecord-chat = "1.16-R0.4"
org-spigotmc-spigot-latest = "1.21-R0.1-SNAPSHOT"
com-retro-packetevents-version = "2.4.0"
lombok-version = "1.18.34"
shadow-version = "8.1.1"
junit-version = "4.13.2"
junit-jupiter-version = "5.9.3"
mockito-version = "5.12.0"
[libraries]
com-mojang-authlib = { module = "com.mojang:authlib", version.ref = "com-mojang-authlib" }
commons-lang-commons-lang = { module = "commons-lang:commons-lang", version.ref = "commons-lang-commons-lang" }
io-netty-netty-buffer = { module = "io.netty:netty-buffer", version.ref = "io-netty-netty-buffer" }
io-netty-netty-codec = { module = "io.netty:netty-codec", version.ref = "io-netty-netty-codec" }
io-papermc-paper-paper-api = { module = "io.papermc.paper:paper-api", version.ref = "io-papermc-paper-paper-api" }
net-kyori-adventure-api = { module = "net.kyori:adventure-api", version.ref = "net-kyori-adventure-api" }
net-kyori-adventure-text-minimessage = { module = "net.kyori:adventure-text-minimessage", version.ref = "net-kyori-adventure-text-minimessage" }
net-kyori-adventure-text-serializer-gson = { module = "net.kyori:adventure-text-serializer-gson", version.ref = "net-kyori-adventure-text-serializer-gson" }
net-kyori-adventure-text-serializer-json = { module = "net.kyori:adventure-text-serializer-json", version.ref = "net-kyori-adventure-text-serializer-json" }
net-md-v5-bungeecord-chat = { module = "net.md-5:bungeecord-chat", version.ref = "net-md-v5-bungeecord-chat" }
org-spigotmc-spigot = { module = "org.spigotmc:spigot", version.ref = "org-spigotmc-spigot-latest" }
org-spigotmc-spigot-api = { module = "org.spigotmc:spigot-api", version.ref = "org-spigotmc-spigot-latest" }
com-retro-packetevents = { module = "com.github.retrooper:packetevents-spigot", version.ref = "com-retro-packetevents-version" }
org-projectlombok-lombok = { module = "org.projectlombok:lombok", version.ref = "lombok-version" }
libsdisguises-minimessage = { module = "me.libraryaddict.disguises:minimessage", version = "1.0-SNAPSHOT" }
junit-plugin = { module = "junit:junit", version.ref = "junit-version" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter-version" }
mockito = { module = "org.mockito:mockito-core", version.ref = "mockito-version" }
[plugins]
shadowjar = { id = "com.github.johnrengelman.shadow", version.ref = "shadow-version" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

252
gradlew vendored Normal file
View File

@ -0,0 +1,252 @@
#!/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 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
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 -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || 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" "$@"

94
gradlew.bat vendored Normal file
View File

@ -0,0 +1,94 @@
@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
@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

View File

@ -0,0 +1,45 @@
plugins {
alias(libs.plugins.shadowjar)
`maven-publish`
}
dependencies {
shadow(libs.net.kyori.adventure.api)
shadow(libs.net.kyori.adventure.text.minimessage)
shadow(libs.net.kyori.adventure.text.serializer.json)
shadow(libs.net.kyori.adventure.text.serializer.gson) {
exclude("*")
}
}
artifacts.add("shadow", tasks.shadowJar.get())
tasks {
jar {
isEnabled = false
}
build {
dependsOn(publish)
dependsOn(shadowJar)
}
shadowJar {
configurations = listOf(project.configurations.shadow.get())
relocate("net.kyori", "libsdisg.shaded.net.kyori")
archiveClassifier.set("shadow")
}
}
publishing {
publications {
create<MavenPublication>("relocated") {
artifact(tasks["shadowJar"]) {
classifier = null
}
}
}
repositories {
mavenLocal()
}
}

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>minimessage</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper-api.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>${adventure-minimessage.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>${adventure-minimessage.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json</artifactId>
<version>${adventure-text.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
<version>${adventure-text.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${basedir}/target/minimessage-1.0-SNAPSHOT.jar</file>
<type>jar</type>
<classifier>optional</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactSet>
<includes>
<include>net.kyori:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>libsdisg.shaded.net.kyori</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
</project>

40
nms/nmsModule.gradle Normal file
View File

@ -0,0 +1,40 @@
// Code copied from https://github.com/Shopkeepers/Shopkeepers/tree/master
apply plugin: 'java-library'
apply from: rootProject.file('nms/specialSource.gradle')
ext {
// This needs to be defined by projects that apply this script.
craftbukkitVersion = 'UNSPECIFIED'
// This can be overridden by projects that apply this script.
remapServerCode = true
}
dependencies {
implementation project(':shared')
afterEvaluate {
if (remapServerCode) {
implementation "org.spigotmc:spigot:${craftbukkitVersion}:remapped-mojang"
} else {
implementation "org.spigotmc:spigot:${craftbukkitVersion}"
}
}
}
afterEvaluate {
if (remapServerCode) {
jar {
doLast {
def outputFiles = outputs.files.files
for (inputFile in outputFiles) {
File intermediateFile = new File(temporaryDir, inputFile.name.replace('.jar', '-obf.jar'))
File outputFile = inputFile
remapMojangToSpigot(inputFile, intermediateFile, outputFile, craftbukkitVersion)
}
}
}
}
}
// Note: The NMS modules are not published as standalone artifacts, but are shaded into the final plugin jar.

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>nms</artifactId>
<packaging>pom</packaging>
<parent>
<artifactId>parent</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>shared</artifactId>
<version>1.0-SNAPSHOT</version>
<optional>true</optional>
</dependency>
</dependencies>
<modules>
<module>v1_17_R1</module>
<module>v1_18_R1</module>
<module>v1_18_R2</module>
<module>v1_19_R1</module>
<module>v1_19_R2</module>
<module>v1_19_R3</module>
<module>v1_20_R1</module>
<module>v1_20_R2</module>
<module>v1_20_R3</module>
<module>v1_20_R4</module>
<module>v1_21_R1</module>
</modules>
</project>

73
nms/specialSource.gradle Normal file
View File

@ -0,0 +1,73 @@
// Code copied from https://github.com/Shopkeepers/Shopkeepers/tree/master
buildscript {
repositories {
mavenCentral()
}
configurations.create('specialSource')
dependencies {
specialSource 'net.md-5:SpecialSource:1.11.4:shaded'
}
}
// Spigot server code remapping: https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/
// These dependencies and mappings are installed into the local Maven repository when BuildTools builds the Spigot dependencies.
def m2Repo = new File(repositories.mavenLocal().url.path)
def remappedMojang = new File(m2Repo, 'org/spigotmc/spigot/{craftbukkitVersion}/spigot-{craftbukkitVersion}-remapped-mojang.jar').path
def remappedObf = new File(m2Repo, 'org/spigotmc/spigot/{craftbukkitVersion}/spigot-{craftbukkitVersion}-remapped-obf.jar').path
def mojangMappings = new File(m2Repo, 'org/spigotmc/minecraft-server/{craftbukkitVersion}/minecraft-server-{craftbukkitVersion}-maps-mojang.txt').path
def spigotMappings = new File(m2Repo, 'org/spigotmc/minecraft-server/{craftbukkitVersion}/minecraft-server-{craftbukkitVersion}-maps-spigot.csrg').path
def specialSource = buildscript.configurations.specialSource.resolvedConfiguration.getFirstLevelModuleDependencies().find {
it.moduleGroup == 'net.md-5' && it.moduleName == 'SpecialSource'
}.moduleArtifacts.first().file.path
// Converts from Mojang's mappings to Minecraft's obfuscated mappings.
ext.remapMojangToObfuscated = { inputFile, outputFile, craftbukkitVersion ->
println '> remapMojangToObfuscated'
println ' Input: ' + inputFile.path
println ' Output: ' + outputFile.path
println ' CraftBukkit version: ' + craftbukkitVersion
def classpathSeparator = System.properties['path.separator']
exec {
commandLine 'java',
'-cp', "${specialSource}${classpathSeparator}${remappedMojang}".replace('{craftbukkitVersion}', craftbukkitVersion),
'net.md_5.specialsource.SpecialSource',
'--live',
'-i', inputFile.path,
'-o', outputFile.path,
'-m', mojangMappings.replace('{craftbukkitVersion}', craftbukkitVersion),
'--reverse'
}
}
// Converts from Minecraft's obfuscated mappings to Spigot's mappings.
ext.remapObfuscatedToSpigot = { inputFile, outputFile, craftbukkitVersion ->
println '> remapObfuscatedToSpigot'
println ' Input: ' + inputFile.path
println ' Output: ' + outputFile.path
println ' CraftBukkit version: ' + craftbukkitVersion
def classpathSeparator = System.properties['path.separator']
exec {
commandLine 'java',
'-cp', "${specialSource}${classpathSeparator}${remappedObf}".replace('{craftbukkitVersion}', craftbukkitVersion),
'net.md_5.specialsource.SpecialSource',
'--live',
'-i', inputFile.path,
'-o', outputFile.path,
'-m', spigotMappings.replace('{craftbukkitVersion}', craftbukkitVersion)
}
}
// Converts from Mojang's mappings to Spigot's mappings.
ext.remapMojangToSpigot = { inputFile, intermediateFile, outputFile, craftbukkitVersion ->
println '> remapMojangToSpigot'
println ' Input: ' + inputFile.path
println ' Intermediate: ' + intermediateFile.path
println ' Output: ' + outputFile.path
println ' CraftBukkit version: ' + craftbukkitVersion
remapMojangToObfuscated(inputFile, intermediateFile, craftbukkitVersion)
remapObfuscatedToSpigot(intermediateFile, outputFile, craftbukkitVersion)
}

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.17.1-R0.1-SNAPSHOT"
description = "v1_17_R1"

View File

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_17_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.17.1-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.18.1-R0.1-SNAPSHOT"
description = "v1_18_R1"

View File

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_18_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.18.1-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>4.1.27</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.18.2-R0.1-SNAPSHOT"
description = "v1_18_R2"

View File

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_18_R2</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.18.2-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>4.1.27</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.19.1-R0.1-SNAPSHOT"
description = "v1_19_R1"

View File

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_19_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.19.1-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.19.3-R0.1-SNAPSHOT"
description = "v1_19_R2"

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_19_R2</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.19.3-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.18</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.19.4-R0.1-SNAPSHOT"
description = "v1_19_R3"

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_19_R3</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.19.4-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.18</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.20-R0.1-SNAPSHOT"
description = "v1_20_R1"

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_20_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.20-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.18</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.20.2-R0.1-SNAPSHOT"
description = "v1_20_R2"

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_20_R2</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.20.2-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>5.0.47</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.18</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.20.3-R0.1-SNAPSHOT"
description = "v1_20_R3"

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_20_R3</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.20.3-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>5.0.47</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.18</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.20.6-R0.1-SNAPSHOT"
description = "v1_20_R4"

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_20_R4</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.20.6-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>6.0.54</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>7.0.14</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.2.9</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
plugins {
`java-library`
}
apply(from = rootProject.file("nms/nmsModule.gradle"))
extra["craftbukkitVersion"] = "1.21-R0.1-SNAPSHOT";
description = "v1_21_R1"

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>nms</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>v1_21_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.8</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>6.0.54</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>7.0.14</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.2.9</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>2.0.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>target/${project.build.finalName}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
<remappedClassifierName>remapped-spigot</remappedClassifierName>
<remappedArtifactAttached>true</remappedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

47
plugin/build.gradle.kts Normal file
View File

@ -0,0 +1,47 @@
plugins {
`maven-publish`
}
version = "10.0.44-SNAPSHOT"
dependencies {
compileOnly(project(":shared"))
compileOnly(libs.io.netty.netty.buffer)
compileOnly(libs.io.netty.netty.codec)
compileOnly(libs.commons.lang.commons.lang)
compileOnly(libs.com.mojang.authlib)
compileOnly(libs.org.spigotmc.spigot.api)
compileOnly(libs.com.retro.packetevents)
compileOnly(libs.libsdisguises.minimessage)
compileOnly(libs.io.papermc.paper.paper.api);
}
publishing {
repositories {
// maven {
// name = "md_5-releases"
// url = uri("https://repo.md-5.net/content/repositories/releases/")
// credentials {
// username = project.findProperty("repoUser") as String? ?: System.getenv("REPO_USER")
// password = project.findProperty("repoPassword") as String? ?: System.getenv("REPO_PASSWORD")
// }
// }
// maven {
// name = "md_5-snapshots"
// url = uri("https://repo.md-5.net/content/repositories/snapshots/")
// credentials {
// username = project.findProperty("repoUser") as String? ?: System.getenv("REPO_USER")
// password = project.findProperty("repoPassword") as String? ?: System.getenv("REPO_PASSWORD")
// }
// }
mavenLocal()
}
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
groupId = "LibsDisguises"
artifactId = "LibsDisguises"
}
}
}

View File

@ -1,153 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>LibsDisguises</artifactId>
<version>${libsdisguises.version}</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>default-install</id>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>default-deploy</id>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>minimessage</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>shared</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper-api.version}</version>
<scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
<version>${bungeecord-chat.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<!--NMS Packages-->
<!-- Libraries -->
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.12</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>5.0.51</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.18</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -187,8 +187,6 @@ public class DisguiseConfig {
@Getter
@Setter
private static int maxClonedDisguises;
@Getter
@Setter
private static int uuidGeneratedVersion;
@Getter
@Setter

View File

@ -349,14 +349,14 @@ public class LibsDisguises extends JavaPlugin {
buildNumber = StringUtils.stripToNull(pluginYml.getString("build-number"));
buildDate = StringUtils.stripToNull(pluginYml.getString("build-date"));
int fileCount = ReflectionManager.getJarFileCount(getFile(), LibsPremium.ignoredDirectories());
int fileCount = ReflectionManager.getJarFileCount(getFile());
int expected = pluginYml.getInt("file-count", fileCount);
if (fileCount != expected) {
getLogger().severe(
"Hi, this is libraryaddict from Lib's Disguises informing you that I have detected that my plugin Lib's Disguises looks " +
"like another plugin (unknown) has injected malware into it as soon as it started running on your server, there were " +
(fileCount - expected) +
"like another plugin (don't know which) has injected malware into it as soon as Lib's Disguises started running on " +
"your server, there were " + (fileCount - expected) +
" unknown files injected into the jar. Please redownload from a trusted source such as SpigotMC. If this warning " +
"shows even after updating, try https://www.spigotmc.org/resources/spigot-anti-malware.64982/ but you will likely " +
"need to reinstall all your plugins, jars, etc as just one infected plugin will infect everything else when it loads.");

View File

@ -285,7 +285,6 @@ public class DisguiseUtilities {
private static final HashMap<UUID, ArrayList<Integer>> disguiseLoading = new HashMap<>();
@Getter
private static boolean runningPaper;
@Getter
private static MineSkinAPI mineSkinAPI;
@Getter
private static boolean invalidFile;

View File

@ -410,7 +410,9 @@ public class ReflectionManager {
}
public static long getGameTime(Entity entity) {
if (entity==null||entity.getWorld()==null ||!NmsVersion.v1_19_R3.isSupported())return 0L;
if (entity == null || entity.getWorld() == null || !NmsVersion.v1_19_R3.isSupported()) {
return 0L;
}
return entity.getWorld().getGameTime();
}
@ -504,28 +506,17 @@ public class ReflectionManager {
return null;
}
public static int getJarFileCount(File file, String... ignoredDirectories) throws IOException {
public static int getJarFileCount(File file) throws IOException {
try (JarFile jar = new JarFile(file)) {
int count = 0;
Enumeration<JarEntry> entry = jar.entries();
loop:
while (entry.hasMoreElements()) {
JarEntry element = entry.nextElement();
if (element.isDirectory()) {
if (entry.nextElement().isDirectory()) {
continue;
}
for (String ignored : ignoredDirectories) {
if (!element.getName().startsWith(ignored)) {
continue;
}
continue loop;
}
count++;
}

View File

@ -11,6 +11,7 @@ import java.util.HashMap;
/**
* Only living disguises go in here!
*/
@Getter
public enum DisguiseSoundEnums {
ALLAY(Sound.ENTITY_ALLAY_HURT, null, Sound.ENTITY_ALLAY_DEATH,
new Sound[]{Sound.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM, Sound.ENTITY_ALLAY_AMBIENT_WITH_ITEM}, Sound.ENTITY_ALLAY_ITEM_GIVEN,
@ -184,7 +185,7 @@ public enum DisguiseSoundEnums {
Sound.ENTITY_PANDA_SNEEZE),
PARROT(Sound.ENTITY_PARROT_HURT, Sound.ENTITY_PARROT_STEP, Sound.ENTITY_PARROT_DEATH, Sound.ENTITY_PARROT_AMBIENT,
Arrays.stream(Sound.values()).filter(
(Object) Arrays.stream(Sound.values()).filter(
sound -> sound.name().contains("PARROT_IMITATE") || sound == Sound.ENTITY_PARROT_EAT || sound == Sound.ENTITY_PARROT_FLY)
.toArray(Sound[]::new)),
@ -328,7 +329,6 @@ public enum DisguiseSoundEnums {
ZOMBIFIED_PIGLIN(Sound.ENTITY_ZOMBIFIED_PIGLIN_HURT, null, Sound.ENTITY_ZOMBIFIED_PIGLIN_DEATH, Sound.ENTITY_ZOMBIFIED_PIGLIN_AMBIENT,
Sound.ENTITY_ZOMBIFIED_PIGLIN_ANGRY, Sound.ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED);
@Getter
private final HashMap<String, SoundType> sounds = new HashMap<>();
DisguiseSoundEnums(Object hurt, Object step, Object death, Object idle, Object... sounds) {

170
pom.xml
View File

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- A good example on why temporary names for project identification shouldn't be used -->
<groupId>LibsDisguises</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>shared</module>
<module>nms</module>
<module>minimessage</module>
<module>plugin</module>
<module>shaded</module>
</modules>
<properties>
<libsdisguises.version>10.0.44-SNAPSHOT</libsdisguises.version>
<build.number>unknown</build.number>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>dd/MM/yyyy HH:mm</maven.build.timestamp.format>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lombok.version>1.18.32</lombok.version>
<packetevents.version>2.4.0</packetevents.version>
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
<junit.version>4.13.2</junit.version>
<junit-jupiter.version>5.9.3</junit-jupiter.version>
<paper-api.version>1.20.3-R0.1-SNAPSHOT</paper-api.version>
<bungeecord-chat.version>1.16-R0.4</bungeecord-chat.version>
<adventure-minimessage.version>4.17.0</adventure-minimessage.version>
<adventure-text.version>4.17.0</adventure-text.version>
<mockito.version>5.12.0</mockito.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>default-install</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<id>default-deploy</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.retrooper</groupId>
<artifactId>packetevents-spigot</artifactId>
<optional>true</optional>
<scope>compile</scope>
</dependency>
<!-- Tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.retrooper</groupId>
<artifactId>packetevents-spigot</artifactId>
<version>${packetevents.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>${spigot.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>md_5-releases</id>
<url>https://repo.md-5.net/content/groups/public/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<!-- Lumine is a repo hosted by the creators of MythicCraft -->
<repository>
<id>nexus</id>
<name>Lumine Releases</name>
<url>https://mvn.lumine.io/repository/maven-public/</url>
</repository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>md_5-releases</id>
<url>https://repo.md-5.net/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>md_5-snapshots</id>
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>

9
settings.gradle.kts Normal file
View File

@ -0,0 +1,9 @@
rootProject.name = "LibsDisguises"
include("minimessage")
include("shared", "plugin", "shaded")
val nmsModules = File(rootDir, "nms").listFiles()!!.filter { s -> s.isDirectory() && s.name.matches("v[\\d_]+R\\d+".toRegex()) }.map { s -> ":nms:" + s.name };
gradle.extra["nmsModules"] = nmsModules
include(nmsModules)

117
shaded/build.gradle.kts Normal file
View File

@ -0,0 +1,117 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
plugins {
`java`
alias(libs.plugins.shadowjar)
application
}
tasks {
build {
dependsOn("shadowJar")
dependsOn("run")
dependsOn(getByName("jenkins"))
}
task("publish") {
dependsOn("build")
}
shadowJar {
configurations = listOf(project.configurations.shadow.get())
exclude("**/CompileMethods.class")
}
getByName("run") {
mustRunAfter(shadowJar)
}
task("jenkins") {
mustRunAfter("run")
doLast {
copy {
from(shadowJar.get().archiveFile.get().asFile.absolutePath)
into(rootProject.projectDir.absolutePath + "\\target")
rename {
"LibsDisguises.jar"
}
}
}
}
processResources {
// Always inject timestamp & version
outputs.upToDateWhen { false }
var number = "unknown";
if (gradle.startParameter.taskNames.contains("publish")) {
number = System.getProperty("build.number", "unknown");
}
filesMatching("plugin.yml") {
expand(
"libsdisguisesVersion" to project(":plugin").version,
"timestamp" to DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm").format(LocalDateTime.now()),
"buildNumber" to number
)
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_21
}
application {
mainClass = "me.libraryaddict.disguise.utilities.watchers.CompileMethods"
applicationDefaultJvmArgs = listOf(
"-Djar.path=" + tasks.named<ShadowJar>("shadowJar").get().archiveFile.get().asFile.absolutePath
)
}
testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()
}
}
}
dependencies {
shadow(libs.libsdisguises.minimessage) {
exclude("*")
}
shadow(project(":shared")) {
exclude("*")
}
shadow(project(":plugin")) {
exclude("*")
}
runtimeOnly(project(":plugin"))
runtimeOnly(libs.com.retro.packetevents)
(gradle.extra["nmsModules"] as List<*>).map { s -> project(s as String) }.forEach {
shadow(it) {
exclude("*")
}
}
testCompileOnly(libs.org.projectlombok.lombok)
testAnnotationProcessor(libs.org.projectlombok.lombok)
testImplementation(project(":shared"))
testImplementation(project(":plugin"))
testImplementation(libs.libsdisguises.minimessage)
testImplementation(libs.mockito)
testImplementation(libs.com.retro.packetevents)
testImplementation(libs.net.kyori.adventure.api)
testImplementation(libs.net.kyori.adventure.text.minimessage)
testImplementation(libs.net.kyori.adventure.text.serializer.gson)
testImplementation(libs.net.kyori.adventure.text.serializer.json)
testRuntimeOnly(libs.org.spigotmc.spigot.api)
testRuntimeOnly(libs.org.spigotmc.spigot)
}

View File

@ -1,272 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>shaded</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>exec:java clean package</defaultGoal>
<finalName>LibsDisguises</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>plugin.yml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>README.md</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>../target</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>my-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>me.libraryaddict.disguise.utilities.watchers.CompileMethods</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<artifact>LibsDisguises:*</artifact>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>META-INF/**/v*/**</exclude>
</excludes>
</filter>
</filters>
<artifactSet>
<includes>
<include>LibsDisguises:*</include>
</includes>
</artifactSet>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>minimessage</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>shared</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>${libsdisguises.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_17_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_18_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_18_R2</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_19_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_19_R2</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_19_R3</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_20_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_20_R2</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_20_R3</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_20_R4</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>v1_21_R1</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>remapped-spigot</classifier>
<scope>compile</scope>
</dependency>
<!-- Libraries -->
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.12</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>5.0.51</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>datafixerupper</artifactId>
<version>5.0.28</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.18</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -16,59 +16,85 @@ import me.libraryaddict.disguise.utilities.reflection.annotations.NmsAddedIn;
import me.libraryaddict.disguise.utilities.reflection.annotations.NmsRemovedIn;
import me.libraryaddict.disguise.utilities.sounds.DisguiseSoundEnums;
import me.libraryaddict.disguise.utilities.sounds.SoundGroup;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
public class CompileMethods {
public static void main(String[] args) {
doMethods();
doSounds();
doFileCount();
Path zipFilePath = Paths.get(System.getProperty("jar.path"));
try (FileSystem fs = FileSystems.newFileSystem(zipFilePath, (ClassLoader) null)) {
Files.write(fs.getPath("/METHOD_MAPPINGS.txt"), doMethods());
Files.write(fs.getPath("/SOUND_MAPPINGS.txt"), doSounds());
// Count after we write the mappings
Files.write(fs.getPath("/plugin.yml"), doFileCount());
} catch (IOException e) {
e.printStackTrace();
}
}
private static void doFileCount() {
int totalCount = 0;
private static int getJarFileCount(File file, String... skipFiles) {
try (JarFile jar = new JarFile(file)) {
int count = 0;
for (String folder : new String[]{"plugin/target/classes", "shaded/target/classes"}) {
totalCount += getFileCount(new File(folder));
}
Enumeration<JarEntry> entries = jar.entries();
try {
Files.write(new File(new File("shaded/target/classes"), "plugin.yml").toPath(),
("\nfile-count: " + totalCount).getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
loop:
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.isDirectory()) {
continue;
}
for (String skipFile : skipFiles) {
if (!skipFile.equals(entry.getName())) {
continue;
}
continue loop;
}
count++;
}
return count;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static int getFileCount(File folder) {
int count = 0;
private static byte[] doFileCount() {
int totalCount = getJarFileCount(new File(System.getProperty("jar.path")), "METHOD_MAPPINGS.txt", "SOUND_MAPPINGS.txt") + 2;
for (File f : folder.listFiles()) {
if (f.isFile()) {
count++;
} else {
count += getFileCount(f);
}
try {
Path path = new File(new File("build/resources/main"), "plugin.yml").toPath();
String pluginYaml =
Files.readString(path, StandardCharsets.UTF_8).replaceFirst("file-count: -?\\d+", "file-count: " + totalCount);
return pluginYaml.getBytes(StandardCharsets.UTF_8);
} catch (IOException e) {
throw new RuntimeException(e);
}
return count;
}
private static void doSounds() {
private static byte[] doSounds() {
List<String> list = new ArrayList<>();
for (DisguiseSoundEnums e : DisguiseSoundEnums.values()) {
@ -77,16 +103,9 @@ public class CompileMethods {
list.add(sound.toString());
}
File soundsFile = new File("shaded/target/classes/SOUND_MAPPINGS.txt");
try (FileOutputStream fos = new FileOutputStream(soundsFile)) {
fos.write(String.join("\n", list).getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
return String.join("\n", list).getBytes(StandardCharsets.UTF_8);
}
@NotNull
private static StringBuilder getSoundAsString(DisguiseSoundEnums e) {
StringBuilder sound = new StringBuilder(e.name());
@ -122,7 +141,7 @@ public class CompileMethods {
classes.add(c);
}
private static void doMethods() {
private static byte[] doMethods() {
ArrayList<Class<?>> classes =
ClassGetter.getClassesForPackage(FlagWatcher.class, "me.libraryaddict.disguise.disguisetypes.watchers");
@ -258,15 +277,7 @@ public class CompileMethods {
throw new IllegalStateException("Methods were not compiled");
}
String gson = new Gson().toJson(methods);
File methodsFile = new File("shaded/target/classes/METHOD_MAPPINGS.txt");
try (FileOutputStream fos = new FileOutputStream(methodsFile)) {
fos.write(gson.getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
return new Gson().toJson(methods).getBytes(StandardCharsets.UTF_8);
}
static String getDescriptorForClass(final Class c) {

View File

@ -1,13 +1,14 @@
name: LibsDisguises
main: me.libraryaddict.disguise.LibsDisguises
description: A disguise plugin with various disguises.
version: ${libsdisguises.version}
version: ${libsdisguisesVersion}
build-date: ${timestamp}
build-number: ${build.number}
build-number: ${buildNumber}
author: libraryaddict
authors: [ Byteflux, Navid K. ]
softdepend: [ packetevents ]
api-version: '1.13'
file-count: 0
commands:
libsdisguises:
aliases: [ libsdisg, ld ]

View File

@ -6,11 +6,12 @@ import me.libraryaddict.disguise.utilities.parser.WatcherMethod;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.junit.Assert;
import java.lang.invoke.MethodHandle;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.fail;
public class DisguiseCloneTest {
/**
@ -94,7 +95,7 @@ public class DisguiseCloneTest {
if (!dString.equals(cString)) {
System.err.println(dString);
System.err.println(cString);
Assert.fail("Cloned disguise is not the same!");
fail("Cloned disguise is not the same!");
}
}
} catch (Exception ex) {

View File

@ -1,72 +1,71 @@
package me.libraryaddict.disguise.utilities;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class DisguiseUtilitiesTest {
@Test
public void testNewlineSplitter() {
Assert.assertArrayEquals(new String[]{"Name 1", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\nName 2"));
Assert.assertArrayEquals(new String[]{"Name 1", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\\nName 2"));
Assert.assertArrayEquals(new String[]{"Name 1\\", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\\\nName 2"));
Assert.assertArrayEquals(new String[]{"Name 1\\nName 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\nName 2"));
Assert.assertArrayEquals(new String[]{"Name 1\\", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\\\nName 2"));
Assert.assertArrayEquals(new String[]{"Name 1\\\\nName 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\\\\\nName 2"));
assertArrayEquals(new String[]{"Name 1", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\nName 2"));
assertArrayEquals(new String[]{"Name 1", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\\nName 2"));
assertArrayEquals(new String[]{"Name 1\\", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\\\nName 2"));
assertArrayEquals(new String[]{"Name 1\\nName 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\nName 2"));
assertArrayEquals(new String[]{"Name 1\\", "Name 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\\\nName 2"));
assertArrayEquals(new String[]{"Name 1\\\\nName 2"}, DisguiseUtilities.splitNewLine("Name 1\\\\\\\\nName 2"));
}
@Test
public void testQuoteSplitter() {
// Test if splits are correct
Assert.assertArrayEquals(new String[]{"A", "simple", "string"}, DisguiseUtilities.split("A simple string"));
assertArrayEquals(new String[]{"A", "simple", "string"}, DisguiseUtilities.split("A simple string"));
Assert.assertArrayEquals(new String[]{"A quoted string"}, DisguiseUtilities.split("\"A quoted string\""));
assertArrayEquals(new String[]{"A quoted string"}, DisguiseUtilities.split("\"A quoted string\""));
Assert.assertArrayEquals(new String[]{"\"A double quoted string\""}, DisguiseUtilities.split("\"\"A double quoted string\"\""));
assertArrayEquals(new String[]{"\"A double quoted string\""}, DisguiseUtilities.split("\"\"A double quoted string\"\""));
Assert.assertArrayEquals(new String[]{"A", "string", "containing a", "quote"},
DisguiseUtilities.split("A string \"containing a\" quote"));
assertArrayEquals(new String[]{"A", "string", "containing a", "quote"}, DisguiseUtilities.split("A string \"containing a\" quote"));
Assert.assertArrayEquals(new String[]{"A", "string", "fully", "split"}, DisguiseUtilities.split("\"A\" string fully split"));
assertArrayEquals(new String[]{"A", "string", "fully", "split"}, DisguiseUtilities.split("\"A\" string fully split"));
Assert.assertArrayEquals(new String[]{"A", "string", "fully", "split"}, DisguiseUtilities.split("\"A\" \"string\" fully split"));
assertArrayEquals(new String[]{"A", "string", "fully", "split"}, DisguiseUtilities.split("\"A\" \"string\" fully split"));
Assert.assertArrayEquals(new String[]{"A", "string", "fully", "split"}, DisguiseUtilities.split("A \"string\" fully split"));
assertArrayEquals(new String[]{"A", "string", "fully", "split"}, DisguiseUtilities.split("A \"string\" fully split"));
// Test if quotes are ignored properly and included in result
Assert.assertArrayEquals(new String[]{"A", "\"string", "fully", "split"}, DisguiseUtilities.split("A \"string fully split"));
assertArrayEquals(new String[]{"A", "\"string", "fully", "split"}, DisguiseUtilities.split("A \"string fully split"));
Assert.assertArrayEquals(new String[]{"A", "\"string", "\"fully", "split"}, DisguiseUtilities.split("A \"string \"fully split"));
assertArrayEquals(new String[]{"A", "\"string", "\"fully", "split"}, DisguiseUtilities.split("A \"string \"fully split"));
Assert.assertArrayEquals(new String[]{"\"A", "\"string", "\"fully", "split"},
DisguiseUtilities.split("\"A \"string \"fully split"));
assertArrayEquals(new String[]{"\"A", "\"string", "\"fully", "split"}, DisguiseUtilities.split("\"A \"string \"fully split"));
Assert.assertArrayEquals(new String[]{"A", "string\"", "fully", "split"}, DisguiseUtilities.split("A string\" fully split"));
assertArrayEquals(new String[]{"A", "string\"", "fully", "split"}, DisguiseUtilities.split("A string\" fully split"));
Assert.assertArrayEquals(new String[]{"A", "string\"", "fully\"", "split"}, DisguiseUtilities.split("A string\" fully\" split"));
assertArrayEquals(new String[]{"A", "string\"", "fully\"", "split"}, DisguiseUtilities.split("A string\" fully\" split"));
Assert.assertArrayEquals(new String[]{"A", "string", "fully\"", "split"}, DisguiseUtilities.split("A \"string\" fully\" split"));
assertArrayEquals(new String[]{"A", "string", "fully\"", "split"}, DisguiseUtilities.split("A \"string\" fully\" split"));
Assert.assertArrayEquals(new String[]{"A \"string", "with", "four", "splits"},
DisguiseUtilities.split("\"A \"string\" with four splits"));
assertArrayEquals(new String[]{"A \"string", "with", "four", "splits"}, DisguiseUtilities.split("\"A \"string\" with four splits"));
// Test for quotes inside words
Assert.assertArrayEquals(new String[]{"Fully", "split", "\"", "message"}, DisguiseUtilities.split("Fully split \"\"\" message"));
assertArrayEquals(new String[]{"Fully", "split", "\"", "message"}, DisguiseUtilities.split("Fully split \"\"\" message"));
// Test to make sure space can be quoted, with an empty quote at the end
Assert.assertArrayEquals(new String[]{" ", "\""}, DisguiseUtilities.split("\" \" \""));
assertArrayEquals(new String[]{" ", "\""}, DisguiseUtilities.split("\" \" \""));
// Test to make sure empty quotes, are still quotes
Assert.assertArrayEquals(new String[]{"Three", "", "split"}, DisguiseUtilities.split("Three \"\" split"));
assertArrayEquals(new String[]{"Three", "", "split"}, DisguiseUtilities.split("Three \"\" split"));
// Test to ensure single quotes, are still not quotes
Assert.assertArrayEquals(new String[]{"'Three", "split", "message'"}, DisguiseUtilities.split("'Three split message'"));
assertArrayEquals(new String[]{"'Three", "split", "message'"}, DisguiseUtilities.split("'Three split message'"));
// There is a quoted message inside the quoted message, however it was not escaped
Assert.assertArrayEquals(new String[]{"A", "quoted message \"inside a quoted message\""},
assertArrayEquals(new String[]{"A", "quoted message \"inside a quoted message\""},
DisguiseUtilities.split("A \"quoted message \"inside a quoted message\"\""));
// Now test for escaped quotes, however as escaped quotes look different inside editors, I'll be replacing \
@ -118,15 +117,15 @@ public class DisguiseUtilitiesTest {
String quoted = DisguiseUtilities.quote(string);
String[] split = DisguiseUtilities.split(quoted);
Assert.assertEquals(1, split.length);
Assert.assertEquals(string, split[0]);
assertEquals(1, split.length);
assertEquals(string, split[0]);
}
private void splitEquals(String toSplit, String... expected) {
String[] splitted = DisguiseUtilities.split(toSplit.replace("/", "\\").replace("'", "\""));
String[] expect = Arrays.stream(expected).map(string -> string.replace("/", "\\").replace("'", "\"")).toArray(String[]::new);
Assert.assertArrayEquals(expect, splitted);
assertArrayEquals(expect, splitted);
splitAndBack(toSplit);
}
@ -155,15 +154,14 @@ public class DisguiseUtilitiesTest {
@Test
public void testYaw() {
Assertions.assertEquals(180, DisguiseUtilities.getYaw(DisguiseType.MINECART, DisguiseType.PLAYER, 90));
assertEquals(180, DisguiseUtilities.getYaw(DisguiseType.MINECART, DisguiseType.PLAYER, 90));
}
@Test
public void testQuoter() {
Assertions.assertEquals("\"&c10.0 ❤ &8| &5Prokurator &8(&7poz. 1&8)\"",
DisguiseUtilities.quote("&c10.0 ❤ &8| &5Prokurator &8(&7poz. 1&8)"));
Assertions.assertEquals("String", DisguiseUtilities.quote("String"));
Assertions.assertEquals("\"\"String\"", DisguiseUtilities.quote("\"String"));
Assertions.assertEquals("\"String 2\"", DisguiseUtilities.quote("String 2"));
assertEquals("\"&c10.0 ❤ &8| &5Prokurator &8(&7poz. 1&8)\"", DisguiseUtilities.quote("&c10.0 ❤ &8| &5Prokurator &8(&7poz. 1&8)"));
assertEquals("String", DisguiseUtilities.quote("String"));
assertEquals("\"\"String\"", DisguiseUtilities.quote("\"String"));
assertEquals("\"String 2\"", DisguiseUtilities.quote("String 2"));
}
}

View File

@ -4,13 +4,15 @@ import lombok.SneakyThrows;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
import org.bukkit.Bukkit;
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.util.ArrayList;
import java.util.Arrays;
@ -20,27 +22,36 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class DisguisePermissionsTest {
@BeforeAll
public static void beforeAll() {
Mockito.mockStatic(Bukkit.class).when(Bukkit::getConsoleSender).thenReturn(null);
}
@Test
public void testDisguisesExist() {
Assert.assertNull("There should not be a reindeer disguise", DisguiseParser.getDisguisePerm("Reindeer"));
assertNull(DisguiseParser.getDisguisePerm("Reindeer"), "There should not be a reindeer disguise");
Assert.assertNotNull("There should be a cow disguise", DisguiseParser.getDisguisePerm("Cow"));
assertNotNull(DisguiseParser.getDisguisePerm("Cow"), "There should be a cow disguise");
Assert.assertNotNull("There should be a firework disguise", DisguiseParser.getDisguisePerm("Firework"));
assertNotNull(DisguiseParser.getDisguisePerm("Firework"), "There should be a firework disguise");
}
@Test
public void testPermissionNames() {
Assert.assertFalse("There should not be permissions", createPermissions("Disguise", false).hasPermissions());
assertFalse(createPermissions("Disguise", false).hasPermissions(), "There should not be permissions");
Assert.assertFalse("The commands should not match",
createPermissions("Disguise", false, "libsdisguises.disguiseentity.cow").hasPermissions());
assertFalse(createPermissions("Disguise", false, "libsdisguises.disguiseentity.cow").hasPermissions(),
"The commands should not match");
Assert.assertFalse("The commands should not match",
createPermissions("Disguised", false, "libsdisguises.disguise.cow").hasPermissions());
assertFalse(createPermissions("Disguised", false, "libsdisguises.disguise.cow").hasPermissions(), "The commands should not match");
Assert.assertTrue("There should be permissions", createPermissions("Disguise", false, "libsdisguises.*.animal").hasPermissions());
assertTrue(createPermissions("Disguise", false, "libsdisguises.*.animal").hasPermissions(), "There should be permissions");
}
@Test
@ -48,47 +59,47 @@ public class DisguisePermissionsTest {
DisguisePermissions permissions =
createPermissions("Disguise", true, "-libsdisguises.disguise.sheep", "-libsdisguises.disguise.horse.setBaby");
Assert.assertTrue("There should be permissions", permissions.hasPermissions());
assertTrue(permissions.hasPermissions(), "There should be permissions");
Assert.assertTrue("The disguise cow should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")), "The disguise cow should be allowed");
Assert.assertFalse("The disguise sheep should not be allowed",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")), "The disguise sheep should not be allowed");
Assert.assertTrue("The disguise horse should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse")), "The disguise horse should be allowed");
Assert.assertFalse("The disguise horse should not be allowed with setBaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse"), Collections.singletonList("setBaby")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse"), Collections.singletonList("setBaby")),
"The disguise horse should not be allowed with setBaby");
}
@Test
public void testWildcardsPermissions() {
Assert.assertTrue("The cow disguise should be allowed",
createPermissions("Disguise", false, "libsdisguises.*.animal").isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
assertTrue(createPermissions("Disguise", false, "libsdisguises.*.animal").isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")),
"The cow disguise should be allowed");
Assert.assertFalse("The firework disguise should not be allowed",
createPermissions("Disguise", false, "libsdisguises.*.animal").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
assertFalse(
createPermissions("Disguise", false, "libsdisguises.*.animal").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")),
"The firework disguise should not be allowed");
Assert.assertTrue("The firework disguise should be allowed",
createPermissions("Disguise", false, "libsdisguises.*.*").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
assertTrue(createPermissions("Disguise", false, "libsdisguises.*.*").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")),
"The firework disguise should be allowed");
Assert.assertTrue("The firework disguise should be allowed",
createPermissions("Disguise", false, "libsdisguises.disguise.*").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
assertTrue(
createPermissions("Disguise", false, "libsdisguises.disguise.*").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")),
"The firework disguise should be allowed");
Assert.assertTrue("The firework disguise should be allowed",
createPermissions("Disguise", false, "libsdisguises.*.Firework").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
assertTrue(
createPermissions("Disguise", false, "libsdisguises.*.Firework").isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")),
"The firework disguise should be allowed");
Assert.assertFalse("The firework disguise should not be allowed",
createPermissions("Disguise", false, "libsdisguises.*.*", "-libsdisguises.*.misc").isAllowedDisguise(
DisguiseParser.getDisguisePerm("Firework")));
assertFalse(createPermissions("Disguise", false, "libsdisguises.*.*", "-libsdisguises.*.misc").isAllowedDisguise(
DisguiseParser.getDisguisePerm("Firework")), "The firework disguise should not be allowed");
Assert.assertTrue("The firework disguise should be allowed",
createPermissions("Disguise", false, "libsdisguises.disguise.*", "-libsdisguises.*.*").isAllowedDisguise(
DisguiseParser.getDisguisePerm("Firework")));
assertTrue(createPermissions("Disguise", false, "libsdisguises.disguise.*", "-libsdisguises.*.*").isAllowedDisguise(
DisguiseParser.getDisguisePerm("Firework")), "The firework disguise should be allowed");
Assert.assertTrue("The firework disguise should be allowed",
assertTrue(
createPermissions("Disguise", false, "libsdisguises.disguise.firework", "-libsdisguises.disguise.misc").isAllowedDisguise(
DisguiseParser.getDisguisePerm("Firework")));
DisguiseParser.getDisguisePerm("Firework")), "The firework disguise should be allowed");
}
@Test
@ -101,18 +112,18 @@ public class DisguisePermissionsTest {
}
private void testInheritedPermissions(DisguisePermissions permissions) {
Assert.assertTrue("The sheep disguise should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")), "The sheep disguise should be allowed");
Assert.assertTrue("The cow disguise should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")), "The cow disguise should be allowed");
Assert.assertTrue("The cow disguise should be allowed with setBaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBaby")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBaby")),
"The cow disguise should be allowed with setBaby");
Assert.assertFalse("The sheep disguise should not be allowed with setBaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep"), Collections.singletonList("setBaby")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep"), Collections.singletonList("setBaby")),
"The sheep disguise should not be allowed with setBaby");
Assert.assertFalse("The firework disguise should not be allowed",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Firework")),
"The firework disguise should not be allowed");
}
@Test
@ -121,20 +132,19 @@ public class DisguisePermissionsTest {
createPermissions("Disguise", false, "libsdisguises.disguise.sheep", "-libsdisguises.disguise.cow.setSprinting",
"-libsdisguises.disguise.donkey", "-libsdisguises.disguise.horse.setRearing", "libsdisguises.disguise.horse");
Assert.assertFalse("The cow disguise should not be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")), "The cow disguise should not be allowed");
Assert.assertTrue("The sheep disguise should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Sheep")), "The sheep disguise should be allowed");
Assert.assertFalse("The donkey disguise should not be allowed",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Donkey")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Donkey")), "The donkey disguise should not be allowed");
Assert.assertTrue("The horse disguise should be allowed", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse")), "The horse disguise should be allowed");
Assert.assertTrue("The horse disguise should be allowed with options",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse"), Collections.singletonList("setBaby")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse"), Collections.singletonList("setBaby")),
"The horse disguise should be allowed with options");
Assert.assertFalse("The horse disguise should not be allowed setRearing",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse"), Collections.singletonList("setRearing")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Horse"), Collections.singletonList("setRearing")),
"The horse disguise should not be allowed setRearing");
}
@Test
@ -143,69 +153,69 @@ public class DisguisePermissionsTest {
createPermissions("Disguise", false, "libsdisguises.disguise.cow.setBaby", "libsdisguises.disguise.cow.setHealth",
"libsdisguises.disguise.cow.-setBurning");
Assert.assertTrue("The cow disguise should be able to use setBaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBaby")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBaby")),
"The cow disguise should be able to use setBaby");
Assert.assertTrue("The cow disguise should be able to use setHealth",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setHealth")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setHealth")),
"The cow disguise should be able to use setHealth");
Assert.assertTrue("The cow disguise should be able to use setBaby and setHealth",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Arrays.asList("setBaby", "setHealth")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Arrays.asList("setBaby", "setHealth")),
"The cow disguise should be able to use setBaby and setHealth");
Assert.assertFalse("The cow disguise should not be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBurning")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBurning")),
"The cow disguise should not be able to use setBurning");
Assert.assertFalse("The cow disguise should not be able to use setSprinting",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setSprinting")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setSprinting")),
"The cow disguise should not be able to use setSprinting");
Assert.assertFalse("The cow disguise should not be able to use setSprinting with setBaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Arrays.asList("setSprinting", "setBaby")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Arrays.asList("setSprinting", "setBaby")),
"The cow disguise should not be able to use setSprinting with setBaby");
}
@Test
public void testOptions() {
Assert.assertFalse("The disguise should not be valid",
createPermissions("Disguise", false, "libsdisguises.disguise.cow", "-libsdisguises.disguise.cow").hasPermissions());
assertFalse(createPermissions("Disguise", false, "libsdisguises.disguise.cow", "-libsdisguises.disguise.cow").hasPermissions(),
"The disguise should not be valid");
DisguisePermissions permissions =
createPermissions("Disguise", false, "libsdisguises.disguise.cow", "libsdisguises.disguise.sheep.setColor.setSprinting",
"libsdisguises.disguise.animal.-setSprinting", "libsdisguises.disguise.sheep.setcolor.blue");
Assert.assertTrue("There should be a valid disguise", permissions.hasPermissions());
assertTrue(permissions.hasPermissions(), "There should be a valid disguise");
DisguisePerm cow = DisguiseParser.getDisguisePerm("Cow");
Assert.assertTrue("The cow disguise should be allowed", permissions.isAllowedDisguise(cow));
assertTrue(permissions.isAllowedDisguise(cow), "The cow disguise should be allowed");
Assert.assertTrue("The cow disguise should be allowed with options",
permissions.isAllowedDisguise(cow, Arrays.asList("setBaby", "setBurning")));
assertTrue(permissions.isAllowedDisguise(cow, Arrays.asList("setBaby", "setBurning")),
"The cow disguise should be allowed with options");
Assert.assertFalse("The cow disguise should not be allowed with options setSprinting",
permissions.isAllowedDisguise(cow, Arrays.asList("setBaby", "setSprinting")));
assertFalse(permissions.isAllowedDisguise(cow, Arrays.asList("setBaby", "setSprinting")),
"The cow disguise should not be allowed with options setSprinting");
Assert.assertFalse("The cow disguise should not be allowed with options",
permissions.isAllowedDisguise(cow, Collections.singletonList("setSprinting")));
assertFalse(permissions.isAllowedDisguise(cow, Collections.singletonList("setSprinting")),
"The cow disguise should not be allowed with options");
DisguisePerm sheep = DisguiseParser.getDisguisePerm("Sheep");
Assert.assertFalse("The sheep disguise should not be allowed with options",
permissions.isAllowedDisguise(sheep, Arrays.asList("setBaby", "setBurning")));
assertFalse(permissions.isAllowedDisguise(sheep, Arrays.asList("setBaby", "setBurning")),
"The sheep disguise should not be allowed with options");
Assert.assertTrue("The sheep disguise should be allowed setColor",
permissions.isAllowedDisguise(sheep, Collections.singletonList("setColor")));
assertTrue(permissions.isAllowedDisguise(sheep, Collections.singletonList("setColor")),
"The sheep disguise should be allowed setColor");
Assert.assertTrue("The sheep disguise should be allowed setSprinting",
permissions.isAllowedDisguise(sheep, Collections.singletonList("setSprinting")));
assertTrue(permissions.isAllowedDisguise(sheep, Collections.singletonList("setSprinting")),
"The sheep disguise should be allowed setSprinting");
Assert.assertFalse("The sheep disguise should not be allowed setColor and setBaby",
permissions.isAllowedDisguise(sheep, Arrays.asList("setColor", "setBaby")));
assertFalse(permissions.isAllowedDisguise(sheep, Arrays.asList("setColor", "setBaby")),
"The sheep disguise should not be allowed setColor and setBaby");
DisguisePerm firework = DisguiseParser.getDisguisePerm("Firework");
Assert.assertFalse("The firework disguise should not be allowed", permissions.isAllowedDisguise(firework));
assertFalse(permissions.isAllowedDisguise(firework), "The firework disguise should not be allowed");
Assert.assertFalse("The disguise should not be allowed even with options",
permissions.isAllowedDisguise(firework, Arrays.asList("setBaby", "setBurning")));
assertFalse(permissions.isAllowedDisguise(firework, Arrays.asList("setBaby", "setBurning")),
"The disguise should not be allowed even with options");
}
@ -215,14 +225,14 @@ public class DisguisePermissionsTest {
createPermissionsHolder(false, "libsdisguises.options.disguise.falling_block.setblock.stone"), "Disguise",
new DisguisePerm(DisguiseType.FALLING_BLOCK));
Assert.assertTrue("They should be allowed to use true as a disguise option on setBurning",
DisguisePermissions.hasPermissionOption(disguiseOptions, "setBurning", "true"));
assertTrue(DisguisePermissions.hasPermissionOption(disguiseOptions, "setBurning", "true"),
"They should be allowed to use true as a disguise option on setBurning");
Assert.assertTrue("They should be allowed to use Material.STONE as a disguise option",
DisguisePermissions.hasPermissionOption(disguiseOptions, "setBlock", "STONE"));
assertTrue(DisguisePermissions.hasPermissionOption(disguiseOptions, "setBlock", "STONE"),
"They should be allowed to use Material.STONE as a disguise option");
Assert.assertFalse("They should be not allowed to use Material.DIRT as a disguise option",
DisguisePermissions.hasPermissionOption(disguiseOptions, "setBlock", "DIRT"));
assertFalse(DisguisePermissions.hasPermissionOption(disguiseOptions, "setBlock", "DIRT"),
"They should be not allowed to use Material.DIRT as a disguise option");
}
@Test
@ -230,28 +240,28 @@ public class DisguisePermissionsTest {
DisguisePermissions permissions = createPermissions("Disguise", false, "libsdisguises.disguise.falling_block.setCustomName",
"libsdisguises.disguise.valid.falling_block.setblock");
Assert.assertFalse("The falling block disguise should not allow setBurning",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBurning")));
assertFalse(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBurning")),
"The falling block disguise should not allow setBurning");
Assert.assertTrue("The falling block disguise should allow setCustomName",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setcustomname")));
assertTrue(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setcustomname")),
"The falling block disguise should allow setCustomName");
Assert.assertTrue("The falling block disguise should allow setBlock",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBlock")));
assertTrue(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBlock")),
"The falling block disguise should allow setBlock");
}
@Test
public void testDisguiseValidDoesntGiveExtra() {
DisguisePermissions permissions = createPermissions("Disguise", false, "libsdisguises.disguise.valid.falling_block.setblock");
Assert.assertFalse("The falling block disguise should not be allowed",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK)));
assertFalse(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK)),
"The falling block disguise should not be allowed");
Assert.assertFalse("The falling block disguise should not allow setBurning",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBurning")));
assertFalse(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBurning")),
"The falling block disguise should not allow setBurning");
Assert.assertFalse("The falling block disguise should not allow setBlock",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBlock")));
assertFalse(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.FALLING_BLOCK), Arrays.asList("setBlock")),
"The falling block disguise should not allow setBlock");
}
@SneakyThrows
@ -260,26 +270,26 @@ public class DisguisePermissionsTest {
DisguiseConfig.getCustomDisguises().put(new DisguisePerm(DisguiseType.BEE, "babybee"), "bee setbaby");
DisguisePermissions permissions =
createPermissions("me/libraryaddict/disguise/utilities/watchers", false, "libsdisguises.disguise.bee.-*", "libsdisguises.disguise.babybee.nooptions");
createPermissions("Disguise", false, "libsdisguises.disguise.bee.-*", "libsdisguises.disguise.babybee.nooptions");
Assert.assertNotNull("The custom disguise babybee should exist", DisguiseParser.getDisguisePerm("babybee"));
assertNotNull(DisguiseParser.getDisguisePerm("babybee"), "The custom disguise babybee should exist");
Assert.assertTrue("They should be allowed to disguise as a bee", permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.BEE)));
assertTrue(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.BEE)), "They should be allowed to disguise as a bee");
Assert.assertFalse("They should not be allowed to disguise as a bee and call setbaby",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.BEE), Collections.singletonList("setbaby")));
assertFalse(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.BEE), Collections.singletonList("setbaby")),
"They should not be allowed to disguise as a bee and call setbaby");
Assert.assertFalse("They should not be allowed to disguise as a burning bee",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.BEE), Collections.singletonList("setburning")));
assertFalse(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.BEE), Collections.singletonList("setburning")),
"They should not be allowed to disguise as a burning bee");
Assert.assertFalse("They should not be allowed to disguise as a slime",
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.SLIME)));
assertFalse(permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.SLIME)),
"They should not be allowed to disguise as a slime");
Assert.assertTrue("They should be allowed to disguise as babybee",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("babybee")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("babybee")),
"They should be allowed to disguise as babybee");
Assert.assertFalse("They should not be allowed to disguise as babybee and use setbaby",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("babybee"), Collections.singletonList("setbaby")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("babybee"), Collections.singletonList("setbaby")),
"They should not be allowed to disguise as babybee and use setbaby");
DisguiseAPI.removeCustomDisguise("babybee");
}
@ -293,38 +303,36 @@ public class DisguisePermissionsTest {
"libsdisguises.disguise.skeleton.*", "libsdisguises.disguise.wither.setburning",
"libsdisguises.disguise.silverfish.-setburning");
Assert.assertTrue("The cow disguise should be usable", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow")), "The cow disguise should be usable");
Assert.assertFalse("The cow disguise should not be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBurning")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Cow"), Collections.singletonList("setBurning")),
"The cow disguise should not be able to use setBurning");
Assert.assertTrue("The zombie disguise should be usable", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Zombie")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Zombie")), "The zombie disguise should be usable");
Assert.assertFalse("The zombie disguise should not be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Zombie"), Collections.singletonList("setBurning")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Zombie"), Collections.singletonList("setBurning")),
"The zombie disguise should not be able to use setBurning");
Assert.assertTrue("The skeleton disguise should be usable",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Skeleton")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Skeleton")), "The skeleton disguise should be usable");
Assert.assertTrue("The skeleton disguise should be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Skeleton"), Collections.singletonList("setBurning")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Skeleton"), Collections.singletonList("setBurning")),
"The skeleton disguise should be able to use setBurning");
Assert.assertTrue("The wither disguise should be usable", permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Wither")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Wither")), "The wither disguise should be usable");
Assert.assertTrue("The wither disguise should be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Wither"), Collections.singletonList("setBurning")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Wither"), Collections.singletonList("setBurning")),
"The wither disguise should be able to use setBurning");
Assert.assertFalse("The wither disguise should not be able to use setSprinting",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Wither"), Collections.singletonList("setSprinting")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Wither"), Collections.singletonList("setSprinting")),
"The wither disguise should not be able to use setSprinting");
Assert.assertTrue("The silverfish disguise should be usable",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish")), "The silverfish disguise should be usable");
Assert.assertFalse("The silverfish disguise should not be able to use setBurning",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish"), Collections.singletonList("setBurning")));
assertFalse(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish"), Collections.singletonList("setBurning")),
"The silverfish disguise should not be able to use setBurning");
Assert.assertTrue("The silverfish disguise should be able to use setSprinting",
permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish"), Collections.singletonList("setSprinting")));
assertTrue(permissions.isAllowedDisguise(DisguiseParser.getDisguisePerm("Silverfish"), Collections.singletonList("setSprinting")),
"The silverfish disguise should be able to use setSprinting");
DisguiseConfig.setExplicitDisguisePermissions(false);
}

10
shared/build.gradle.kts Normal file
View File

@ -0,0 +1,10 @@
dependencies {
compileOnly(libs.org.spigotmc.spigot)
compileOnly(libs.org.spigotmc.spigot.api)
compileOnly(libs.com.mojang.authlib)
compileOnly(libs.io.papermc.paper.paper.api)
compileOnly(libs.io.netty.netty.buffer)
compileOnly(libs.com.retro.packetevents)
}
description = "shared"

View File

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>LibsDisguises</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>shared</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.5.41</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>${paper-api.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
</project>