From 467eac59728191c2d120d147b0935221e16ee431 Mon Sep 17 00:00:00 2001
From: D3v1s0m <d3v1s0m@gmail.com>
Date: Wed, 23 Aug 2023 02:53:26 +0530
Subject: [PATCH] generalized suggestion of enum property in property set
 command

---
 .../commands/property/PropertySetCommand.java  | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/property/PropertySetCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/property/PropertySetCommand.java
index 25b6a5c..752f8cb 100644
--- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/property/PropertySetCommand.java
+++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/property/PropertySetCommand.java
@@ -16,7 +16,6 @@ import lol.pyr.znpcsplus.util.*;
 import net.kyori.adventure.text.Component;
 import net.kyori.adventure.text.format.NamedTextColor;
 import org.bukkit.Color;
-import org.bukkit.DyeColor;
 import com.github.retrooper.packetevents.protocol.item.ItemStack;
 
 import java.util.Collections;
@@ -118,20 +117,13 @@ public class PropertySetCommand implements CommandHandler {
             if (context.argSize() == 3) {
                 if (type == Boolean.class) return context.suggestLiteral("true", "false");
                 if (type == NamedTextColor.class) return context.suggestCollection(NamedTextColor.NAMES.keys());
-                if (type == NpcPose.class) return context.suggestEnum(NpcPose.values());
                 if (type == Color.class) return context.suggestLiteral("0x0F00FF", "#FFFFFF");
-                if (type == DyeColor.class) return context.suggestEnum(DyeColor.values());
-                if (type == CatVariant.class) return context.suggestEnum(CatVariant.values());
-                if (type == CreeperState.class) return context.suggestEnum(CreeperState.values());
-                if (type == ParrotVariant.class) return context.suggestEnum(ParrotVariant.values());
                 if (type == BlockState.class) return context.suggestLiteral("hand", "looking_at", "block");
-                if (type == SpellType.class) return context.suggestEnum(SpellType.values());
-                if (type == FoxVariant.class) return context.suggestEnum(FoxVariant.values());
-                if (type == FrogVariant.class) return context.suggestEnum(FrogVariant.values());
-                if (type == VillagerType.class) return context.suggestEnum(VillagerType.values());
-                if (type == VillagerProfession.class) return context.suggestEnum(VillagerProfession.values());
-                if (type == VillagerLevel.class) return context.suggestEnum(VillagerLevel.values());
-                if (type == AxolotlVariant.class) return context.suggestEnum(AxolotlVariant.values());
+
+                // Suggest enum values directly
+                if (type.isEnum()) {
+                    return context.suggestEnum((Enum<?>[]) type.getEnumConstants());
+                }
             }
             else if (context.argSize() == 4) {
                 if (type == BlockState.class) {