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") compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("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("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") implementation("LibsDisguises:LibsDisguises:10.0.37")
} }
group = "dev.plex" group = "dev.plex"
version = "1.3" version = "1.4-SNAPSHOT"
description = "Module-LibsDisguises" description = "Module-LibsDisguises"
java { java {

Binary file not shown.

View File

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

12
gradlew vendored
View File

@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -133,10 +130,13 @@ 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.
@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done done
fi 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; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # 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.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 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 +13,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

View File

@ -3,7 +3,6 @@ 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 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 +12,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

View File

@ -9,7 +9,11 @@ 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.DisguiseType;
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; 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 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;
@ -36,9 +40,11 @@ public class DisguiseListener extends PlexListener
{ {
event.setCancelled(true); event.setCancelled(true);
PlexPlayer plexPlayer = null; PlexPlayer plexPlayer = null;
if (event.getCommandSender() instanceof Player player) plexPlayer = DataUtils.getPlayer(player.getUniqueId()); if (event.getCommandSender() instanceof Player player)
boolean ranksAndNotAdmin = plexPlayer != null && plugin.getSystem().equalsIgnoreCase("ranks") && !plugin.getRankManager().isAdmin(plexPlayer); {
if (ranksAndNotAdmin && event.getDisguise().getType() == DisguiseType.FISHING_HOOK) 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)); event.getCommandSender().sendMessage(Component.text("You cannot use Fishing Hook disguises").color(NamedTextColor.RED));
return; return;
@ -54,11 +60,17 @@ public class DisguiseListener extends PlexListener
return; return;
} }
} }
if (event.getDisguise().getWatcher() instanceof EnderDragonWatcher watcher && watcher.getPhase() == 7) watcher.setPhase(6); if (event.getDisguise().getWatcher() instanceof EnderDragonWatcher watcher && watcher.getPhase() == 7)
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"))))
{ {
PlayerDisguise playerDisguise = (PlayerDisguise) event.getDisguise(); 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 targetName = playerDisguise.getName();
String origName = event.getDisguised().getName(); String origName = event.getDisguised().getName();
playerDisguise.setName(origName); playerDisguise.setName(origName);
@ -68,7 +80,10 @@ public class DisguiseListener extends PlexListener
playerDisguise.setDisplayedInTab(false); playerDisguise.setDisplayedInTab(false);
playerDisguise.setTablistName(origName); 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 (event.getDisguise().getWatcher() instanceof AreaEffectCloudWatcher watcher)
{ {
if (watcher.getRadius() > 5) 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().setNameYModifier(safeYMod(event.getDisguise().getWatcher().getNameYModifier()));
event.getDisguise().getWatcher().setYModifier(safeYMod(event.getDisguise().getWatcher().getYModifier())); event.getDisguise().getWatcher().setYModifier(safeYMod(event.getDisguise().getWatcher().getYModifier()));
if (event.getDisguise().getWatcher() instanceof SlimeWatcher watcher && watcher.getSize() > 10) if (event.getDisguise().getWatcher() instanceof SlimeWatcher watcher && watcher.getSize() > 10)
{
watcher.setSize(10); watcher.setSize(10);
}
if (event.getDisguise().getWatcher() instanceof PhantomWatcher watcher) if (event.getDisguise().getWatcher() instanceof PhantomWatcher watcher)
{ {
if (watcher.getSize() > 20) if (watcher.getSize() > 20)
@ -112,19 +129,9 @@ 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 (!player.hasPermission("plex.libsdisguises.bypass"))
{ {
if (!plugin.getRankManager().isAdmin(plexPlayer)) DisguiseAPI.undisguiseToAll(player);
{
DisguiseAPI.undisguiseToAll(player);
}
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission("plex.libsdisguises.bypass"))
{
DisguiseAPI.undisguiseToAll(player);
}
} }
} }
} }

View File

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