Update for latest version of Plex

This commit is contained in:
Telesphoreo 2023-08-28 19:21:35 -05:00
parent eab4f216d0
commit 5aa9ccfeca
No known key found for this signature in database
GPG Key ID: 9D1991811E093C02
9 changed files with 21 additions and 38 deletions

View File

@ -19,11 +19,11 @@ 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")
}
group = "dev.plex"
version = "1.3"
version = "1.4-SNAPSHOT"
description = "Module-NUSH"
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,10 +130,13 @@ 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.
@ -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

@ -7,7 +7,6 @@ import dev.plex.nush.Message;
import dev.plex.nush.NushAction;
import dev.plex.nush.NushModule;
import dev.plex.nush.handler.impl.ActionHandler;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
import java.util.UUID;
@ -22,7 +21,7 @@ import static dev.plex.nush.NushAction.ACCEPT;
import static dev.plex.nush.NushAction.CANCEL;
@CommandParameters(name = "nush", aliases = "raidmode", description = "Toggle NUSH on or off.", usage = "/<command> [on | enable | off | disable | toggle]")
@CommandPermissions(level = Rank.ADMIN, permission = "plex.nush.command")
@CommandPermissions(permission = "plex.nush.command")
public class NUSHCommand extends PlexCommand
{
@ -94,7 +93,7 @@ public class NUSHCommand extends PlexCommand
}
PlexUtils.broadcastToAdmins(messageComponent("nushToggled", commandSender.getName(),
NushModule.enabled ? "Enabling" : "Disabling"));
NushModule.enabled ? "Enabling" : "Disabling"), "plex.nush.broadcast");
return null;
}
}

View File

@ -59,7 +59,7 @@ public class ActionHandler implements Handler
String text = PlexUtils.getTextFromComponent(message.getMessage());
Plex plex = MODULE.getPlex();
PlexPlayer plexPlayer = DataUtils.getPlayer(message.getSender());
Component prefix = plex.getRankManager().getPrefix(plexPlayer);
Component prefix = Component.text(plexPlayer.getPrefix());
Component component = Component.empty();
if (prefix != null)

View File

@ -1,14 +1,9 @@
package dev.plex.nush.listener.impl;
import dev.plex.Plex;
import dev.plex.cache.DataUtils;
import dev.plex.listener.PlexListener;
import dev.plex.nush.Message;
import dev.plex.nush.NushAction;
import dev.plex.nush.NushModule;
import dev.plex.nush.handler.impl.ActionHandler;
import dev.plex.player.PlexPlayer;
import dev.plex.rank.RankManager;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
import io.papermc.paper.event.player.AsyncChatEvent;
@ -24,7 +19,6 @@ import org.bukkit.event.EventPriority;
public class ChatListener extends PlexListener
{
@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(AsyncChatEvent event)
{
@ -42,15 +36,10 @@ public class ChatListener extends PlexListener
return;
}
NushModule module = NushModule.getInstance();
Plex plex = module.getPlex();
PlexPlayer plexPlayer = DataUtils.getPlayer(player.getUniqueId());
RankManager rankManager = plex.getRankManager();
if (rankManager.isAdmin(plexPlayer))
if (player.hasPermission("plex.nush.bypass"))
{
PlexLog.debug("{0} is an admin so Nush will skip them.", player.getName());
return; // we needn't process the chat message if they're an admin
PlexLog.debug("{0} has bypass permission so Nush will skip them.", player.getName());
return;
}
event.setCancelled(true);
@ -76,6 +65,6 @@ public class ChatListener extends PlexListener
);
}
PlexUtils.broadcastToAdmins(component);
PlexUtils.broadcastToAdmins(component, "plex.nush.broadcast");
}
}

View File

@ -1,28 +1,18 @@
package dev.plex.nush.listener.impl;
import dev.plex.Plex;
import dev.plex.cache.DataUtils;
import dev.plex.listener.PlexListener;
import dev.plex.nush.NushModule;
import dev.plex.player.PlexPlayer;
import dev.plex.rank.RankManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
public class JoinListener extends PlexListener
{
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
NushModule module = NushModule.getInstance();
Plex plex = module.getPlex();
PlexPlayer plexPlayer = DataUtils.getPlayer(player.getUniqueId());
RankManager rankManager = plex.getRankManager();
if (!rankManager.isAdmin(plexPlayer))
if (!player.hasPermission("plex.nush.bypass"))
{
return; // we only want to add admins
}

View File

@ -1,4 +1,4 @@
name: Module-NUSH
main: dev.plex.nush.NushModule
description: Stops raiding in its tracks.
version: 1.3
version: 1.4-SNAPSHOT