Compare commits

...

26 commits
1.0 ... master

Author SHA1 Message Date
Telesphoreo
007c653c63 Update gradle.yml 2025-07-07 17:56:12 -04:00
Telesphoreo
bdea95a1b4 Update dependencies 2025-07-07 17:52:10 -04:00
Telesphoreo
43746eefa5 Update dependencies 2024-10-16 17:16:40 -05:00
Telesphoreo
cad134f9d1
fix tab completion 2024-01-20 14:57:34 -06:00
Telesphoreo
c1c1525d1d Update dependencies 2023-11-26 00:27:09 -06:00
Telesphoreo
7286ec2523
Update for latest version of Plex 2023-08-28 18:56:50 -05:00
Telesphoreo
54e003963a
Merge pull request #1 from plexusorg/limit-and-update
Add disguise limiters for non-admins & safeguards
2023-08-24 16:38:19 -05:00
ayunami2000
c9b047fdb2 Add disguise limiters for non-admins & safeguards
Give admins or people who should be able to disguise as a player fully the permission `plex.libsdisguises.player`

Also updated repos and LibsDisguises version
2023-08-24 17:33:38 -04:00
Telesphoreo
30757aab94
Release 1.3 2023-07-22 22:55:31 -05:00
Telesphoreo
e4d3839a1d Update Gradle 2023-03-08 13:19:05 -06:00
Telesphoreo
572c8cd2eb Update dependencies and Gradle 2023-03-02 23:16:38 -06:00
Telesphoreo
da2397cb41
Update dependencies 2022-11-27 22:21:04 -06:00
Telesphoreo
daa319c9a7 Update Gradle + remove API 2022-08-02 20:36:31 -05:00
Telesphoreo
d13b8f86d2 Update to 1.19 2022-06-13 23:01:48 -05:00
Telesphoreo
68b31f19f2 Update for 1.2 2022-06-05 22:17:25 -05:00
Telesphoreo
a4df61e317 Update version 2022-05-28 22:04:51 -05:00
Telesphoreo
e54daca7dc Update repo 2022-05-21 20:59:51 -05:00
Telesphoreo
af28e37be1
Create CONTRIBUTING.md 2022-05-17 14:58:39 -05:00
Telesphoreo
b3fb0f01f3
Add check to make sure LibsDisguises is actually on the server 2022-05-13 12:55:11 -05:00
Telesphoreo
7bdffd6c0d
Update build.gradle.kts 2022-05-08 21:26:37 -05:00
Telesphoreo
8d01678fae
Update README.md 2022-05-05 22:32:38 -05:00
Telesphoreo
7b28553128 This needs to be changed 2022-04-21 20:25:31 -05:00
Telesphoreo
56d1d97c97 Update build.gradle.kts 2022-04-12 16:46:25 -05:00
Telesphoreo
c486df94a8 Update build.gradle.kts 2022-04-12 16:38:07 -05:00
Telesphoreo
4fa0085192 Update Gradle and change name 2022-04-01 00:26:23 -05:00
Telesphoreo
4afe2e7155 Update dependencies 2022-03-31 01:29:35 -05:00
18 changed files with 344 additions and 105 deletions

View file

@ -7,12 +7,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21
cache: gradle
- name: Build with Gradle
run: chmod a+x gradlew && ./gradlew build --no-daemon

49
.idea/codeStyles/Plexus_Code_Style.xml generated Normal file
View 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 generated Normal file
View 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
View 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.

View file

@ -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

View file

@ -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
}
}

71
build.gradle.kts Normal file
View file

@ -0,0 +1,71 @@
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/")
}
maven {
url = uri("https://repo.codemc.io/repository/maven-releases/")
}
mavenCentral()
}
dependencies {
compileOnly("org.projectlombok:lombok:1.18.38")
annotationProcessor("org.projectlombok:lombok:1.18.38")
compileOnly("io.papermc.paper:paper-api:1.21.7-R0.1-SNAPSHOT")
compileOnly("dev.plex:server:1.5")
implementation("me.libraryaddict.disguises:libsdisguises:11.0.6")
compileOnly("com.github.retrooper:packetevents-spigot:2.8.0")
}
group = "dev.plex"
version = "1.5"
description = "Module-LibsDisguises"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
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()
}
}

Binary file not shown.

View file

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

44
gradlew vendored
View file

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# 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/.
@ -80,13 +82,12 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# 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
@ -133,22 +134,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
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
@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# 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" \
@ -205,6 +217,12 @@ set -- \
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.

37
gradlew.bat vendored
View file

@ -13,8 +13,10 @@
@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
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@ -25,7 +27,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -56,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
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
@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View file

@ -1,2 +0,0 @@
rootProject.name = 'Module-LibsDisguises'

2
settings.gradle.kts Normal file
View file

@ -0,0 +1,2 @@
rootProject.name = "Module-LibsDisguises"

View file

@ -4,14 +4,22 @@ import dev.plex.command.DisguiseToggleCMD;
import dev.plex.command.UndisguiseAllCMD;
import dev.plex.listener.DisguiseListener;
import dev.plex.module.PlexModule;
import dev.plex.util.PlexLog;
import org.bukkit.Bukkit;
public class LibsDisguises extends PlexModule
{
public static boolean enabled = true;
DisguiseListener disguiseListener;
@Override
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 UndisguiseAllCMD());
registerListener(new DisguiseListener());

View file

@ -4,7 +4,8 @@ import dev.plex.LibsDisguises;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
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.format.NamedTextColor;
import org.bukkit.Bukkit;
@ -14,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@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
{
@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)));
return null;
}
@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return Collections.emptyList();
}
}

View file

@ -3,7 +3,8 @@ package dev.plex.command;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
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.format.NamedTextColor;
import org.bukkit.Bukkit;
@ -13,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@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
{
@Override
@ -33,4 +34,18 @@ public class UndisguiseAllCMD extends PlexCommand
}
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();
}
}

View file

@ -7,8 +7,18 @@ import dev.plex.util.PlexLog;
import java.util.ArrayList;
import java.util.List;
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.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.command.Command;
import org.bukkit.command.PluginCommandYamlParser;
@ -20,6 +30,91 @@ import org.bukkit.plugin.Plugin;
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<>();
@EventHandler
@ -34,19 +129,9 @@ public class DisguiseListener extends PlexListener
else
{
PlexPlayer plexPlayer = DataUtils.getPlayer(player.getUniqueId());
if (plugin.getSystem().equalsIgnoreCase("ranks"))
if (!player.hasPermission("plex.libsdisguises.bypass"))
{
if (!plugin.getRankManager().isAdmin(plexPlayer))
{
DisguiseAPI.undisguiseToAll(player);
}
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission("plex.libsdisguises.bypass"))
{
DisguiseAPI.undisguiseToAll(player);
}
DisguiseAPI.undisguiseToAll(player);
}
}
}

View file

@ -1,4 +1,4 @@
name: LibsDisguises
name: Module-LibsDisguises
main: dev.plex.LibsDisguises
description: Control LibsDisguises with Plex
version: 1.0
version: 1.5