package uk.co.eluinhost.commands;

import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.RemoteConsoleCommandSender;
import org.bukkit.entity.Player;

public enum SenderType {
    COMMAND_BLOCK(BlockCommandSender.class),
    REMOTE_CONSOLE(RemoteConsoleCommandSender.class),
    CONSOLE(ConsoleCommandSender.class),
    PLAYER(Player.class);

    private final Class m_clazz;

    /**
     * @param clazz the class representing
     */
    SenderType(Class clazz){
        m_clazz = clazz;
    }

    /**
     * Returns the enum value for the sender
     * @param sender the sender to parse
     * @return the SenderType or null if not known
     */
    public static SenderType getFromCommandSender(CommandSender sender){
        for(SenderType type : SenderType.values()){
            if(type.getClassType().equals(sender.getClass())){
                return type;
            }
        }
        return null;
    }

    /**
     * @return the class for this enum
     */
    private Class getClassType() {
        return m_clazz;
    }
}

@@ -440,16 +440,33 @@
 r.class)
+,%0A    OTHER(null)
 ;%0A%0A    p
@@ -912,30 +912,23 @@
 if(type.
-getClassType()
+m_clazz
 .equals(
@@ -1016,20 +1016,21 @@
  return 
-null
+OTHER
 ;%0A    %7D%0A

return OTHER for custom CommandSenders