HubThat/src/main/java/wtf/beatrice/hubthat/commands/hubthatcommands/ReloadCommand.java

38 lines
1.4 KiB
Java
Raw Normal View History

2022-05-31 20:09:36 +02:00
package wtf.beatrice.hubthat.commands.hubthatcommands;
2020-04-09 16:31:14 +02:00
2022-05-31 20:09:36 +02:00
import wtf.beatrice.hubthat.HubThat;
import wtf.beatrice.hubthat.utils.*;
import wtf.beatrice.hubthat.utils.files.FileUtils;
2020-04-09 16:31:14 +02:00
import org.bukkit.command.CommandSender;
import java.util.logging.Level;
public class ReloadCommand
{
2020-05-27 00:41:02 +02:00
private static final Debugger debugger = new Debugger(ReloadCommand.class.getName());
2020-04-09 16:31:14 +02:00
public static void reloadCommand(CommandSender commandSender, HubThat plugin)
{
if(PermissionUtils.playerHasPermission(commandSender, Permissions.RELOAD_CONFIG))
{
debugger.sendDebugMessage(Level.INFO, "Reloading YAMLS...");
MessageUtils.sendColorizedMessage(commandSender, "&7Reloading &e" + plugin.getName() + "&7 v&e" + plugin.getDescription().getVersion() + "&7...");
FileUtils.checkFiles();
FileUtils.reloadYamls();
MessageUtils.sendColorizedMessage(commandSender, "&eReloaded!");
debugger.sendDebugMessage(Level.INFO, "Reloaded YAMLs!");
// This method checks if player has permissions, checks error codes, and acts accordingly.
plugin.updateChecker.playerMessage(commandSender);
}
else
{
2023-02-11 20:57:11 +01:00
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.RELOAD_CONFIG.permission);
2020-04-09 16:31:14 +02:00
commandSender.sendMessage(errorMessage);
}
}
}