TCheckpoint

This commit is contained in:
Gokalp Sen 2025-04-01 14:53:14 +03:00
parent aa415c443e
commit 00faf1f2fd
16 changed files with 38 additions and 7 deletions

View file

@ -65,10 +65,16 @@ public class PlayerStats {
return;
}
if (type == PersistentDataType.INTEGER) {
int currentStat = dataContainer.getOrDefault(new NamespacedKey(plugin, stat), PersistentDataType.INTEGER, 0);
Integer currentStat = dataContainer.get(new NamespacedKey(plugin, stat), PersistentDataType.INTEGER);
if (currentStat == null) {
currentStat = 0;
}
dataContainer.set(new NamespacedKey(plugin, stat), PersistentDataType.INTEGER, currentStat + amount);
} else if (type == PersistentDataType.DOUBLE) {
double currentStat = dataContainer.getOrDefault(new NamespacedKey(plugin, stat), PersistentDataType.DOUBLE, 0.0);
Double currentStat = dataContainer.get(new NamespacedKey(plugin, stat), PersistentDataType.DOUBLE);
if (currentStat == null) {
currentStat = 0.0;
}
dataContainer.set(new NamespacedKey(plugin, stat), PersistentDataType.DOUBLE, currentStat + amount);
}
}