Fix setOrFetch on 0 values

This commit is contained in:
KingRainbow44 2023-04-14 01:02:11 -04:00
parent 2a5c7bf75c
commit 3224bbeb4f
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE

View File

@ -535,9 +535,10 @@ public class Player {
* @param defaultValue The value to apply if the property doesn't exist. * @param defaultValue The value to apply if the property doesn't exist.
*/ */
private void setOrFetch(PlayerProperty property, int defaultValue) { private void setOrFetch(PlayerProperty property, int defaultValue) {
this.setProperty(property, var exists = this.properties.containsKey(property.getId());
this.properties.containsKey(property.getId()) ? if (exists) exists = this.getProperty(property) != 0;
this.getProperty(property) : defaultValue, false); this.setProperty(property, exists ? this.getProperty(property)
: defaultValue, false);
} }
public int getPrimogems() { public int getPrimogems() {