package net.piratjsk.sddls;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;

public final class SddlsCommand implements CommandExecutor {

    private final Sddls plugin;

    public SddlsCommand(Sddls plugin) {
        this.plugin = plugin;
    }

    public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
        if (args.length > 0 && args[0].equalsIgnoreCase("reload")){
            if (sender instanceof ConsoleCommandSender || sender.hasPermission("sddls.reload")) {
                plugin.reloadConfig();
                plugin.loadConfig();
                sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&6[Sddls] &rReloaded!"));
                return true;
            }
        }
        sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&6[Sddls] &rv"+plugin.getDescription().getVersion()));
        sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&r"+plugin.getDescription().getDescription()));
        sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7"+plugin.getDescription().getWebsite()));
        if (sender instanceof ConsoleCommandSender || sender.hasPermission("sddls.reload"))
            sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&6/sddls reload &r- reloads config"));
        return true;
    }

}

@@ -217,16 +217,64 @@
 dSender;
+%0Aimport org.bukkit.plugin.PluginDescriptionFile;
 %0A%0Apublic
@@ -345,26 +345,79 @@
 ate 
-final Sddls plugin
+static final String TAG = %22&6%5BSddls%5D &r%22;%0A    private final Sddls sddls
 ;%0A%0A 
@@ -443,15 +443,26 @@
 and(
-Sddls p
+final Sddls sddlsP
 lugi
@@ -483,18 +483,22 @@
 his.
-plugin = p
+sddls = sddlsP
 lugi
@@ -808,22 +808,21 @@
         
-plugin
+sddls
 .reloadC
@@ -850,120 +850,25 @@
     
-plugin.loadConfig();%0A                sender.sendMessage(ChatColor.translateAlternateColorCodes('&',%22&6%5BSddls%5D &r
+sendMsg(sender, %22
 Relo
@@ -874,17 +874,16 @@
 oaded!%22)
-)
 ;%0A      
@@ -941,96 +941,265 @@
     
-sender.sendMessage(ChatColor.translateAlternateColorCodes('&',%22&6%5BSddls%5D &rv%22+p
+this.sendPluginInfo(sender);%0A        if (sender.hasPermission(%22sddls.reload%22))%0A            sendMsg(sender, %22/sddls reload &7- reloads config%22);%0A        return true;%0A    %7D%0A%0A    private void sendPluginInfo(final CommandSender recipient) %7B%0A        final P
 lugin
-.get
 Desc
@@ -1209,25 +1209,42 @@
 tion
-().getVers
+File info = sddls.getDescript
 ion()
-))
 ;%0A  
@@ -1257,94 +1257,157 @@
 send
-er.sendMessage(ChatColor.translateAlternateColorCodes('&',%22&r%22+plugin.getDescription()
+Msg(recipient, info.getFullName() + %22 v%22 + info.getVersion());%0A        sendMsg(recipient, %22by %22 + info.getAuthors());%0A        sendMsg(recipient, info
 .get
@@ -1420,17 +1420,16 @@
 ption())
-)
 ;%0A      
@@ -1438,94 +1438,33 @@
 send
-er.sendMessage(ChatColor.translateAlternateColorCodes('&',%22&7%22+plugin.getDescription()
+Msg(recipient, %22&7%22+ info
 .get
@@ -1477,236 +1477,193 @@
 e())
-)
 ;%0A    
+%7D%0A%0A
     
-if (sender instanceof ConsoleCommandSender %7C%7C sender.hasPermission(%22sddls.reload%22))%0A            sender.sendMessage(ChatColor.translateAlternateColorCodes('&',%22&6/sddls reload &r- reloads config%22));%0A        return true
+private static void sendMsg(final CommandSender recipient, final String message) %7B%0A        recipient.sendMessage(ChatColor.translateAlternateColorCodes('&', TAG + message))
 ;%0A  

refactor sddls command