Fix Javadoc & Update version

This commit is contained in:
KingRainbow44 2022-04-26 14:08:48 -04:00
parent 727fa8a67d
commit 26db170a1e
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
2 changed files with 7 additions and 7 deletions

View File

@ -18,7 +18,7 @@ plugins {
}
group = 'tech.xigam'
version = '1.0.0-dev'
version = '1.0.1-dev'
sourceCompatibility = 17
targetCompatibility = 17

View File

@ -17,11 +17,11 @@ import java.util.jar.JarFile;
import java.util.stream.Stream;
/**
* Manages the server's plugins & the event system.
* Manages the server's plugins and the event system.
*/
public final class PluginManager {
private final Map<String, Plugin> plugins = new HashMap<>();
private final List<EventHandler<?>> listeners = new LinkedList<>();
private final List<EventHandler> listeners = new LinkedList<>();
public PluginManager() {
this.loadPlugins(); // Load all plugins from the plugins directory.
@ -131,7 +131,7 @@ public final class PluginManager {
* Registers a plugin's event listener.
* @param listener The event listener.
*/
public void registerListener(EventHandler<?> listener) {
public void registerListener(EventHandler listener) {
this.listeners.add(listener);
}
@ -140,8 +140,8 @@ public final class PluginManager {
* @param event The event to invoke.
*/
public void invokeEvent(Event event) {
Stream<EventHandler<?>> handlers = this.listeners.stream()
.filter(handler -> event.getClass().isInstance(event));
Stream<EventHandler> handlers = this.listeners.stream()
.filter(handler -> handler.handles().isInstance(event));
handlers.filter(handler -> handler.getPriority() == HandlerPriority.HIGH)
.toList().forEach(handler -> this.invokeHandler(event, handler));
handlers.filter(handler -> handler.getPriority() == HandlerPriority.NORMAL)
@ -155,7 +155,7 @@ public final class PluginManager {
* @param event The event passed through to the handler.
* @param handler The handler to invoke.
*/
private void invokeHandler(Event event, EventHandler<?> handler) {
private void invokeHandler(Event event, EventHandler handler) {
if(!event.isCanceled() ||
(event.isCanceled() && handler.ignoresCanceled())
) handler.getCallback().accept(event);