mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 09:16:06 +01:00
Don't send events to disabled plugins.
By: Feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
4e9fcec4a4
commit
44c58c4952
1 changed files with 23 additions and 23 deletions
|
@ -331,35 +331,35 @@ public final class SimplePluginManager implements PluginManager {
|
|||
* @param event Event details
|
||||
*/
|
||||
public synchronized void callEvent(Event event) {
|
||||
SortedSet<RegisteredListener> eventListeners = listeners.get(event.getType());
|
||||
for (RegisteredListener registration : getEventListeners(event.getType())) {
|
||||
if(!registration.getPlugin().isEnabled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eventListeners != null) {
|
||||
for (RegisteredListener registration : eventListeners) {
|
||||
try {
|
||||
long start = System.nanoTime();
|
||||
registration.callEvent(event);
|
||||
registration.getPlugin().incTiming(event.getType(), System.nanoTime() - start);
|
||||
} catch (AuthorNagException ex) {
|
||||
Plugin plugin = registration.getPlugin();
|
||||
try {
|
||||
long start = System.nanoTime();
|
||||
registration.callEvent(event);
|
||||
registration.getPlugin().incTiming(event.getType(), System.nanoTime() - start);
|
||||
} catch (AuthorNagException ex) {
|
||||
Plugin plugin = registration.getPlugin();
|
||||
|
||||
if (plugin.isNaggable()) {
|
||||
plugin.setNaggable(false);
|
||||
if (plugin.isNaggable()) {
|
||||
plugin.setNaggable(false);
|
||||
|
||||
String author = "<NoAuthorGiven>";
|
||||
String author = "<NoAuthorGiven>";
|
||||
|
||||
if (plugin.getDescription().getAuthors().size() > 0) {
|
||||
author = plugin.getDescription().getAuthors().get(0);
|
||||
}
|
||||
server.getLogger().log(Level.SEVERE, String.format(
|
||||
"Nag author: '%s' of '%s' about the following: %s",
|
||||
author,
|
||||
plugin.getDescription().getName(),
|
||||
ex.getMessage()
|
||||
));
|
||||
if (plugin.getDescription().getAuthors().size() > 0) {
|
||||
author = plugin.getDescription().getAuthors().get(0);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getType() + " to " + registration.getPlugin().getDescription().getName(), ex);
|
||||
server.getLogger().log(Level.SEVERE, String.format(
|
||||
"Nag author: '%s' of '%s' about the following: %s",
|
||||
author,
|
||||
plugin.getDescription().getName(),
|
||||
ex.getMessage()
|
||||
));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getType() + " to " + registration.getPlugin().getDescription().getName(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue