mirror of
https://github.com/plexusorg/Module-NUSH.git
synced 2025-05-13 02:23:19 +00:00
Update for latest version of Plex
This commit is contained in:
parent
eab4f216d0
commit
5aa9ccfeca
@ -19,11 +19,11 @@ 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")
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.plex"
|
group = "dev.plex"
|
||||||
version = "1.3"
|
version = "1.4-SNAPSHOT"
|
||||||
description = "Module-NUSH"
|
description = "Module-NUSH"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
12
gradlew
vendored
@ -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
|
||||||
|
@ -7,7 +7,6 @@ import dev.plex.nush.Message;
|
|||||||
import dev.plex.nush.NushAction;
|
import dev.plex.nush.NushAction;
|
||||||
import dev.plex.nush.NushModule;
|
import dev.plex.nush.NushModule;
|
||||||
import dev.plex.nush.handler.impl.ActionHandler;
|
import dev.plex.nush.handler.impl.ActionHandler;
|
||||||
import dev.plex.rank.enums.Rank;
|
|
||||||
import dev.plex.util.PlexLog;
|
import dev.plex.util.PlexLog;
|
||||||
import dev.plex.util.PlexUtils;
|
import dev.plex.util.PlexUtils;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -22,7 +21,7 @@ import static dev.plex.nush.NushAction.ACCEPT;
|
|||||||
import static dev.plex.nush.NushAction.CANCEL;
|
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]")
|
@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
|
public class NUSHCommand extends PlexCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -94,7 +93,7 @@ public class NUSHCommand extends PlexCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlexUtils.broadcastToAdmins(messageComponent("nushToggled", commandSender.getName(),
|
PlexUtils.broadcastToAdmins(messageComponent("nushToggled", commandSender.getName(),
|
||||||
NushModule.enabled ? "Enabling" : "Disabling"));
|
NushModule.enabled ? "Enabling" : "Disabling"), "plex.nush.broadcast");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class ActionHandler implements Handler
|
|||||||
String text = PlexUtils.getTextFromComponent(message.getMessage());
|
String text = PlexUtils.getTextFromComponent(message.getMessage());
|
||||||
Plex plex = MODULE.getPlex();
|
Plex plex = MODULE.getPlex();
|
||||||
PlexPlayer plexPlayer = DataUtils.getPlayer(message.getSender());
|
PlexPlayer plexPlayer = DataUtils.getPlayer(message.getSender());
|
||||||
Component prefix = plex.getRankManager().getPrefix(plexPlayer);
|
Component prefix = Component.text(plexPlayer.getPrefix());
|
||||||
Component component = Component.empty();
|
Component component = Component.empty();
|
||||||
|
|
||||||
if (prefix != null)
|
if (prefix != null)
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
package dev.plex.nush.listener.impl;
|
package dev.plex.nush.listener.impl;
|
||||||
|
|
||||||
import dev.plex.Plex;
|
|
||||||
import dev.plex.cache.DataUtils;
|
|
||||||
import dev.plex.listener.PlexListener;
|
import dev.plex.listener.PlexListener;
|
||||||
import dev.plex.nush.Message;
|
import dev.plex.nush.Message;
|
||||||
import dev.plex.nush.NushAction;
|
import dev.plex.nush.NushAction;
|
||||||
import dev.plex.nush.NushModule;
|
|
||||||
import dev.plex.nush.handler.impl.ActionHandler;
|
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.PlexLog;
|
||||||
import dev.plex.util.PlexUtils;
|
import dev.plex.util.PlexUtils;
|
||||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||||
@ -24,7 +19,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
|
|
||||||
public class ChatListener extends PlexListener
|
public class ChatListener extends PlexListener
|
||||||
{
|
{
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onChat(AsyncChatEvent event)
|
public void onChat(AsyncChatEvent event)
|
||||||
{
|
{
|
||||||
@ -42,15 +36,10 @@ public class ChatListener extends PlexListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NushModule module = NushModule.getInstance();
|
if (player.hasPermission("plex.nush.bypass"))
|
||||||
Plex plex = module.getPlex();
|
|
||||||
PlexPlayer plexPlayer = DataUtils.getPlayer(player.getUniqueId());
|
|
||||||
RankManager rankManager = plex.getRankManager();
|
|
||||||
|
|
||||||
if (rankManager.isAdmin(plexPlayer))
|
|
||||||
{
|
{
|
||||||
PlexLog.debug("{0} is an admin so Nush will skip them.", player.getName());
|
PlexLog.debug("{0} has bypass permission so Nush will skip them.", player.getName());
|
||||||
return; // we needn't process the chat message if they're an admin
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -76,6 +65,6 @@ public class ChatListener extends PlexListener
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlexUtils.broadcastToAdmins(component);
|
PlexUtils.broadcastToAdmins(component, "plex.nush.broadcast");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,18 @@
|
|||||||
package dev.plex.nush.listener.impl;
|
package dev.plex.nush.listener.impl;
|
||||||
|
|
||||||
import dev.plex.Plex;
|
|
||||||
import dev.plex.cache.DataUtils;
|
|
||||||
import dev.plex.listener.PlexListener;
|
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.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
public class JoinListener extends PlexListener
|
public class JoinListener extends PlexListener
|
||||||
{
|
{
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
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
|
return; // we only want to add admins
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: Module-NUSH
|
name: Module-NUSH
|
||||||
main: dev.plex.nush.NushModule
|
main: dev.plex.nush.NushModule
|
||||||
description: Stops raiding in its tracks.
|
description: Stops raiding in its tracks.
|
||||||
version: 1.3
|
version: 1.4-SNAPSHOT
|
Loading…
x
Reference in New Issue
Block a user