From 74af9522aee5c47cfeff71abebddadc034fb157a Mon Sep 17 00:00:00 2001
From: Pyrbu <pyrmcserver@gmail.com>
Date: Thu, 11 May 2023 07:14:39 +0100
Subject: [PATCH] make property suggestions work

---
 plugin/build.gradle                                        | 2 +-
 .../java/lol/pyr/znpcsplus/commands/PropertiesCommand.java | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/plugin/build.gradle b/plugin/build.gradle
index 1cbf477..20844a0 100644
--- a/plugin/build.gradle
+++ b/plugin/build.gradle
@@ -28,7 +28,7 @@ dependencies {
     implementation "com.github.retrooper.packetevents:spigot:2.0.0-SNAPSHOT"
     implementation "space.arim.dazzleconf:dazzleconf-ext-snakeyaml:1.2.1"
 
-    implementation "lol.pyr:director-adventure:2.0.6"
+    implementation "lol.pyr:director-adventure:2.0.7"
     implementation project(":api")
 }
 
diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java
index 3dbc200..0bfc233 100644
--- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java
+++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java
@@ -8,6 +8,7 @@ import lol.pyr.znpcsplus.npc.NpcEntryImpl;
 import lol.pyr.znpcsplus.npc.NpcImpl;
 import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
 import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
 
 import java.util.Collections;
 import java.util.List;
@@ -24,14 +25,14 @@ public class PropertiesCommand implements CommandHandler {
         // TODO: implement all the parsers for the types used in EntityPropertyImpl
         Object value = context.parse(property.getType());
         npc.UNSAFE_setProperty(property, value);
-        context.send(Component.text("Set property " + property.getName() + " for NPC " + entry.getId() + " to " + value.toString()));
+        context.send(Component.text("Set property " + property.getName() + " for NPC " + entry.getId() + " to " + value.toString(), NamedTextColor.GREEN));
     }
 
     @Override
     public List<String> suggest(CommandContext context) throws CommandExecutionException {
         if (context.argSize() == 1) return context.suggestCollection(NpcRegistryImpl.get().modifiableIds());
-        if (context.argSize() == 2) return context.suggestStream(context.suggestionParse(1, NpcEntryImpl.class)
-                .getNpc().getType().getAllowedProperties().stream().map(EntityPropertyImpl::getName));
+        if (context.argSize() == 2) return context.suggestStream(context.suggestionParse(0, NpcEntryImpl.class)
+                    .getNpc().getType().getAllowedProperties().stream().map(EntityPropertyImpl::getName));
         return Collections.emptyList();
     }
 }