ru.cwcode.commands.paperplatform.argument.BlockArg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of PaperCommands Show documentation
Show all versions of PaperCommands Show documentation
Commands library for Paper (Minecraft)
The newest version!
package ru.cwcode.commands.paperplatform.argument;
import org.bukkit.Material;
import ru.cwcode.commands.Argument;
import ru.cwcode.commands.api.Sender;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static ru.cwcode.commands.api.CommandsAPI.l10n;
public class BlockArg extends Argument {
static Set blocks = Arrays.stream(Material.values()).filter(Material::isBlock).map(x->x.name()).collect(Collectors.toSet());
@Override
public boolean valid(String raw) {
return blocks.contains(raw);
}
@Override
public Set completions(Sender sender) {
return blocks;
}
@Override
public String argumentName() {
return l10n.get("argument.block.name");
}
@Override
public Material map() {
return Material.matchMaterial(raw);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy