Make some more changes

This commit is contained in:
Zontreck 2023-10-12 14:54:16 -07:00
parent e61335609f
commit 4d005e1704
4 changed files with 17 additions and 4 deletions

3
.gitignore vendored
View file

@ -26,4 +26,5 @@ replay_pid*
.gradle .gradle
build build
bin

View file

@ -0,0 +1,6 @@
package dev.zontreck.eventsbus;
public class Bus
{
}

View file

@ -1,5 +1,6 @@
package dev.zontreck.eventsbus; package dev.zontreck.eventsbus;
@Priority(Level = PriorityLevel.LOWEST)
public class Event { public class Event {
private boolean cancelled = false; private boolean cancelled = false;
@ -17,8 +18,8 @@ public class Event {
/** /**
* Checks if the event is cancelled. * Checks if the event is cancelled.
* *
* @return False if the event cannot be cancelled, or returns the current status * @return False if the event cannot be cancelled; or
* for the event. * The current cancellation status for the event
*/ */
public boolean isCancelled() { public boolean isCancelled() {
if (!IsCancellable()) if (!IsCancellable())
@ -34,4 +35,9 @@ public class Event {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
cancelled = cancel; cancelled = cancel;
} }
public PriorityLevel getPriorityLevel() {
Class<?> Current = this.getClass();
return Current.getAnnotation(Priority.class).Level();
}
} }

View file

@ -5,5 +5,5 @@ import java.lang.annotation.RetentionPolicy;
@Retention(value = RetentionPolicy.RUNTIME) @Retention(value = RetentionPolicy.RUNTIME)
public @interface Priority { public @interface Priority {
public PriorityLevel Level = PriorityLevel.LOW; PriorityLevel Level();
} }