Inline EventHelper#logCall
All checks were successful
build-and-test / test (push) Successful in 2m41s
build-and-test / build (push) Successful in 3m11s
build-and-test / generate-javadoc (push) Successful in 3m12s

This commit is contained in:
JeremyStar™ 2024-09-20 17:10:50 +02:00
parent 54b7b9a695
commit c473c27298
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 6 additions and 21 deletions

View file

@ -19,9 +19,8 @@
package de.staropensource.sosengine.base;
import de.staropensource.sosengine.base.implementable.ShortcodeParser;
import de.staropensource.sosengine.base.implementable.Configuration;
import de.staropensource.sosengine.base.implementable.helper.EventHelper;
import de.staropensource.sosengine.base.implementable.ShortcodeParser;
import de.staropensource.sosengine.base.logging.CrashHandler;
import de.staropensource.sosengine.base.logging.Logger;
import de.staropensource.sosengine.base.logging.LoggingThread;
@ -95,7 +94,6 @@ public final class EngineConfiguration extends Configuration {
/**
* If enabled, all called events will be logged.
*
* @see EventHelper#logCall(Class, Object...)
* @since v1-alpha0
* -- GETTER --
* Gets the value for {@link #debugEvents}.

View file

@ -76,22 +76,6 @@ public final class EventHelper {
*/
public EventHelper() {}
/**
* Logs an event call.
*
* @param event event class
* @param arguments arguments passed to event listeners
* @since v1-alpha0
*/
public static void logCall(@NotNull Class<? extends Event> event, @NotNull Object ... arguments) {
// Print event call if event debugging is enabled
if (EngineConfiguration.getInstance().isDebugEvents())
if (arguments.length == 0)
logger.diag("Event " + event.getName() + " was emitted");
else
logger.diag("Event " + event.getName() + " was emitted, passing arguments " + ListFormatter.formatArray(arguments));
}
/**
* Returns all {@link EventListener}s listening on some event.
* The classpath will be scanned for listeners, unless cached results exist and {@code !forceScanning}.
@ -149,8 +133,11 @@ public final class EventHelper {
* @since v1-alpha0
*/
public static void invokeAnnotatedMethods(@NotNull Class<? extends Event> event, Object... arguments) {
if (event != LogEvent.class)
logCall(event);
if (event != LogEvent.class && EngineConfiguration.getInstance().isDebugEvents())
if (arguments.length == 0)
logger.diag("Event " + event.getName() + " was emitted");
else
logger.diag("Event " + event.getName() + " was emitted, passing arguments " + ListFormatter.formatArray(arguments));
Runnable eventCode = () -> {
for (ReflectionMethod method : getAnnotatedMethods(event)) {