SteamWar/SpigotCore
Archiviert
13
0

Add Argument.PARTICLE

Add Argument.ENTITY
Add Argument.SOUND
Add Argument.SOUND_CATEGORY
Dieser Commit ist enthalten in:
jojo 2020-12-29 19:05:39 +01:00
Ursprung ee85ec6696
Commit 742bc9a23c

Datei anzeigen

@ -21,10 +21,8 @@
package de.steamwar.command;
import com.mojang.datafixers.types.Func;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.*;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import java.util.*;
@ -67,6 +65,18 @@ public class Argument<T> {
private static final String[] materialArray = Arrays.stream(Material.values()).map(Enum::name).toArray(String[]::new);
public static final Argument<String> MATERIAL = new Argument<>(ArgumentType.STRING, string -> Material.valueOf(string) != null, Material::valueOf, () -> materialArray);
private static final String[] particleArray = Arrays.stream(Particle.values()).map(Enum::name).toArray(String[]::new);
public static final Argument<String> PARTICLE = new Argument<>(ArgumentType.STRING, string -> Particle.valueOf(string) != null, Particle::valueOf, () -> particleArray);
private static final String[] entityArray = Arrays.stream(EntityType.values()).map(Enum::name).toArray(String[]::new);
public static final Argument<String> ENTITY = new Argument<>(ArgumentType.STRING, string -> EntityType.valueOf(string) != null, EntityType::valueOf, () -> entityArray);
private static final String[] soundArray = Arrays.stream(Sound.values()).map(Enum::name).toArray(String[]::new);
public static final Argument<String> SOUND = new Argument<>(ArgumentType.STRING, string -> Sound.valueOf(string) != null, Sound::valueOf, () -> soundArray);
private static final String[] soundCategoryArray = Arrays.stream(SoundCategory.values()).map(Enum::name).toArray(String[]::new);
public static final Argument<String> SOUND_CATEGORY = new Argument<>(ArgumentType.STRING, string -> SoundCategory.valueOf(string) != null, SoundCategory::valueOf, () -> soundCategoryArray);
private ArgumentType<T> argumentType;
private Predicate<T> constraint;
private Function<String, String[]> tabCompletes;