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.
*/
private void setOrFetch(PlayerProperty property, int defaultValue) {
this.setProperty(property,
this.properties.containsKey(property.getId()) ?
this.getProperty(property) : defaultValue, false);
var exists = this.properties.containsKey(property.getId());
if (exists) exists = this.getProperty(property) != 0;
this.setProperty(property, exists ? this.getProperty(property)
: defaultValue, false);
}
public int getPrimogems() {