mirror of
https://github.com/plexusorg/Module-LibsDisguises.git
synced 2024-09-20 23:46:42 +00:00
Compare commits
23 commits
Author | SHA1 | Date | |
---|---|---|---|
cad134f9d1 | |||
c1c1525d1d | |||
7286ec2523 | |||
54e003963a | |||
c9b047fdb2 | |||
30757aab94 | |||
e4d3839a1d | |||
572c8cd2eb | |||
da2397cb41 | |||
daa319c9a7 | |||
d13b8f86d2 | |||
68b31f19f2 | |||
a4df61e317 | |||
e54daca7dc | |||
af28e37be1 | |||
b3fb0f01f3 | |||
7bdffd6c0d | |||
8d01678fae | |||
7b28553128 | |||
56d1d97c97 | |||
c486df94a8 | |||
4fa0085192 | |||
4afe2e7155 |
49
.idea/codeStyles/Plexus_Code_Style.xml
Normal file
49
.idea/codeStyles/Plexus_Code_Style.xml
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Plexus Code Style" version="1">
|
||||||
|
<JavaCodeStyleSettings>
|
||||||
|
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
|
||||||
|
<option name="IMPORT_LAYOUT_TABLE">
|
||||||
|
<value>
|
||||||
|
<package name="" withSubpackages="true" static="false" />
|
||||||
|
<package name="" withSubpackages="true" static="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</JavaCodeStyleSettings>
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value>
|
||||||
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="JAVA">
|
||||||
|
<option name="BRACE_STYLE" value="2" />
|
||||||
|
<option name="CLASS_BRACE_STYLE" value="2" />
|
||||||
|
<option name="METHOD_BRACE_STYLE" value="2" />
|
||||||
|
<option name="LAMBDA_BRACE_STYLE" value="2" />
|
||||||
|
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||||
|
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
|
||||||
|
<option name="IF_BRACE_FORCE" value="3" />
|
||||||
|
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||||
|
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||||
|
<option name="FOR_BRACE_FORCE" value="3" />
|
||||||
|
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="0" />
|
||||||
|
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
|
||||||
|
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Plexus Code Style" />
|
||||||
|
</state>
|
||||||
|
</component>
|
24
CONTRIBUTING.md
Normal file
24
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
For those who are wanting to contribute, we fully encourage doing so. There are a few rules we require following when contributing however.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. Make an issue and get feedback. It's important to know if your idea will be accepted before writing any code.
|
||||||
|
- If it is a feature request, describe the feature and be extremely specific.
|
||||||
|
- If it is a bug report, ensure you include how to reproduce the bug and the expected outcome
|
||||||
|
- If it is an enhancement, describe your proposed changes. Ensure you are extremely specific.
|
||||||
|
2. Fork this project
|
||||||
|
3. Create a new branch that describes the new feature, enhancement, or bug fix. For example, this is good: `feature/add-xyz`. This is bad: `fix-this-lol`.
|
||||||
|
4. Write the code that addresses your change.
|
||||||
|
- Keep in mind that it **must** be formatted correctly. If you are using IntelliJ, there is a `codeStyle.xml` file that tells IntelliJ how to format your code. Check this link for information on how to use the file: https://www.jetbrains.com/help/idea/configuring-code-style.html#import-export-schemes
|
||||||
|
- If you are not using IntelliJ, that is fine. We use the Plexus Code Style (which is almost the same as Allman) so please format your code accordingly.
|
||||||
|
6. Push your changes to your new branch and make a PR based off of that branch.
|
||||||
|
|
||||||
|
## Requirements for a PR
|
||||||
|
- The issue must be marked as approved
|
||||||
|
- It must only address each specific issue. Don't make one PR for multiple issues.
|
||||||
|
- Your PR must compile and work. If it does not compile or work, your PR will most likely be rejected.
|
||||||
|
|
||||||
|
## Code requirements
|
||||||
|
- Most importantly, your code must be efficient. Your pull request may be rejected if your code is deemed inefficient or sloppy.
|
||||||
|
- Do not repeat yourself. Create functions as needed if you're using large blocks of code over and over again.
|
||||||
|
- Do not use an excessive amount of commits when making your PR. It makes the master branch look messy.
|
||||||
|
- Your code must be consistent with Plex's codebase. If a function already exists, use it.
|
|
@ -1,2 +1,2 @@
|
||||||
# Module-LibsDisguises
|
# Module-LibsDisguises [![Build Status](https://ci.plex.us.org/job/Module-LibsDisguises/badge/icon)](https://ci.plex.us.org/job/Module-LibsDisguises/)
|
||||||
LibsDisguises module for Plex
|
LibsDisguises module for Plex
|
||||||
|
|
50
build.gradle
50
build.gradle
|
@ -1,50 +0,0 @@
|
||||||
plugins {
|
|
||||||
id "java"
|
|
||||||
id "maven-publish"
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
|
||||||
url = uri("https://nexus.telesphoreo.me/repository/plex")
|
|
||||||
}
|
|
||||||
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly "org.projectlombok:lombok:1.18.22"
|
|
||||||
annotationProcessor "org.projectlombok:lombok:1.18.22"
|
|
||||||
compileOnly "io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT"
|
|
||||||
compileOnly "dev.plex:Plex:0.8"
|
|
||||||
implementation "LibsDisguises:LibsDisguises:10.0.27"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = "dev.plex"
|
|
||||||
version = "1.0"
|
|
||||||
description = "LibsDisguises"
|
|
||||||
|
|
||||||
java {
|
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
maven(MavenPublication) {
|
|
||||||
from(components.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
javadoc {
|
|
||||||
options.memberLevel = JavadocMemberLevel.PRIVATE
|
|
||||||
}
|
|
||||||
}
|
|
65
build.gradle.kts
Normal file
65
build.gradle.kts
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
plugins {
|
||||||
|
java
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url = uri("https://nexus.telesphoreo.me/repository/plex/")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.md-5.net/content/groups/public")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.dmulloy2.net/repository/public/")
|
||||||
|
}
|
||||||
|
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly("org.projectlombok:lombok:1.18.30")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.30")
|
||||||
|
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
|
||||||
|
compileOnly("dev.plex:server:1.4-SNAPSHOT")
|
||||||
|
implementation("LibsDisguises:LibsDisguises:10.0.37")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "dev.plex"
|
||||||
|
version = "1.4-SNAPSHOT"
|
||||||
|
description = "Module-LibsDisguises"
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
from(components["java"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.getByName<Jar>("jar") {
|
||||||
|
archiveBaseName.set("Module-LibsDisguises")
|
||||||
|
archiveVersion.set("")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
compileJava {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
|
javadoc {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
|
processResources {
|
||||||
|
filteringCharset = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
|
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,7 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
41
gradlew
vendored
41
gradlew
vendored
|
@ -55,7 +55,7 @@
|
||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
@ -80,13 +80,11 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
@ -133,22 +131,29 @@ location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
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 ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | 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" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
|
@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# 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 -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
@ -205,6 +214,12 @@ set -- \
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
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.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|
15
gradlew.bat
vendored
15
gradlew.bat
vendored
|
@ -14,7 +14,7 @@
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
|
@ -25,7 +25,8 @@
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
rootProject.name = 'Module-LibsDisguises'
|
|
||||||
|
|
2
settings.gradle.kts
Normal file
2
settings.gradle.kts
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
rootProject.name = "Module-LibsDisguises"
|
||||||
|
|
|
@ -4,14 +4,22 @@ import dev.plex.command.DisguiseToggleCMD;
|
||||||
import dev.plex.command.UndisguiseAllCMD;
|
import dev.plex.command.UndisguiseAllCMD;
|
||||||
import dev.plex.listener.DisguiseListener;
|
import dev.plex.listener.DisguiseListener;
|
||||||
import dev.plex.module.PlexModule;
|
import dev.plex.module.PlexModule;
|
||||||
|
import dev.plex.util.PlexLog;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
public class LibsDisguises extends PlexModule
|
public class LibsDisguises extends PlexModule
|
||||||
{
|
{
|
||||||
public static boolean enabled = true;
|
public static boolean enabled = true;
|
||||||
DisguiseListener disguiseListener;
|
DisguiseListener disguiseListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable()
|
public void enable()
|
||||||
{
|
{
|
||||||
|
if (!Bukkit.getPluginManager().isPluginEnabled("LibsDisguises"))
|
||||||
|
{
|
||||||
|
PlexLog.error("The Plex-LibsDisguises module requires the LibsDisguises plugin to work.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
registerCommand(new DisguiseToggleCMD());
|
registerCommand(new DisguiseToggleCMD());
|
||||||
registerCommand(new UndisguiseAllCMD());
|
registerCommand(new UndisguiseAllCMD());
|
||||||
registerListener(new DisguiseListener());
|
registerListener(new DisguiseListener());
|
||||||
|
|
|
@ -4,7 +4,8 @@ import dev.plex.LibsDisguises;
|
||||||
import dev.plex.command.annotation.CommandParameters;
|
import dev.plex.command.annotation.CommandParameters;
|
||||||
import dev.plex.command.annotation.CommandPermissions;
|
import dev.plex.command.annotation.CommandPermissions;
|
||||||
import dev.plex.listener.UndisguiseEvent;
|
import dev.plex.listener.UndisguiseEvent;
|
||||||
import dev.plex.rank.enums.Rank;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -14,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@CommandParameters(name = "disguisetoggle", description = "Toggle LibsDisguises", aliases = "dtoggle")
|
@CommandParameters(name = "disguisetoggle", description = "Toggle LibsDisguises", aliases = "dtoggle")
|
||||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.libsdisguises.disguisetoggle")
|
@CommandPermissions(permission = "plex.libsdisguises.disguisetoggle")
|
||||||
public class DisguiseToggleCMD extends PlexCommand
|
public class DisguiseToggleCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,4 +29,10 @@ public class DisguiseToggleCMD extends PlexCommand
|
||||||
Bukkit.broadcast(Component.text(commandSender.getName() + " - " + (LibsDisguises.enabled ? "Enabling LibsDisguises" : "Disabling LibsDisguises")).color((LibsDisguises.enabled ? NamedTextColor.AQUA : NamedTextColor.RED)));
|
Bukkit.broadcast(Component.text(commandSender.getName() + " - " + (LibsDisguises.enabled ? "Enabling LibsDisguises" : "Disabling LibsDisguises")).color((LibsDisguises.enabled ? NamedTextColor.AQUA : NamedTextColor.RED)));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@ package dev.plex.command;
|
||||||
import dev.plex.command.annotation.CommandParameters;
|
import dev.plex.command.annotation.CommandParameters;
|
||||||
import dev.plex.command.annotation.CommandPermissions;
|
import dev.plex.command.annotation.CommandPermissions;
|
||||||
import dev.plex.listener.UndisguiseEvent;
|
import dev.plex.listener.UndisguiseEvent;
|
||||||
import dev.plex.rank.enums.Rank;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -13,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@CommandParameters(name = "undisguiseall", usage = "/<command> [-a]", description = "Undisguise all players", aliases = "undisall,uall")
|
@CommandParameters(name = "undisguiseall", usage = "/<command> [-a]", description = "Undisguise all players", aliases = "undisall,uall")
|
||||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.libsdisguises.undisguiseall")
|
@CommandPermissions(permission = "plex.libsdisguises.undisguiseall")
|
||||||
public class UndisguiseAllCMD extends PlexCommand
|
public class UndisguiseAllCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,4 +34,18 @@ public class UndisguiseAllCMD extends PlexCommand
|
||||||
}
|
}
|
||||||
return usage();
|
return usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
|
||||||
|
{
|
||||||
|
if (silentCheckPermission(sender, this.getPermission()))
|
||||||
|
{
|
||||||
|
if (args.length == 1)
|
||||||
|
{
|
||||||
|
return Collections.singletonList("-a");
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,18 @@ import dev.plex.util.PlexLog;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.watchers.AreaEffectCloudWatcher;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.watchers.EnderDragonWatcher;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.watchers.PhantomWatcher;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.watchers.SlimeWatcher;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.watchers.WitherWatcher;
|
||||||
|
import me.libraryaddict.disguise.events.DisguiseEvent;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.PluginCommandYamlParser;
|
import org.bukkit.command.PluginCommandYamlParser;
|
||||||
|
@ -20,6 +30,91 @@ import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class DisguiseListener extends PlexListener
|
public class DisguiseListener extends PlexListener
|
||||||
{
|
{
|
||||||
|
private static float safeYMod(float f)
|
||||||
|
{
|
||||||
|
return Math.max(-256f, Math.min(256f, f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onDisguiseEvent(DisguiseEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
PlexPlayer plexPlayer = null;
|
||||||
|
if (event.getCommandSender() instanceof Player player)
|
||||||
|
{
|
||||||
|
plexPlayer = DataUtils.getPlayer(player.getUniqueId());
|
||||||
|
}
|
||||||
|
if (event.getDisguise().getType() == DisguiseType.FISHING_HOOK)
|
||||||
|
{
|
||||||
|
event.getCommandSender().sendMessage(Component.text("You cannot use Fishing Hook disguises").color(NamedTextColor.RED));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String name = event.getDisguise().getWatcher().getCustomName();
|
||||||
|
if (name != null)
|
||||||
|
{
|
||||||
|
int noColorLen = PlainTextComponentSerializer.plainText().serialize(LegacyComponentSerializer.legacySection().deserialize(name)).length();
|
||||||
|
// each color code counts as one char rather than two, for flexibility
|
||||||
|
if (((name.length() - noColorLen) / 2) + noColorLen > 32)
|
||||||
|
{
|
||||||
|
event.getCommandSender().sendMessage(Component.text("Your disguise name is too long").color(NamedTextColor.RED));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (event.getDisguise().getWatcher() instanceof EnderDragonWatcher watcher && watcher.getPhase() == 7)
|
||||||
|
{
|
||||||
|
watcher.setPhase(6);
|
||||||
|
}
|
||||||
|
if (event.getDisguise().getWatcher() instanceof WitherWatcher watcher && watcher.getInvulnerability() > 2048)
|
||||||
|
{
|
||||||
|
watcher.setInvulnerability(2048);
|
||||||
|
}
|
||||||
|
if (event.getDisguise().isPlayerDisguise() && plexPlayer != null && !plexPlayer.getPlayer().hasPermission("plex.libsdisguises.player"))
|
||||||
|
{
|
||||||
|
PlayerDisguise playerDisguise = (PlayerDisguise)event.getDisguise();
|
||||||
|
String targetName = playerDisguise.getName();
|
||||||
|
String origName = event.getDisguised().getName();
|
||||||
|
playerDisguise.setName(origName);
|
||||||
|
playerDisguise.setNameVisible(true);
|
||||||
|
playerDisguise.getWatcher().setNameYModifier(0);
|
||||||
|
playerDisguise.setSkin(targetName);
|
||||||
|
playerDisguise.setDisplayedInTab(false);
|
||||||
|
playerDisguise.setTablistName(origName);
|
||||||
|
}
|
||||||
|
if (event.getDisguise().isHidePlayer())
|
||||||
|
{
|
||||||
|
event.getDisguise().setHidePlayer(false);
|
||||||
|
}
|
||||||
|
if (event.getDisguise().getWatcher() instanceof AreaEffectCloudWatcher watcher)
|
||||||
|
{
|
||||||
|
if (watcher.getRadius() > 5)
|
||||||
|
{
|
||||||
|
watcher.setRadius(5);
|
||||||
|
}
|
||||||
|
else if (watcher.getRadius() < 0)
|
||||||
|
{
|
||||||
|
watcher.setRadius(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.getDisguise().getWatcher().setNameYModifier(safeYMod(event.getDisguise().getWatcher().getNameYModifier()));
|
||||||
|
event.getDisguise().getWatcher().setYModifier(safeYMod(event.getDisguise().getWatcher().getYModifier()));
|
||||||
|
if (event.getDisguise().getWatcher() instanceof SlimeWatcher watcher && watcher.getSize() > 10)
|
||||||
|
{
|
||||||
|
watcher.setSize(10);
|
||||||
|
}
|
||||||
|
if (event.getDisguise().getWatcher() instanceof PhantomWatcher watcher)
|
||||||
|
{
|
||||||
|
if (watcher.getSize() > 20)
|
||||||
|
{
|
||||||
|
watcher.setSize(20);
|
||||||
|
}
|
||||||
|
else if (watcher.getSize() < -36)
|
||||||
|
{
|
||||||
|
watcher.setSize(-36);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
|
||||||
final List<Command> commands = new ArrayList<>();
|
final List<Command> commands = new ArrayList<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -34,15 +129,6 @@ public class DisguiseListener extends PlexListener
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PlexPlayer plexPlayer = DataUtils.getPlayer(player.getUniqueId());
|
PlexPlayer plexPlayer = DataUtils.getPlayer(player.getUniqueId());
|
||||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
|
||||||
{
|
|
||||||
if (!plugin.getRankManager().isAdmin(plexPlayer))
|
|
||||||
{
|
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
|
||||||
{
|
|
||||||
if (!player.hasPermission("plex.libsdisguises.bypass"))
|
if (!player.hasPermission("plex.libsdisguises.bypass"))
|
||||||
{
|
{
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
|
@ -50,7 +136,6 @@ public class DisguiseListener extends PlexListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: LibsDisguises
|
name: Module-LibsDisguises
|
||||||
main: dev.plex.LibsDisguises
|
main: dev.plex.LibsDisguises
|
||||||
description: Control LibsDisguises with Plex
|
description: Control LibsDisguises with Plex
|
||||||
version: 1.0
|
version: 1.4-SNAPSHOT
|
Loading…
Reference in a new issue