summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/plugin/PluginLoader.java
blob: 2a9dc10f913af1840363d104a8205f44f451f99a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package org.bukkit.plugin;

import java.io.File;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

import org.bukkit.event.Event;
import org.bukkit.event.Listener;

/**
 * Represents a plugin loader, which handles direct access to specific types
 * of plugins
 */
public interface PluginLoader {

    /**
     * Loads the plugin contained in the specified file
     *
     * @param file File to attempt to load
     * @return Plugin that was contained in the specified file, or null if
     *         unsuccessful
     * @throws InvalidPluginException Thrown when the specified file is not a plugin
     * @throws InvalidDescriptionException If the plugin description file was invalid
     * @throws UnknownDependencyException If a required dependency could not be found
     */
    public Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException;

    /**
     * Loads the plugin contained in the specified file
     *
     * @param file File to attempt to load
     * @param ignoreSoftDependencies Loader will ignore soft dependencies if this flag is set to true
     * @return Plugin that was contained in the specified file, or null if
     *         unsuccessful
     * @throws InvalidPluginException Thrown when the specified file is not a plugin
     * @throws InvalidDescriptionException If the plugin description file was invalid
     * @throws UnknownDependencyException If a required dependency could not be found
     */
    public Plugin loadPlugin(File file, boolean ignoreSoftDependencies) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException;

    /**
     * Returns a list of all filename filters expected by this PluginLoader
     *
     * @return The filters
     */
    public Pattern[] getPluginFileFilters();

    /**
     * Creates and returns an event executor
     *
     * @param type Type of the event executor to create
     * @param listener the object that will handle the eventual call back
     * @return The new executor
     * @deprecated see PluginLoader#createRegisteredListeners
     */
    @Deprecated
    public EventExecutor createExecutor(Event.Type type, Listener listener);

    /**
     * Creates and returns registered listeners for the event classes used in this listener
     *
     * @param listener The object that will handle the eventual call back
     * @param plugin The plugin to use when creating registered listeners
     * @return The registered listeners.
     */
    public Map<Class<? extends Event>, Set<RegisteredListener>> createRegisteredListeners(Listener listener, Plugin plugin);

    /**
     * Enables the specified plugin
     * <p />
     * Attempting to enable a plugin that is already enabled will have no effect
     *
     * @param plugin Plugin to enable
     */
    public void enablePlugin(Plugin plugin);

    /**
     * Disables the specified plugin
     * <p />
     * Attempting to disable a plugin that is not enabled will have no effect
     *
     * @param plugin Plugin to disable
     */
    public void disablePlugin(Plugin plugin);
}