Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.plugin.SimplePluginManager Class Reference
Inheritance diagram for org.bukkit.plugin.SimplePluginManager:
org.bukkit.plugin.PluginManager

Public Member Functions

 SimplePluginManager (Server instance, SimpleCommandMap commandMap)
 
void registerInterface (Class<?extends PluginLoader > loader) throws IllegalArgumentException
 
Plugin[] loadPlugins (File directory)
 
synchronized Plugin loadPlugin (File file) throws InvalidPluginException, UnknownDependencyException
 
synchronized Plugin getPlugin (String name)
 
synchronized Plugin[] getPlugins ()
 
boolean isPluginEnabled (String name)
 
boolean isPluginEnabled (Plugin plugin)
 
void enablePlugin (final Plugin plugin)
 
void disablePlugins ()
 
void disablePlugin (final Plugin plugin)
 
void clearPlugins ()
 
void callEvent (Event event)
 
void registerEvents (Listener listener, Plugin plugin)
 
void registerEvent (Class<?extends Event > event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin)
 
void registerEvent (Class<?extends Event > event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin, boolean ignoreCancelled)
 
Permission getPermission (String name)
 
void addPermission (Permission perm)
 
Set< PermissiongetDefaultPermissions (boolean op)
 
void removePermission (Permission perm)
 
void removePermission (String name)
 
void recalculatePermissionDefaults (Permission perm)
 
void subscribeToPermission (String permission, Permissible permissible)
 
void unsubscribeFromPermission (String permission, Permissible permissible)
 
Set< PermissiblegetPermissionSubscriptions (String permission)
 
void subscribeToDefaultPerms (boolean op, Permissible permissible)
 
void unsubscribeFromDefaultPerms (boolean op, Permissible permissible)
 
Set< PermissiblegetDefaultPermSubscriptions (boolean op)
 
Set< PermissiongetPermissions ()
 
boolean useTimings ()
 
void useTimings (boolean use)
 
- Public Member Functions inherited from org.bukkit.plugin.PluginManager
void enablePlugin (Plugin plugin)
 
void disablePlugin (Plugin plugin)
 

Detailed Description

Handles all plugin management from the Server

Definition at line 40 of file SimplePluginManager.java.

Member Function Documentation

void org.bukkit.plugin.SimplePluginManager.addPermission ( Permission  perm)

Adds a Permission to this plugin manager.

If a permission is already defined with the given name of the new permission, an exception will be thrown.

Parameters
permPermission to add
Exceptions
IllegalArgumentExceptionThrown when a permission with the same name already exists

Implements org.bukkit.plugin.PluginManager.

Definition at line 594 of file SimplePluginManager.java.

References org.bukkit.permissions.Permission.getName().

594  {
595  String name = perm.getName().toLowerCase();
596 
597  if (permissions.containsKey(name)) {
598  throw new IllegalArgumentException("The permission " + name + " is already defined!");
599  }
600 
601  permissions.put(name, perm);
602  calculatePermissionDefault(perm);
603  }
void org.bukkit.plugin.SimplePluginManager.callEvent ( Event  event)

Calls an event with the given details.

This method only synchronizes when the event is not asynchronous.

Parameters
eventEvent details

Implements org.bukkit.plugin.PluginManager.

Definition at line 475 of file SimplePluginManager.java.

References org.bukkit.event.Event.getEventName(), org.bukkit.event.Event.isAsynchronous(), and org.bukkit.Server.isPrimaryThread().

475  {
476  if (event.isAsynchronous()) {
477  if (Thread.holdsLock(this)) {
478  throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code.");
479  }
480  if (server.isPrimaryThread()) {
481  throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from primary server thread.");
482  }
483  fireEvent(event);
484  } else {
485  synchronized (this) {
486  fireEvent(event);
487  }
488  }
489  }
boolean isPrimaryThread()
void org.bukkit.plugin.SimplePluginManager.clearPlugins ( )

Disables and removes all plugins

Implements org.bukkit.plugin.PluginManager.

Definition at line 455 of file SimplePluginManager.java.

References org.bukkit.plugin.SimplePluginManager.disablePlugins(), and org.bukkit.event.HandlerList.unregisterAll().

455  {
456  synchronized (this) {
457  disablePlugins();
458  plugins.clear();
459  lookupNames.clear();
460  HandlerList.unregisterAll();
461  fileAssociations.clear();
462  permissions.clear();
463  defaultPerms.get(true).clear();
464  defaultPerms.get(false).clear();
465  }
466  }
void org.bukkit.plugin.SimplePluginManager.disablePlugins ( )

Disables all the loaded plugins

Implements org.bukkit.plugin.PluginManager.

Definition at line 413 of file SimplePluginManager.java.

References org.bukkit.plugin.SimplePluginManager.getPlugins().

Referenced by org.bukkit.plugin.SimplePluginManager.clearPlugins().

413  {
414  Plugin[] plugins = getPlugins();
415  for (int i = plugins.length - 1; i >= 0; i--) {
416  disablePlugin(plugins[i]);
417  }
418  }
Set<Permission> org.bukkit.plugin.SimplePluginManager.getDefaultPermissions ( boolean  op)

Gets the default permissions for the given op status

Parameters
opWhich set of default permissions to get
Returns
The default permissions

Implements org.bukkit.plugin.PluginManager.

Definition at line 605 of file SimplePluginManager.java.

605  {
606  return ImmutableSet.copyOf(defaultPerms.get(op));
607  }
Set<Permissible> org.bukkit.plugin.SimplePluginManager.getDefaultPermSubscriptions ( boolean  op)

Gets a set containing all subscribed Permissibles to the given default list, by op status

Parameters
opDefault list to query for
Returns
Set containing all subscribed permissions

Implements org.bukkit.plugin.PluginManager.

Definition at line 704 of file SimplePluginManager.java.

704  {
705  Map<Permissible, Boolean> map = defSubs.get(op);
706 
707  if (map == null) {
708  return ImmutableSet.of();
709  } else {
710  return ImmutableSet.copyOf(map.keySet());
711  }
712  }
Permission org.bukkit.plugin.SimplePluginManager.getPermission ( String  name)

Gets a Permission from its fully qualified name

Parameters
nameName of the permission
Returns
Permission, or null if none

Implements org.bukkit.plugin.PluginManager.

Definition at line 590 of file SimplePluginManager.java.

590  {
591  return permissions.get(name.toLowerCase());
592  }
Set<Permission> org.bukkit.plugin.SimplePluginManager.getPermissions ( )

Gets a set of all registered permissions.

This set is a copy and will not be modified live.

Returns
Set containing all current registered permissions

Implements org.bukkit.plugin.PluginManager.

Definition at line 714 of file SimplePluginManager.java.

714  {
715  return new HashSet<Permission>(permissions.values());
716  }
Set<Permissible> org.bukkit.plugin.SimplePluginManager.getPermissionSubscriptions ( String  permission)

Gets a set containing all subscribed Permissibles to the given permission, by name

Parameters
permissionPermission to query for
Returns
Set containing all subscribed permissions

Implements org.bukkit.plugin.PluginManager.

Definition at line 670 of file SimplePluginManager.java.

670  {
671  String name = permission.toLowerCase();
672  Map<Permissible, Boolean> map = permSubs.get(name);
673 
674  if (map == null) {
675  return ImmutableSet.of();
676  } else {
677  return ImmutableSet.copyOf(map.keySet());
678  }
679  }
synchronized Plugin org.bukkit.plugin.SimplePluginManager.getPlugin ( String  name)

Checks if the given plugin is loaded and returns it when applicable

Please note that the name of the plugin is case-sensitive

Parameters
nameName of the plugin to check
Returns
Plugin if it exists, otherwise null

Implements org.bukkit.plugin.PluginManager.

Definition at line 359 of file SimplePluginManager.java.

Referenced by org.bukkit.plugin.SimplePluginManager.isPluginEnabled().

359  {
360  return lookupNames.get(name.replace(' ', '_'));
361  }
synchronized Plugin [] org.bukkit.plugin.SimplePluginManager.getPlugins ( )

Gets a list of all currently loaded plugins

Returns
Array of Plugins

Implements org.bukkit.plugin.PluginManager.

Definition at line 363 of file SimplePluginManager.java.

Referenced by org.bukkit.plugin.SimplePluginManager.disablePlugins().

363  {
364  return plugins.toArray(new Plugin[0]);
365  }
boolean org.bukkit.plugin.SimplePluginManager.isPluginEnabled ( String  name)

Checks if the given plugin is enabled or not

Please note that the name of the plugin is case-sensitive.

Parameters
nameName of the plugin to check
Returns
true if the plugin is enabled, otherwise false

Implements org.bukkit.plugin.PluginManager.

Definition at line 375 of file SimplePluginManager.java.

References org.bukkit.plugin.SimplePluginManager.getPlugin().

375  {
376  Plugin plugin = getPlugin(name);
377 
378  return isPluginEnabled(plugin);
379  }
synchronized Plugin getPlugin(String name)
boolean org.bukkit.plugin.SimplePluginManager.isPluginEnabled ( Plugin  plugin)

Checks if the given plugin is enabled or not

Parameters
pluginPlugin to check
Returns
true if the plugin is enabled, otherwise false

Implements org.bukkit.plugin.PluginManager.

Definition at line 387 of file SimplePluginManager.java.

References org.bukkit.plugin.Plugin.isEnabled().

387  {
388  if ((plugin != null) && (plugins.contains(plugin))) {
389  return plugin.isEnabled();
390  } else {
391  return false;
392  }
393  }
synchronized Plugin org.bukkit.plugin.SimplePluginManager.loadPlugin ( File  file) throws InvalidPluginException, UnknownDependencyException

Loads the plugin in the specified file

File must be valid according to the current enabled Plugin interfaces

Parameters
fileFile containing the plugin to load
Returns
The Plugin loaded, or null if it was invalid
Exceptions
InvalidPluginExceptionThrown when the specified file is not a valid plugin
UnknownDependencyExceptionIf a required dependency could not be found

Implements org.bukkit.plugin.PluginManager.

Definition at line 313 of file SimplePluginManager.java.

References org.bukkit.plugin.Plugin.getDescription(), org.bukkit.plugin.Plugin.getName(), org.bukkit.plugin.PluginDescriptionFile.getName(), and org.bukkit.plugin.PluginLoader.loadPlugin().

Referenced by org.bukkit.plugin.SimplePluginManager.loadPlugins().

313  {
314  Validate.notNull(file, "File cannot be null");
315 
316  checkUpdate(file);
317 
318  Set<Pattern> filters = fileAssociations.keySet();
319  Plugin result = null;
320 
321  for (Pattern filter : filters) {
322  String name = file.getName();
323  Matcher match = filter.matcher(name);
324 
325  if (match.find()) {
326  PluginLoader loader = fileAssociations.get(filter);
327 
328  result = loader.loadPlugin(file);
329  }
330  }
331 
332  if (result != null) {
333  plugins.add(result);
334  lookupNames.put(result.getDescription().getName(), result);
335  }
336 
337  return result;
338  }
Plugin [] org.bukkit.plugin.SimplePluginManager.loadPlugins ( File  directory)

Loads the plugins contained within the specified directory

Parameters
directoryDirectory to check for plugins
Returns
A list of all plugins loaded

Implements org.bukkit.plugin.PluginManager.

Definition at line 103 of file SimplePluginManager.java.

References org.bukkit.plugin.PluginDescriptionFile.getDepend(), org.bukkit.plugin.PluginDescriptionFile.getFullName(), org.bukkit.plugin.PluginDescriptionFile.getLoadBefore(), org.bukkit.Server.getLogger(), org.bukkit.plugin.PluginDescriptionFile.getName(), org.bukkit.plugin.PluginLoader.getPluginDescription(), org.bukkit.plugin.PluginDescriptionFile.getSoftDepend(), org.bukkit.Server.getUpdateFolder(), and org.bukkit.plugin.SimplePluginManager.loadPlugin().

103  {
104  Validate.notNull(directory, "Directory cannot be null");
105  Validate.isTrue(directory.isDirectory(), "Directory must be a directory");
106 
107  List<Plugin> result = new ArrayList<Plugin>();
108  Set<Pattern> filters = fileAssociations.keySet();
109 
110  if (!(server.getUpdateFolder().equals(""))) {
111  updateDirectory = new File(directory, server.getUpdateFolder());
112  }
113 
114  Map<String, File> plugins = new HashMap<String, File>();
115  Set<String> loadedPlugins = new HashSet<String>();
116  Map<String, Collection<String>> dependencies = new HashMap<String, Collection<String>>();
117  Map<String, Collection<String>> softDependencies = new HashMap<String, Collection<String>>();
118 
119  // This is where it figures out all possible plugins
120  for (File file : directory.listFiles()) {
121  PluginLoader loader = null;
122  for (Pattern filter : filters) {
123  Matcher match = filter.matcher(file.getName());
124  if (match.find()) {
125  loader = fileAssociations.get(filter);
126  }
127  }
128 
129  if (loader == null) continue;
130 
131  PluginDescriptionFile description = null;
132  try {
133  description = loader.getPluginDescription(file);
134  String name = description.getName();
135  if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
136  server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
137  continue;
138  } else if (description.rawName.indexOf(' ') != -1) {
139  server.getLogger().warning(String.format(
140  "Plugin `%s' uses the space-character (0x20) in its name `%s' - this is discouraged",
141  description.getFullName(),
142  description.rawName
143  ));
144  }
145  } catch (InvalidDescriptionException ex) {
146  server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
147  continue;
148  }
149 
150  File replacedFile = plugins.put(description.getName(), file);
151  if (replacedFile != null) {
152  server.getLogger().severe(String.format(
153  "Ambiguous plugin name `%s' for files `%s' and `%s' in `%s'",
154  description.getName(),
155  file.getPath(),
156  replacedFile.getPath(),
157  directory.getPath()
158  ));
159  }
160 
161  Collection<String> softDependencySet = description.getSoftDepend();
162  if (softDependencySet != null && !softDependencySet.isEmpty()) {
163  if (softDependencies.containsKey(description.getName())) {
164  // Duplicates do not matter, they will be removed together if applicable
165  softDependencies.get(description.getName()).addAll(softDependencySet);
166  } else {
167  softDependencies.put(description.getName(), new LinkedList<String>(softDependencySet));
168  }
169  }
170 
171  Collection<String> dependencySet = description.getDepend();
172  if (dependencySet != null && !dependencySet.isEmpty()) {
173  dependencies.put(description.getName(), new LinkedList<String>(dependencySet));
174  }
175 
176  Collection<String> loadBeforeSet = description.getLoadBefore();
177  if (loadBeforeSet != null && !loadBeforeSet.isEmpty()) {
178  for (String loadBeforeTarget : loadBeforeSet) {
179  if (softDependencies.containsKey(loadBeforeTarget)) {
180  softDependencies.get(loadBeforeTarget).add(description.getName());
181  } else {
182  // softDependencies is never iterated, so 'ghost' plugins aren't an issue
183  Collection<String> shortSoftDependency = new LinkedList<String>();
184  shortSoftDependency.add(description.getName());
185  softDependencies.put(loadBeforeTarget, shortSoftDependency);
186  }
187  }
188  }
189  }
190 
191  while (!plugins.isEmpty()) {
192  boolean missingDependency = true;
193  Iterator<String> pluginIterator = plugins.keySet().iterator();
194 
195  while (pluginIterator.hasNext()) {
196  String plugin = pluginIterator.next();
197 
198  if (dependencies.containsKey(plugin)) {
199  Iterator<String> dependencyIterator = dependencies.get(plugin).iterator();
200 
201  while (dependencyIterator.hasNext()) {
202  String dependency = dependencyIterator.next();
203 
204  // Dependency loaded
205  if (loadedPlugins.contains(dependency)) {
206  dependencyIterator.remove();
207 
208  // We have a dependency not found
209  } else if (!plugins.containsKey(dependency)) {
210  missingDependency = false;
211  File file = plugins.get(plugin);
212  pluginIterator.remove();
213  softDependencies.remove(plugin);
214  dependencies.remove(plugin);
215 
216  server.getLogger().log(
217  Level.SEVERE,
218  "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'",
219  new UnknownDependencyException(dependency));
220  break;
221  }
222  }
223 
224  if (dependencies.containsKey(plugin) && dependencies.get(plugin).isEmpty()) {
225  dependencies.remove(plugin);
226  }
227  }
228  if (softDependencies.containsKey(plugin)) {
229  Iterator<String> softDependencyIterator = softDependencies.get(plugin).iterator();
230 
231  while (softDependencyIterator.hasNext()) {
232  String softDependency = softDependencyIterator.next();
233 
234  // Soft depend is no longer around
235  if (!plugins.containsKey(softDependency)) {
236  softDependencyIterator.remove();
237  }
238  }
239 
240  if (softDependencies.get(plugin).isEmpty()) {
241  softDependencies.remove(plugin);
242  }
243  }
244  if (!(dependencies.containsKey(plugin) || softDependencies.containsKey(plugin)) && plugins.containsKey(plugin)) {
245  // We're clear to load, no more soft or hard dependencies left
246  File file = plugins.get(plugin);
247  pluginIterator.remove();
248  missingDependency = false;
249 
250  try {
251  result.add(loadPlugin(file));
252  loadedPlugins.add(plugin);
253  continue;
254  } catch (InvalidPluginException ex) {
255  server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
256  }
257  }
258  }
259 
260  if (missingDependency) {
261  // We now iterate over plugins until something loads
262  // This loop will ignore soft dependencies
263  pluginIterator = plugins.keySet().iterator();
264 
265  while (pluginIterator.hasNext()) {
266  String plugin = pluginIterator.next();
267 
268  if (!dependencies.containsKey(plugin)) {
269  softDependencies.remove(plugin);
270  missingDependency = false;
271  File file = plugins.get(plugin);
272  pluginIterator.remove();
273 
274  try {
275  result.add(loadPlugin(file));
276  loadedPlugins.add(plugin);
277  break;
278  } catch (InvalidPluginException ex) {
279  server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
280  }
281  }
282  }
283  // We have no plugins left without a depend
284  if (missingDependency) {
285  softDependencies.clear();
286  dependencies.clear();
287  Iterator<File> failedPluginIterator = plugins.values().iterator();
288 
289  while (failedPluginIterator.hasNext()) {
290  File file = failedPluginIterator.next();
291  failedPluginIterator.remove();
292  server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': circular dependency detected");
293  }
294  }
295  }
296  }
297 
298  return result.toArray(new Plugin[result.size()]);
299  }
synchronized Plugin loadPlugin(File file)
String getUpdateFolder()
Logger getLogger()
void org.bukkit.plugin.SimplePluginManager.recalculatePermissionDefaults ( Permission  perm)

Recalculates the defaults for the given Permission.

This will have no effect if the specified permission is not registered here.

Parameters
permPermission to recalculate

Implements org.bukkit.plugin.PluginManager.

Definition at line 617 of file SimplePluginManager.java.

617  {
618  if (permissions.containsValue(perm)) {
619  defaultPerms.get(true).remove(perm);
620  defaultPerms.get(false).remove(perm);
621 
622  calculatePermissionDefault(perm);
623  }
624  }
void org.bukkit.plugin.SimplePluginManager.registerEvent ( Class<?extends Event event,
Listener  listener,
EventPriority  priority,
EventExecutor  executor,
Plugin  plugin 
)

Registers the specified executor to the given event class

Parameters
eventEvent type to register
listenerListener to register
priorityPriority to register this event at
executorEventExecutor to register
pluginPlugin to register

Implements org.bukkit.plugin.PluginManager.

Definition at line 532 of file SimplePluginManager.java.

532  {
533  registerEvent(event, listener, priority, executor, plugin, false);
534  }
void registerEvent(Class<?extends Event > event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin)
void org.bukkit.plugin.SimplePluginManager.registerEvent ( Class<?extends Event event,
Listener  listener,
EventPriority  priority,
EventExecutor  executor,
Plugin  plugin,
boolean  ignoreCancelled 
)

Registers the given event to the specified listener using a directly passed EventExecutor

Parameters
eventEvent class to register
listenerPlayerListener to register
priorityPriority of this event
executorEventExecutor to register
pluginPlugin to register
ignoreCancelledDo not call executor if event was already cancelled

Implements org.bukkit.plugin.PluginManager.

Definition at line 548 of file SimplePluginManager.java.

References org.bukkit.plugin.Plugin.isEnabled(), and org.bukkit.event.HandlerList.register().

548  {
549  Validate.notNull(listener, "Listener cannot be null");
550  Validate.notNull(priority, "Priority cannot be null");
551  Validate.notNull(executor, "Executor cannot be null");
552  Validate.notNull(plugin, "Plugin cannot be null");
553 
554  if (!plugin.isEnabled()) {
555  throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
556  }
557 
558  if (useTimings) {
559  getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
560  } else {
561  getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
562  }
563  }
synchronized void register(RegisteredListener listener)
void org.bukkit.plugin.SimplePluginManager.registerEvents ( Listener  listener,
Plugin  plugin 
)

Registers all the events in the given listener class

Parameters
listenerListener to register
pluginPlugin to register

Implements org.bukkit.plugin.PluginManager.

Definition at line 521 of file SimplePluginManager.java.

References org.bukkit.plugin.PluginLoader.createRegisteredListeners(), org.bukkit.plugin.Plugin.getPluginLoader(), org.bukkit.plugin.Plugin.isEnabled(), and org.bukkit.event.HandlerList.registerAll().

521  {
522  if (!plugin.isEnabled()) {
523  throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled");
524  }
525 
526  for (Map.Entry<Class<? extends Event>, Set<RegisteredListener>> entry : plugin.getPluginLoader().createRegisteredListeners(listener, plugin).entrySet()) {
527  getEventListeners(getRegistrationClass(entry.getKey())).registerAll(entry.getValue());
528  }
529 
530  }
void registerAll(Collection< RegisteredListener > listeners)
void org.bukkit.plugin.SimplePluginManager.registerInterface ( Class<?extends PluginLoader loader) throws IllegalArgumentException

Registers the specified plugin loader

Parameters
loaderClass name of the PluginLoader to register
Exceptions
IllegalArgumentExceptionThrown when the given Class is not a valid PluginLoader

Implements org.bukkit.plugin.PluginManager.

Definition at line 68 of file SimplePluginManager.java.

References org.bukkit.plugin.PluginLoader.getPluginFileFilters().

68  {
69  PluginLoader instance;
70 
71  if (PluginLoader.class.isAssignableFrom(loader)) {
72  Constructor<? extends PluginLoader> constructor;
73 
74  try {
75  constructor = loader.getConstructor(Server.class);
76  instance = constructor.newInstance(server);
77  } catch (NoSuchMethodException ex) {
78  String className = loader.getName();
79 
80  throw new IllegalArgumentException(String.format("Class %s does not have a public %s(Server) constructor", className, className), ex);
81  } catch (Exception ex) {
82  throw new IllegalArgumentException(String.format("Unexpected exception %s while attempting to construct a new instance of %s", ex.getClass().getName(), loader.getName()), ex);
83  }
84  } else {
85  throw new IllegalArgumentException(String.format("Class %s does not implement interface PluginLoader", loader.getName()));
86  }
87 
88  Pattern[] patterns = instance.getPluginFileFilters();
89 
90  synchronized (this) {
91  for (Pattern pattern : patterns) {
92  fileAssociations.put(pattern, instance);
93  }
94  }
95  }
void org.bukkit.plugin.SimplePluginManager.removePermission ( Permission  perm)

Removes a Permission registration from this plugin manager.

If the specified permission does not exist in this plugin manager, nothing will happen.

Removing a permission registration will not remove the permission from any Permissibles that have it.

Parameters
permPermission to remove

Implements org.bukkit.plugin.PluginManager.

Definition at line 609 of file SimplePluginManager.java.

References org.bukkit.permissions.Permission.getName().

609  {
610  removePermission(perm.getName());
611  }
void org.bukkit.plugin.SimplePluginManager.removePermission ( String  name)

Removes a Permission registration from this plugin manager.

If the specified permission does not exist in this plugin manager, nothing will happen.

Removing a permission registration will not remove the permission from any Permissibles that have it.

Parameters
namePermission to remove

Implements org.bukkit.plugin.PluginManager.

Definition at line 613 of file SimplePluginManager.java.

613  {
614  permissions.remove(name.toLowerCase());
615  }
void org.bukkit.plugin.SimplePluginManager.subscribeToDefaultPerms ( boolean  op,
Permissible  permissible 
)

Subscribes to the given Default permissions by operator status

If the specified defaults change in any form, the Permissible will be asked to recalculate.

Parameters
opDefault list to subscribe to
permissiblePermissible subscribing

Implements org.bukkit.plugin.PluginManager.

Definition at line 681 of file SimplePluginManager.java.

681  {
682  Map<Permissible, Boolean> map = defSubs.get(op);
683 
684  if (map == null) {
685  map = new WeakHashMap<Permissible, Boolean>();
686  defSubs.put(op, map);
687  }
688 
689  map.put(permissible, true);
690  }
void org.bukkit.plugin.SimplePluginManager.subscribeToPermission ( String  permission,
Permissible  permissible 
)

Subscribes the given Permissible for information about the requested Permission, by name.

If the specified Permission changes in any form, the Permissible will be asked to recalculate.

Parameters
permissionPermission to subscribe to
permissiblePermissible subscribing

Implements org.bukkit.plugin.PluginManager.

Definition at line 645 of file SimplePluginManager.java.

645  {
646  String name = permission.toLowerCase();
647  Map<Permissible, Boolean> map = permSubs.get(name);
648 
649  if (map == null) {
650  map = new WeakHashMap<Permissible, Boolean>();
651  permSubs.put(name, map);
652  }
653 
654  map.put(permissible, true);
655  }
void org.bukkit.plugin.SimplePluginManager.unsubscribeFromDefaultPerms ( boolean  op,
Permissible  permissible 
)

Unsubscribes from the given Default permissions by operator status

Parameters
opDefault list to unsubscribe from
permissiblePermissible subscribing

Implements org.bukkit.plugin.PluginManager.

Definition at line 692 of file SimplePluginManager.java.

692  {
693  Map<Permissible, Boolean> map = defSubs.get(op);
694 
695  if (map != null) {
696  map.remove(permissible);
697 
698  if (map.isEmpty()) {
699  defSubs.remove(op);
700  }
701  }
702  }
void org.bukkit.plugin.SimplePluginManager.unsubscribeFromPermission ( String  permission,
Permissible  permissible 
)

Unsubscribes the given Permissible for information about the requested Permission, by name.

Parameters
permissionPermission to unsubscribe from
permissiblePermissible subscribing

Implements org.bukkit.plugin.PluginManager.

Definition at line 657 of file SimplePluginManager.java.

657  {
658  String name = permission.toLowerCase();
659  Map<Permissible, Boolean> map = permSubs.get(name);
660 
661  if (map != null) {
662  map.remove(permissible);
663 
664  if (map.isEmpty()) {
665  permSubs.remove(name);
666  }
667  }
668  }
boolean org.bukkit.plugin.SimplePluginManager.useTimings ( )

Returns whether or not timing code should be used for event calls

Returns
True if event timings are to be used

Implements org.bukkit.plugin.PluginManager.

Definition at line 718 of file SimplePluginManager.java.

718  {
719  return useTimings;
720  }
void org.bukkit.plugin.SimplePluginManager.useTimings ( boolean  use)

Sets whether or not per event timing code should be used

Parameters
useTrue if per event timing code should be used

Definition at line 727 of file SimplePluginManager.java.

727  {
728  useTimings = use;
729  }

The documentation for this class was generated from the following file: