com.amoebaman.kitmaster.handlers
Class KitHandler

java.lang.Object
  extended by com.amoebaman.kitmaster.handlers.KitHandler

public class KitHandler
extends java.lang.Object


Constructor Summary
KitHandler()
           
 
Method Summary
static Kit getKit(java.lang.String kitName)
          Gets a kit by its name.
static PermsResult getKitPerms(org.bukkit.command.CommandSender sender, Kit kit)
          Tests a CommandSender's permissions to access a kit.
static java.util.ArrayList<Kit> getKits()
          Gets the list of all registered kits.
static boolean isKit(java.lang.String kitName)
          Tests whether a kit exists that matches the given name.
static void loadKits(java.io.File file)
          Loads kits into the internal kit list from a file.
static Kit parseKit(java.io.File file)
          Parses a kit from a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KitHandler

public KitHandler()
Method Detail

loadKits

public static void loadKits(java.io.File file)
Loads kits into the internal kit list from a file. If the file is suffixed with .kit, the file will be immediately loaded. If the file is a directory, all files within it suffixed with .kit will be automatically loaded. If neither condition is met, nothing will happen.

Parameters:
file - The file to load kits from.

parseKit

public static Kit parseKit(java.io.File file)
Parses a kit from a file. All kits are parsed using YAML.

Parameters:
file - The file to parse a kit from.
Returns:
The kit parsed from the file.

getKit

public static Kit getKit(java.lang.String kitName)
Gets a kit by its name. This method will ignore case. If no kit maches the argument precisely, it will consider abbreviations. The applyParentAttributes() method will be used on the kit prior to returning.

Parameters:
kitName - The name of the desired kit.
Returns:
The kit whose name matches the argument, or null if no kit was found.

isKit

public static boolean isKit(java.lang.String kitName)
Tests whether a kit exists that matches the given name.

Parameters:
kitName - The name of the kit to search for.
Returns:
True if a kit was found that matches the given name, false otherwise.

getKits

public static java.util.ArrayList<Kit> getKits()
Gets the list of all registered kits.

Returns:
The list of kits.

getKitPerms

public static PermsResult getKitPerms(org.bukkit.command.CommandSender sender,
                                      Kit kit)
Tests a CommandSender's permissions to access a kit.

Parameters:
sender - The CommandSender to test.
kit - The kit to test.
Returns:
The PermsResult that reflects the nature of the testee's permissions for the given kit.