mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 02:43:15 +00:00
Fix setOrFetch
on 0 values
This commit is contained in:
parent
2a5c7bf75c
commit
3224bbeb4f
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user