Alpha 1.0 RC02 PATCH 01

Fixed an issue where initializing a new PlayerConfig would attempt to read a non existent value from the Luck Container list.
This commit is contained in:
Paldiu
2022-03-31 19:42:18 -05:00
parent 93ee1e2c43
commit 0383bfeaf3
3 changed files with 17 additions and 16 deletions

View File

@ -2,6 +2,7 @@ package io.github.simplex.luck.player;
import io.github.simplex.luck.FeelingLucky;
import io.github.simplex.luck.SneakyWorker;
import org.bukkit.attribute.Attribute;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Contract;
@ -22,7 +23,7 @@ public class PlayerConfig {
File file = new File(dataFolder, player.getUniqueId() + ".yml");
if (!file.exists()) {
String name = "username: " + player.getName();
String luck = "luck: " + PlayerHandler.getLuckContainer(player).defaultValue();
String luck = "luck: " + player.getAttribute(Attribute.GENERIC_LUCK).getDefaultValue();
String multiplier = "multiplier: " + 1.0;
SneakyWorker.sneakyTry(() -> {