Merge branch 'master' into messagesincursion

This commit is contained in:
Video 2024-05-09 17:06:13 -06:00 committed by GitHub
commit 2ed88da151
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 62 additions and 0 deletions

1
Jenkinsfile vendored
View File

@ -14,6 +14,7 @@ pipeline {
archiveArtifacts artifacts: "build/libs/*.jar", fingerprint: true
javadoc javadocDir: "server/build/docs/javadoc", keepAll: false
discordSend description: "**Build:** ${env.BUILD_NUMBER}\n**Status:** ${currentBuild.currentResult}", enableArtifactsList: true, footer: "Built with Jenkins", link: env.BUILD_URL, result: currentBuild.currentResult, scmWebUrl: "https://github.com/plexusorg/Plex", showChangeset: true, title: env.JOB_NAME, webhookURL: env.WEBHOOK_URL
discordSend description: "**Build:** ${env.BUILD_NUMBER}\n**Status:** ${currentBuild.currentResult}", enableArtifactsList: true, footer: "Built with Jenkins", link: env.BUILD_URL, result: currentBuild.currentResult, scmWebUrl: "https://github.com/plexusorg/Plex", showChangeset: true, title: env.JOB_NAME, webhookURL: env.TF_WEBHOOK_URL
cleanWs()
}
}

View File

@ -0,0 +1,61 @@
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.punishment.Punishment;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@CommandParameters(name = "banlist", description = "Manages the banlist", usage = "/<command> [purge]")
@CommandPermissions(permission = "plex.banlist")
public class BanListCommand extends PlexCommand
{
@Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{
if (args.length == 0)
{
plugin.getPunishmentManager().getActiveBans().whenComplete((punishments, throwable) ->
{
send(sender, mmString("<gold>Active Bans (" + punishments.size() + "): <yellow>" + StringUtils.join(punishments.stream().map(Punishment::getPunishedUsername).collect(Collectors.toList()), ", ")));
});
return null;
}
if (args[0].equalsIgnoreCase("purge") || args[0].equalsIgnoreCase("clear"))
{
if (sender instanceof Player)
{
return messageComponent("noPermissionInGame");
}
if (!sender.getName().equalsIgnoreCase("console"))
{
if (!checkPermission(sender, "plex.banlist.clear"))
{
return null;
}
}
plugin.getPunishmentManager().getActiveBans().whenComplete((punishments, throwable) ->
{
punishments.forEach(plugin.getPunishmentManager()::unban);
send(sender, mmString("<gold>Unbanned " + punishments.size() + " players."));
});
}
return null;
}
@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return args.length == 1 && silentCheckPermission(sender, "plex.banlist.clear") ? List.of("purge", "clear") : ImmutableList.of();
}
}