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

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

There is a newer version: 1.4.2
Show newest version
package ru.cwcode.commands.paperplatform.argument;
import org.bukkit.potion.PotionEffectType;
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;

public class PotionEffectArg extends Argument {
  static Set effects = Arrays.stream(PotionEffectType.values()).map(PotionEffectType::getName).collect(Collectors.toSet());
  
  @Override
  public boolean valid(String raw) {
    return effects.contains(raw);
  }
  
  @Override
  public Set completions(Sender sender) {
    return effects;
  }
  
  @Override
  public String argumentName() {
    return "эффект";
  }
  
  @Override
  public Object map() {
    return PotionEffectType.getByName(raw);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy