package net.knarcraft.permissionsigns.command; import net.knarcraft.knarlib.formatting.StringFormatter; import net.knarcraft.permissionsigns.PermissionSigns; import net.knarcraft.permissionsigns.config.Translatable; import net.knarcraft.permissionsigns.manager.PermissionManager; import net.knarcraft.permissionsigns.manager.SignManager; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; /** * The command used to reload this plugin */ public class ReloadCommand implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { StringFormatter stringFormatter = PermissionSigns.getInstance().getStringFormatter(); if (sender.hasPermission("permissionsigns.admin.reload")) { SignManager.loadSigns(); PermissionManager.loadTemporaryPermissions(); PermissionSigns.getInstance().reloadConfig(); stringFormatter.displaySuccessMessage(sender, Translatable.RELOAD_SUCCESSFUL); } else { stringFormatter.displayErrorMessage(sender, Translatable.COMMAND_PERMISSION_DENIED); } return true; } }