diff --git a/api/src/main/java/lol/pyr/znpcsplus/api/entity/EntityPropertyRegistry.java b/api/src/main/java/lol/pyr/znpcsplus/api/entity/EntityPropertyRegistry.java index 0009ee9..dad18d8 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/api/entity/EntityPropertyRegistry.java +++ b/api/src/main/java/lol/pyr/znpcsplus/api/entity/EntityPropertyRegistry.java @@ -6,4 +6,5 @@ public interface EntityPropertyRegistry { Collection> getAll(); EntityProperty getByName(String name); EntityProperty getByName(String name, Class type); + void registerDummy(String name, Class type); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java index 4fae9cf..2013141 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java @@ -253,6 +253,7 @@ public class ZNpcsPlus extends JavaPlugin { manager.registerParser(InteractionType.class, new InteractionTypeParser(incorrectUsageMessage)); manager.registerParser(Color.class, new ColorParser(incorrectUsageMessage)); manager.registerParser(Vector3f.class, new Vector3fParser(incorrectUsageMessage)); + manager.registerParser(String.class, new StringParser(incorrectUsageMessage)); // TODO: Need to find a better way to do this registerEnumParser(manager, NpcPose.class, incorrectUsageMessage); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java index eaaea72..f26741f 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/entity/EntityPropertyRegistryImpl.java @@ -569,6 +569,11 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry { return (EntityPropertyImpl) getByName(name); } + @Override + public void registerDummy(String name, Class type) { + register(new DummyProperty<>(name, type)); + } + public EntityPropertyImpl getByName(String name) { return byName.get(name.toLowerCase()); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/parsers/StringParser.java b/plugin/src/main/java/lol/pyr/znpcsplus/parsers/StringParser.java new file mode 100644 index 0000000..a14ac42 --- /dev/null +++ b/plugin/src/main/java/lol/pyr/znpcsplus/parsers/StringParser.java @@ -0,0 +1,19 @@ +package lol.pyr.znpcsplus.parsers; + +import lol.pyr.director.adventure.command.CommandContext; +import lol.pyr.director.adventure.parse.ParserType; +import lol.pyr.director.common.command.CommandExecutionException; +import lol.pyr.director.common.message.Message; + +import java.util.Deque; + +public class StringParser extends ParserType { + public StringParser(Message message) { + super(message); + } + + @Override + public String parse(Deque deque) throws CommandExecutionException { + return deque.pollFirst(); + } +} diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml index e1abf93..d6beb5b 100644 --- a/plugin/src/main/resources/plugin.yml +++ b/plugin/src/main/resources/plugin.yml @@ -21,6 +21,9 @@ softdepend: - ViaRewind - Geyser-Spigot +loadbefore: + - Quests + commands: npc: aliases: