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

View File

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

View File

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