geforkt von Mirrors/Paper
Don't send events to disabled plugins.
By: Feildmaster <admin@feildmaster.com>
Dieser Commit ist enthalten in:
Ursprung
4e9fcec4a4
Commit
44c58c4952
@ -331,35 +331,35 @@ public final class SimplePluginManager implements PluginManager {
|
|||||||
* @param event Event details
|
* @param event Event details
|
||||||
*/
|
*/
|
||||||
public synchronized void callEvent(Event event) {
|
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) {
|
try {
|
||||||
for (RegisteredListener registration : eventListeners) {
|
long start = System.nanoTime();
|
||||||
try {
|
registration.callEvent(event);
|
||||||
long start = System.nanoTime();
|
registration.getPlugin().incTiming(event.getType(), System.nanoTime() - start);
|
||||||
registration.callEvent(event);
|
} catch (AuthorNagException ex) {
|
||||||
registration.getPlugin().incTiming(event.getType(), System.nanoTime() - start);
|
Plugin plugin = registration.getPlugin();
|
||||||
} catch (AuthorNagException ex) {
|
|
||||||
Plugin plugin = registration.getPlugin();
|
|
||||||
|
|
||||||
if (plugin.isNaggable()) {
|
if (plugin.isNaggable()) {
|
||||||
plugin.setNaggable(false);
|
plugin.setNaggable(false);
|
||||||
|
|
||||||
String author = "<NoAuthorGiven>";
|
String author = "<NoAuthorGiven>";
|
||||||
|
|
||||||
if (plugin.getDescription().getAuthors().size() > 0) {
|
if (plugin.getDescription().getAuthors().size() > 0) {
|
||||||
author = plugin.getDescription().getAuthors().get(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()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
server.getLogger().log(Level.SEVERE, String.format(
|
||||||
server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getType() + " to " + registration.getPlugin().getDescription().getName(), ex);
|
"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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren