/
PluginManager.java
133 lines (116 loc) · 3.59 KB
/
PluginManager.java
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package org.bukkit.plugin;
import org.bukkit.command.CommandMap;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Listener;
/**
* Handles all plugin management from the Server
*/
public interface PluginManager {
/**
* Registers the specified plugin loader
*
* @param loader The PluginLoader instance to register
* @see PluginLoader
*/
public void registerInterface(PluginLoader loader);
/**
* Registers a plugin description
*
* Typically called from {@link PluginLoader#discoverPlugins()}.
*
* @param description The description to register
*/
public void register(PluginDescription description);
/**
* Rediscover and reindex all plugins
*
* Walks the plugin directory, reads descriptions and rebuilds the index
* of all plugins it can find for the registered loaders.
*/
public void rebuildIndex();
/**
* Checks if the given plugin is loaded and returns it when applicable
*
* Please note that the name of the plugin is case-sensitive
*
* @param name Name of the plugin to check
* @return Plugin if it exists, otherwise null
*/
public Plugin getPlugin(String name);
/**
* Gets a list of all currently loaded plugins
*
* @return Array of Plugins
*/
public Plugin[] getPlugins();
/**
* Returns the given plugin's description from the index
*
* Please note that the name of the plugin is case-sensitive
*
* @param name Name of the plugin to check
* @return PluginDescription if it exists, otherwise null
*/
public PluginDescription getPluginDescription(String name);
/**
* Gets a list of all currently known plugins' descriptions
*
* @return Array of PluginDescriptions
*/
public PluginDescription[] getPluginDescriptions();
/**
* Calls a player related event with the given details
*
* @param event Event details
*/
public void callEvent(Event event);
/**
* Registers the given event to the specified listener
*
* @param type Event type to register
* @param listener Listener to register
* @param priority Priority of this event
* @param plugin Plugin to register
*/
public void registerEvent(Event.Type type, Listener listener, Priority priority, Plugin plugin);
/**
* Registers the given event to the specified executor
*
* @param type Event type to register
* @param listener Listener to register
* @param executor EventExecutor to register
* @param priority Priority of this event
* @param plugin Plugin to register
*/
public void registerEvent(Event.Type type, Listener listener, EventExecutor executor, Priority priority, Plugin plugin);
/**
* Enables the specified plugin
*
* Attempting to enable a plugin that is already enabled will simply
* return the existing Plugin object.
*
* @param description Description of the plugin to enable
*/
public Plugin enablePlugin(PluginDescription description);
/**
* Enable all plugins in the index
*/
public void enableAllPlugins();
/**
* Disables the specified plugin
*
* @param plugin Plugin to disable
*/
public void disablePlugin(Plugin plugin);
/**
* Disables all the loaded plugins
*/
public void disableAllPlugins();
/**
* Get the command map used to keep track of plugin commands
*
* @return A CommandMap instance
*/
public CommandMap getCommandMap();
}