/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pw.ian.albkit.command;

import pw.ian.albkit.command.parser.Arguments;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

/**
 *
 * @author ian
 */
public abstract class PlayerCommandHandler extends CommandHandler {

    public PlayerCommandHandler(JavaPlugin plugin, String name) {
        super(plugin, name);
    }

    @Override
    public void onCommand(CommandSender sender, Arguments args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.RED + "You must be a player to use this command.");
            return;
        }

        onCommand((Player) sender, args);
    }

    @Override
    public void onCommand(CommandSender sender, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.RED + "You must be a player to use this command.");
            return;
        }

        onCommand((Player) sender, args);
    }

    public void onCommand(Player player, Arguments args) {
    }

    public void onCommand(Player player, String[] args) {
    }

}

@@ -499,16 +499,94 @@
 dler %7B%0A%0A
+    /**%0A     * C'tor%0A     * %0A     * @param plugin%0A     * @param name %0A     */%0A
     publ
@@ -737,33 +737,32 @@
 der sender, 
-Arguments
+String%5B%5D
  args) %7B%0A   
@@ -974,33 +974,127 @@
 %0A    %7D%0A%0A    
-@Override
+/**%0A     * Called when this command is executed.%0A     *%0A     * @param player%0A     * @param args%0A     */
 %0A    public 
@@ -1108,34 +1108,27 @@
 Command(
-CommandSender send
+Player play
 er, Stri
@@ -1152,281 +1152,167 @@
     
-if (!(sender instanceof Player)) %7B
+this.onCommand(player, new Arguments(args));
 %0A    
+%7D%0A%0A
     
-    sender.sendMessage(ChatColor.RED + %22You must be a player to use this command.%22);%0A            return;%0A        %7D%0A%0A        onCommand((Player) sender, args);%0A    %7D%0A%0A    public void onCommand(Player player, Arguments
+/**%0A     * Called when this command is executed.%0A     *%0A     * @param player%0A     * @param
  args
-) %7B
 %0A    
-%7D%0A
+ */
 %0A   
@@ -1345,32 +1345,33 @@
 yer player, 
-String%5B%5D
+Arguments
  args) %7B%0A   

Clean up PlayerCommandHandler