From 742bc9a23c5ca38431154018f20c91117765411b Mon Sep 17 00:00:00 2001 From: jojo Date: Tue, 29 Dec 2020 19:05:39 +0100 Subject: [PATCH] Add Argument.PARTICLE Add Argument.ENTITY Add Argument.SOUND Add Argument.SOUND_CATEGORY --- .../src/de/steamwar/command/Argument.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/Argument.java b/SpigotCore_Main/src/de/steamwar/command/Argument.java index 652c684..dadae09 100644 --- a/SpigotCore_Main/src/de/steamwar/command/Argument.java +++ b/SpigotCore_Main/src/de/steamwar/command/Argument.java @@ -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 { private static final String[] materialArray = Arrays.stream(Material.values()).map(Enum::name).toArray(String[]::new); public static final Argument 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 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 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 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 SOUND_CATEGORY = new Argument<>(ArgumentType.STRING, string -> SoundCategory.valueOf(string) != null, SoundCategory::valueOf, () -> soundCategoryArray); + private ArgumentType argumentType; private Predicate constraint; private Function tabCompletes;