Alpha 1.0 RELEASE - Patch 0003

This commit is contained in:
Paldiu 2022-04-10 19:10:24 -05:00
parent 057450c585
commit ea50032a89
12 changed files with 13 additions and 1 deletions

Binary file not shown.

View File

@ -114,6 +114,11 @@ public class LuckCMD extends Command implements TabCompleter {
}
if (args.length == 1) {
if (args[0].equalsIgnoreCase("reload") && sender.hasPermission("luck.admin")) {
plugin.getConfigMap().values().forEach(PlayerConfig::reload);
return true;
}
if ((sender instanceof Player player) && player.hasPermission("luck.default")) {
if (args[0].equalsIgnoreCase("info")) {
Luck luck = plugin.handler.getLuckContainer(player);
@ -127,7 +132,7 @@ public class LuckCMD extends Command implements TabCompleter {
}
}
return true;
return false;
}
@Override
@ -153,6 +158,7 @@ public class LuckCMD extends Command implements TabCompleter {
switch (args[0]) {
case "info":
case "reset":
case "reload":
return new ArrayList<>();
case "give":
case "take":

View File

@ -30,6 +30,7 @@ public class Luck implements LuckContainer {
this.multiplier = multiplier;
this.plugin = plugin;
BASE_VALUE = plugin.getConfigMap().get(player.getUniqueId()).getConfig().getDouble("luck");
event = new PlayerLuckChangeEvent(this);
}

View File

@ -75,6 +75,11 @@ public class PlayerConfig {
SneakyWorker.sneakyTry(() -> config = YamlConfiguration.loadConfiguration(configFile));
}
public void reload() {
save();
load();
}
public void setLuck(double luck) {
config.set("luck", luck);
save();