Update for latest version of Plex

This commit is contained in:
Telesphoreo 2023-08-28 18:56:50 -05:00
parent 54e003963a
commit 7286ec2523
No known key found for this signature in database
GPG Key ID: 9D1991811E093C02
8 changed files with 43 additions and 33 deletions

View File

@ -27,12 +27,12 @@ dependencies {
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("dev.plex:server:1.3")
compileOnly("dev.plex:server:1.4-SNAPSHOT")
implementation("LibsDisguises:LibsDisguises:10.0.37")
}
group = "dev.plex"
version = "1.3"
version = "1.4-SNAPSHOT"
description = "Module-LibsDisguises"
java {

Binary file not shown.

View File

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

12
gradlew vendored
View File

@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -133,11 +130,14 @@ 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
@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
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, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in

View File

@ -4,7 +4,6 @@ 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 net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
@ -14,7 +13,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

View File

@ -3,7 +3,6 @@ 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 net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Bukkit;
@ -13,7 +12,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

View File

@ -9,7 +9,11 @@ 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.*;
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;
@ -36,9 +40,11 @@ public class DisguiseListener extends PlexListener
{
event.setCancelled(true);
PlexPlayer plexPlayer = null;
if (event.getCommandSender() instanceof Player player) plexPlayer = DataUtils.getPlayer(player.getUniqueId());
boolean ranksAndNotAdmin = plexPlayer != null && plugin.getSystem().equalsIgnoreCase("ranks") && !plugin.getRankManager().isAdmin(plexPlayer);
if (ranksAndNotAdmin && event.getDisguise().getType() == DisguiseType.FISHING_HOOK)
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;
@ -54,9 +60,15 @@ public class DisguiseListener extends PlexListener
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 && (ranksAndNotAdmin || (plugin.getSystem().equalsIgnoreCase("permissions") && !plexPlayer.getPlayer().hasPermission("plex.libsdisguises.player"))))
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();
@ -68,7 +80,10 @@ public class DisguiseListener extends PlexListener
playerDisguise.setDisplayedInTab(false);
playerDisguise.setTablistName(origName);
}
if (ranksAndNotAdmin && event.getDisguise().isHidePlayer()) event.getDisguise().setHidePlayer(false);
if (event.getDisguise().isHidePlayer())
{
event.getDisguise().setHidePlayer(false);
}
if (event.getDisguise().getWatcher() instanceof AreaEffectCloudWatcher watcher)
{
if (watcher.getRadius() > 5)
@ -83,7 +98,9 @@ public class DisguiseListener extends PlexListener
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)
@ -112,15 +129,6 @@ public class DisguiseListener extends PlexListener
else
{
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"))
{
DisguiseAPI.undisguiseToAll(player);
@ -128,7 +136,6 @@ public class DisguiseListener extends PlexListener
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)

View File

@ -1,4 +1,4 @@
name: Module-LibsDisguises
main: dev.plex.LibsDisguises
description: Control LibsDisguises with Plex
version: 1.3
version: 1.4-SNAPSHOT