respawn when a property changes
This commit is contained in:
parent
eb6d1fc5c9
commit
0e9fab6e7a
1 changed files with 5 additions and 1 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue