From 9e974ae73775c7388ab43f73043a82677755ea59 Mon Sep 17 00:00:00 2001 From: james <75051061+notsceptor@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:23:51 +0100 Subject: [PATCH] Add a /tempmute command (#96) * Update WhoHasCMD.java Added functionality that clears all players with a specified item * Added functionality that clears all players with a specified item * Altered tab completion to include "clear" argument * Update WhoHasCMD.java * Implemented a mob limiter that can be configured via a command * Fixed some imports * Refined tab complete * Implemented reviewed changes * Added a /tempmute command * Removed unnecessary imports & simplified the reason assignment * Fixed the usage for the moblimit command --------- Co-authored-by: Telesphoreo --- .../dev/plex/command/impl/MobLimitCMD.java | 2 +- .../dev/plex/command/impl/TempmuteCMD.java | 92 +++++++++++++++++++ .../main/java/dev/plex/util/TimeUtils.java | 38 ++++++++ server/src/main/resources/messages.yml | 9 +- 4 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 server/src/main/java/dev/plex/command/impl/TempmuteCMD.java diff --git a/server/src/main/java/dev/plex/command/impl/MobLimitCMD.java b/server/src/main/java/dev/plex/command/impl/MobLimitCMD.java index 66bbfe6..70dfcaa 100644 --- a/server/src/main/java/dev/plex/command/impl/MobLimitCMD.java +++ b/server/src/main/java/dev/plex/command/impl/MobLimitCMD.java @@ -18,7 +18,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -@CommandParameters(name = "moblimit", usage = "/ [on/off/setmax ]", aliases = "entitylimit", description = "Manages the mob limit per chunk.") +@CommandParameters(name = "moblimit", usage = "/ [on | off | setmax ]", aliases = "entitylimit", description = "Manages the mob limit per chunk.") @CommandPermissions(permission = "plex.moblimit", source = RequiredCommandSource.ANY) public class MobLimitCMD extends PlexCommand { diff --git a/server/src/main/java/dev/plex/command/impl/TempmuteCMD.java b/server/src/main/java/dev/plex/command/impl/TempmuteCMD.java new file mode 100644 index 0000000..12004c8 --- /dev/null +++ b/server/src/main/java/dev/plex/command/impl/TempmuteCMD.java @@ -0,0 +1,92 @@ +package dev.plex.command.impl; + +import com.google.common.collect.ImmutableList; +import dev.plex.command.PlexCommand; +import dev.plex.command.annotation.CommandParameters; +import dev.plex.command.annotation.CommandPermissions; +import dev.plex.player.PlexPlayer; +import dev.plex.punishment.Punishment; +import dev.plex.punishment.PunishmentType; +import dev.plex.util.PlexUtils; +import dev.plex.util.TimeUtils; // Import your TimeUtils +import net.kyori.adventure.text.Component; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.time.ZonedDateTime; +import java.util.Arrays; +import java.util.List; + +@CommandParameters(name = "tempmute", description = "Temporarily mute a player on the server", + usage = "/