aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/MylesAndMore/tumble/commands/ReloadCommand.java
blob: 4ca26f49e9bfddf3c38bd908cfbbec0e8681fe20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.MylesAndMore.tumble.commands;

import com.MylesAndMore.tumble.TumbleManager;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class ReloadCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        // Check if the sender has perms to run command
        if (sender.hasPermission("tumble.reload")) {
            // If sender does have permission, reload the plugin's config and display a confirmation message
            TumbleManager.getPlugin().reloadConfig();
            sender.sendMessage(ChatColor.GREEN + "Tumble configuration reloaded successfully.");
        }
        else {
            // If sender does not have permission, display them the permissionMessage from the config
            sender.sendMessage(ChatColor.RED + TumbleManager.getPermissionMessage());
        }
        return true;
    }
}