mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 17:34:39 +01:00
Fix setOrFetch on 0 values
This commit is contained in:
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user