001 package org.bukkit.plugin;
002
003 import java.io.File;
004 import java.util.Map;
005 import java.util.Set;
006 import java.util.regex.Pattern;
007
008 import org.bukkit.event.Event;
009 import org.bukkit.event.Listener;
010
011 /**
012 * Represents a plugin loader, which handles direct access to specific types
013 * of plugins
014 */
015 public interface PluginLoader {
016
017 /**
018 * Loads the plugin contained in the specified file
019 *
020 * @param file File to attempt to load
021 * @return Plugin that was contained in the specified file, or null if
022 * unsuccessful
023 * @throws InvalidPluginException Thrown when the specified file is not a
024 * plugin
025 * @throws UnknownDependencyException If a required dependency could not
026 * be found
027 */
028 public Plugin loadPlugin(File file) throws InvalidPluginException, UnknownDependencyException;
029
030 /**
031 * Loads a PluginDescriptionFile from the specified file
032 *
033 * @param file File to attempt to load from
034 * @return A new PluginDescriptionFile loaded from the plugin.yml in the
035 * specified file
036 * @throws InvalidDescriptionException If the plugin description file
037 * could not be created
038 */
039 public PluginDescriptionFile getPluginDescription(File file) throws InvalidDescriptionException;
040
041 /**
042 * Returns a list of all filename filters expected by this PluginLoader
043 *
044 * @return The filters
045 */
046 public Pattern[] getPluginFileFilters();
047
048 /**
049 * Creates and returns registered listeners for the event classes used in
050 * this listener
051 *
052 * @param listener The object that will handle the eventual call back
053 * @param plugin The plugin to use when creating registered listeners
054 * @return The registered listeners.
055 */
056 public Map<Class<? extends Event>, Set<RegisteredListener>> createRegisteredListeners(Listener listener, Plugin plugin);
057
058 /**
059 * Enables the specified plugin
060 * <p>
061 * Attempting to enable a plugin that is already enabled will have no
062 * effect
063 *
064 * @param plugin Plugin to enable
065 */
066 public void enablePlugin(Plugin plugin);
067
068 /**
069 * Disables the specified plugin
070 * <p>
071 * Attempting to disable a plugin that is not enabled will have no effect
072 *
073 * @param plugin Plugin to disable
074 */
075 public void disablePlugin(Plugin plugin);
076 }