// Path: src/com/sijobe/spc/wrapper/MinecraftServer.java
// public class MinecraftServer {
// 
//    /**
//     * Gets the instance of the Minecraft server that is running
//     * 
//     * @return The Minecraft server instance
//     */
//    public static net.minecraft.server.MinecraftServer getMinecraftServer() {
//       return net.minecraft.server.MinecraftServer.getServer();
//    }
//    
//    /**
//     * Gets the version of Minecraft that the server currently is
//     * 
//     * @return The server version
//     */
//    public static String getVersion() {
//       return getMinecraftServer().getMinecraftVersion();
//    }
//    
//    /**
//     * Returns a List of all currently logged in users
//     * 
//     * @return A List of all the usernames of logged in users
//     */
//    public static List<String> getPlayers() {
//       List<String> players = new ArrayList<String>();
//       for (String username : getMinecraftServer().getAllUsernames()) {
//          players.add(username.toLowerCase());
//       }
//       return players;
//    }
//    
//    /**
//     * Checks if the specified user is currently logged in, if so true is 
//     * returned, otherwise false
//     * 
//     * @param username - The username to check
//     * @return True if the user is logged in
//     */
//    public static boolean isLoggedIn(String username) {
//       return getPlayers().indexOf(username.toLowerCase()) != -1;
//    }
//    
//    /**
//     * Gets the player object that matches the provided username or null if the 
//     * username cannot be found
//     * 
//     * @param username - The username to search for
//     * @return The Player object that wraps the Minecraft instance
//     */
//    public static Player getPlayerByUsername(String username) {
//       if (isLoggedIn(username)) {
//          return new Player(getMinecraftServer().getConfigurationManager().getPlayerForUsername(username));
//       }
//       return null;
//    }
//    
//    /**
//     * Runs the specified command (with parameters) on the server. Note that 
//     * this sends through the command as a server instance rather than with a 
//     * player. If you need to send through a command using a sender please see
//     * CommandManager.runCommand
//     * 
//     * @param command - The command to run on the server
//     * @return A String of the output received 
//     * @see CommandManager#runCommand(CommandSender, String)
//     */
//    public static String runCommand(String command) {
//       return getMinecraftServer().executeCommand(command);
//    }
//    
//    /**
//     * Gets the directory name of the loaded world
//     * 
//     * @return The directory name of the world
//     */
//    public static String getDirectoryName() {
//       return getMinecraftServer().getFolderName();
//    }
//    
//    /**
//     * Gets the directory that the currently loaded world is located at
//     * 
//     * @return The location where the world is located
//     */
//    public static File getWorldDirectory() {
//       return new File(Constants.SAVES_DIR, getDirectoryName());
//    }
// }


import com.sijobe.spc.wrapper.MinecraftServer;
package com.sijobe.spc.validation;


/**
 * Validates that the provided value is a logged in players name
 *
 * @author simo_415
 * @version 1.0
 */
public class ParameterPlayer extends Parameter {

   /**
    * Initialises the instance using the set parameters
    * 
    * @param label - The name of the parameter
    * @param optional - True if the parameter is optional
    */
   public ParameterPlayer(String label, boolean optional) {
      super(label,optional);
   }

   /**
    * @see com.sijobe.spc.validation.Parameter#validate(java.lang.String)
    */
   @Override
   public Object validate(String parameter) throws ValidationException {
      // Need to loop through rather than use List.contains due to case sensitivity
      for (String player : MinecraftServer.getPlayers()) {
         if (parameter.equalsIgnoreCase(player)) {
// Path: src/com/sijobe/spc/wrapper/MinecraftServer.java
// public class MinecraftServer {
// 
//    /**
//     * Gets the instance of the Minecraft server that is running
//     * 
//     * @return The Minecraft server instance
//     */
//    public static net.minecraft.server.MinecraftServer getMinecraftServer() {
//       return net.minecraft.server.MinecraftServer.getServer();
//    }
//    
//    /**
//     * Gets the version of Minecraft that the server currently is
//     * 
//     * @return The server version
//     */
//    public static String getVersion() {
//       return getMinecraftServer().getMinecraftVersion();
//    }
//    
//    /**
//     * Returns a List of all currently logged in users
//     * 
//     * @return A List of all the usernames of logged in users
//     */
//    public static List<String> getPlayers() {
//       List<String> players = new ArrayList<String>();
//       for (String username : getMinecraftServer().getAllUsernames()) {
//          players.add(username.toLowerCase());
//       }
//       return players;
//    }
//    
//    /**
//     * Checks if the specified user is currently logged in, if so true is 
//     * returned, otherwise false
//     * 
//     * @param username - The username to check
//     * @return True if the user is logged in
//     */
//    public static boolean isLoggedIn(String username) {
//       return getPlayers().indexOf(username.toLowerCase()) != -1;
//    }
//    
//    /**
//     * Gets the player object that matches the provided username or null if the 
//     * username cannot be found
//     * 
//     * @param username - The username to search for
//     * @return The Player object that wraps the Minecraft instance
//     */
//    public static Player getPlayerByUsername(String username) {
//       if (isLoggedIn(username)) {
//          return new Player(getMinecraftServer().getConfigurationManager().getPlayerForUsername(username));
//       }
//       return null;
//    }
//    
//    /**
//     * Runs the specified command (with parameters) on the server. Note that 
//     * this sends through the command as a server instance rather than with a 
//     * player. If you need to send through a command using a sender please see
//     * CommandManager.runCommand
//     * 
//     * @param command - The command to run on the server
//     * @return A String of the output received 
//     * @see CommandManager#runCommand(CommandSender, String)
//     */
//    public static String runCommand(String command) {
//       return getMinecraftServer().executeCommand(command);
//    }
//    
//    /**
//     * Gets the directory name of the loaded world
//     * 
//     * @return The directory name of the world
//     */
//    public static String getDirectoryName() {
//       return getMinecraftServer().getFolderName();
//    }
//    
//    /**
//     * Gets the directory that the currently loaded world is located at
//     * 
//     * @return The location where the world is located
//     */
//    public static File getWorldDirectory() {
//       return new File(Constants.SAVES_DIR, getDirectoryName());
//    }
// }


// Path: src/com/sijobe/spc/validation/ParameterPlayer.java
import com.sijobe.spc.wrapper.MinecraftServer;

package com.sijobe.spc.validation;


/**
 * Validates that the provided value is a logged in players name
 *
 * @author simo_415
 * @version 1.0
 */
public class ParameterPlayer extends Parameter {

   /**
    * Initialises the instance using the set parameters
    * 
    * @param label - The name of the parameter
    * @param optional - True if the parameter is optional
    */
   public ParameterPlayer(String label, boolean optional) {
      super(label,optional);
   }

   /**
    * @see com.sijobe.spc.validation.Parameter#validate(java.lang.String)
    */
   @Override
   public Object validate(String parameter) throws ValidationException {
      // Need to loop through rather than use List.contains due to case sensitivity
      for (String player : MinecraftServer.getPlayers()) {
         if (parameter.equalsIgnoreCase(player)) {
            return MinecraftServer.getPlayerByUsername(player);