Module-TFMExtras/src/main/java/dev/plex/extras/command/AttributeListCommand.java

33 lines
1.3 KiB
Java
Executable File

package dev.plex.extras.command;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.attribute.Attribute;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "attributes", description = "Lists all possible attributes", aliases = "attributelist,attrlist")
@CommandPermissions(permission = "plex.tfmextras.attrlist")
public class AttributeListCommand extends PlexCommand
{
@Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{
return messageComponent("attributeList", StringUtils.join(Arrays.stream(Attribute.values()).map(Enum::name).toList(), ", "));
}
@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}