Set default points to 0 when getting existing points (in case there are none)
This commit is contained in:
parent
c780054f24
commit
38e54a2704
|
|
@ -5,6 +5,7 @@ import com.alttd.database.Queries;
|
|||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class EconUser {
|
||||
|
|
@ -32,7 +33,7 @@ public class EconUser {
|
|||
if (pointsMap.containsKey(villagerType))
|
||||
pointsMap.put(villagerType, points);
|
||||
else
|
||||
pointsMap.put(villagerType, pointsMap.get(villagerType) + points);
|
||||
pointsMap.put(villagerType, Objects.requireNonNullElse(pointsMap.get(villagerType), 0) + points);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user