respawn when a property changes

This commit is contained in:
Pyrbu 2023-04-25 18:49:27 +01:00
parent eb6d1fc5c9
commit 0e9fab6e7a

@ -117,11 +117,15 @@ public class NPC {
public <T> void setProperty(NPCProperty<T> key, T value) { public <T> void setProperty(NPCProperty<T> key, T value) {
if (value.equals(key.getDefaultValue())) removeProperty(key); if (value.equals(key.getDefaultValue())) removeProperty(key);
else propertyMap.put(key, value); else {
propertyMap.put(key, value);
respawn();
}
} }
public void removeProperty(NPCProperty<?> key) { public void removeProperty(NPCProperty<?> key) {
propertyMap.remove(key); propertyMap.remove(key);
respawn();
} }
public Collection<NPCAction> getActions() { public Collection<NPCAction> getActions() {