Beta 20220422-SNAPSHOT

Changelog:
 - Added a configuration with editable rarity values and rarity types for the different events that can occur, to give the end user more control over how often players receive the effects.
- Modified listeners to use the respective Configuration values.
- Added the ability to reload a specific player configuration with /luck reload -p <player_name>
- Added the ability to reload the main configuration using /luck reload -m
- Added an integrity checker to validate the main configuration on boot.
This commit is contained in:
Paldiu
2022-04-22 19:25:02 -05:00
parent 6119180b0b
commit 330fd278b7
18 changed files with 280 additions and 93 deletions

View File

@ -16,6 +16,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class LuckCMD extends Command implements TabCompleter {
private final FeelingLucky plugin;
@ -33,6 +34,19 @@ public class LuckCMD extends Command implements TabCompleter {
if (args.length == 3) {
if ((sender instanceof ConsoleCommandSender) || sender.hasPermission("luck.admin")) {
if (args[0].equalsIgnoreCase("reload") && args[1].equalsIgnoreCase("-p")) {
Player player = Bukkit.getPlayer(args[2]);
if (player == null) {
sender.sendMessage(Messages.NO_PLAYER.get());
return true;
}
UUID uuid = player.getUniqueId();
PlayerConfig config = plugin.getConfigMap().get(uuid);
config.reload();
sender.sendMessage(MiniComponent.info("Successfully reloaded " + player.getName() + "'s configuration file."));
return true;
}
Player player = Bukkit.getPlayer(args[1]);
double amount = Double.parseDouble(args[2]);
@ -80,6 +94,10 @@ public class LuckCMD extends Command implements TabCompleter {
if (args.length == 2) {
if ((sender instanceof ConsoleCommandSender) || sender.hasPermission("luck.admin")) {
if (args[0].equalsIgnoreCase("reload") && args[1].equalsIgnoreCase("-m")) {
}
if (args[0].equalsIgnoreCase("info")) {
Player player = Bukkit.getPlayer(args[1]);