From 4f1e43b4fa350628c83a8a53a4a9b10e17b73873 Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Wed, 12 Jul 2023 20:51:09 +0200 Subject: [PATCH] add warning message for missing properties --- .../src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java index 547f978..5b3a4e1 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcTypeImpl.java @@ -9,6 +9,7 @@ import lol.pyr.znpcsplus.entity.EntityPropertyImpl; import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl; import java.util.*; +import java.util.logging.Logger; import java.util.stream.Collectors; public class NpcTypeImpl implements NpcType { @@ -41,6 +42,8 @@ public class NpcTypeImpl implements NpcType { } protected static final class Builder { + private final static Logger logger = Logger.getLogger("NpcTypeBuilder"); + private final EntityPropertyRegistryImpl propertyRegistry; private final String name; private final EntityType type; @@ -68,7 +71,10 @@ public class NpcTypeImpl implements NpcType { public Builder addProperties(String... names) { for (String name : names) { - if (propertyRegistry.getByName(name) == null) continue; + if (propertyRegistry.getByName(name) == null) { + logger.warning("Tried to register the non-existent \"" + name + "\" property to the \"" + this.name + "\" npc type"); + continue; + } allowedProperties.add(propertyRegistry.getByName(name)); } return this;