All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.cwcode.commands.paperplatform.argument.BlockArg Maven / Gradle / Ivy

There is a newer version: 1.4.2
Show newest version
package ru.cwcode.commands.paperplatform.argument;

import org.bukkit.Material;
import ru.cwcode.commands.Argument;
import ru.cwcode.commands.api.Sender;
import ru.cwcode.commands.arguments.EnumArg;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class BlockArg extends Argument {
  static List blocks = Arrays.stream(Material.values()).filter(Material::isBlock).map(Enum::name).collect(Collectors.toList());
  
  @Override
  public boolean valid(String raw) {
    return blocks.contains(raw);
  }
  
  @Override
  public List completions(Sender sender) {
    return blocks;
  }
  
  @Override
  public String argumentName() {
    return "блок";
  }
  
  @Override
  public Material map() {
    return Material.matchMaterial(raw);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy