Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.plugin;
2
3import org.bukkit.event.Event;
4import org.bukkit.event.Listener;
5import org.jetbrains.annotations.NotNull;
6
7import java.io.File;
8import java.util.Map;
9import java.util.Set;
10import java.util.regex.Pattern;
11
12/**
13 * Represents a plugin loader, which handles direct access to specific types
14 * of plugins
15 */
16public interface PluginLoader {
17
18 /**
19 * Loads the plugin contained in the specified file
20 *
21 * @param file File to attempt to load
22 * @return Plugin that was contained in the specified file, or null if
23 * unsuccessful
24 * @throws InvalidPluginException Thrown when the specified file is not a plugin
25 */
26 public Plugin loadPlugin(File file) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException;
27
28 // Project Poseidon Start
29
30 /**
31 * Creates listener map for class
32 *
33 * @param listener listener class
34 * @param plugin plugin
35 * @return Map for all the events in the class
36 */
37 public Map<Class<? extends Event>, Set<RegisteredListener>> createRegisteredListeners(@NotNull Listener listener, @NotNull final Plugin plugin);
38 // Project Poseidon End
39
40 /**
41 * Loads the plugin contained in the specified file
42 *
43 * @param file File to attempt to load
44 * @param ignoreSoftDependencies Loader will ignore soft dependencies if this flag is set to true
45 * @return Plugin that was contained in the specified file, or null if
46 * unsuccessful
47 * @throws InvalidPluginException Thrown when the specified file is not a plugin
48 */
49 public Plugin loadPlugin(File file, boolean ignoreSoftDependencies) throws InvalidPluginException, InvalidDescriptionException, UnknownDependencyException;
50
51 /**
52 * Returns a list of all filename filters expected by this PluginLoader
53 */
54 public Pattern[] getPluginFileFilters();
55
56 /**
57 * Creates and returns an event executor
58 *
59 * @param type Type of the event executor to create
60 * @param listener the object that will handle the eventual call back
61 */
62 public EventExecutor createExecutor(Event.Type type, Listener listener);
63
64 /**
65 * Enables the specified plugin
66 * <p>
67 * Attempting to enable a plugin that is already enabled will have no effect
68 *
69 * @param plugin Plugin to enable
70 */
71 public void enablePlugin(Plugin plugin);
72
73 /**
74 * Disables the specified plugin
75 * <p>
76 * Attempting to disable a plugin that is not enabled will have no effect
77 *
78 * @param plugin Plugin to disable
79 */
80 public void disablePlugin(Plugin plugin);
81}