Patch the EventsBus as it was non-functional
This commit is contained in:
parent
80148106a2
commit
fc125dfd32
1 changed files with 12 additions and 8 deletions
|
@ -60,13 +60,15 @@ public class Bus {
|
||||||
container.Level = m.getAnnotation(Priority.class).Level();
|
container.Level = m.getAnnotation(Priority.class).Level();
|
||||||
else container.Level = PriorityLevel.LOWEST;
|
else container.Level = PriorityLevel.LOWEST;
|
||||||
|
|
||||||
|
Class<?> clz = m.getParameters()[0].getType();
|
||||||
|
|
||||||
container.IsSingleshot = m.isAnnotationPresent(SingleshotEvent.class);
|
container.IsSingleshot = m.isAnnotationPresent(SingleshotEvent.class);
|
||||||
|
|
||||||
if (Main.instanced_events.containsKey(clazz))
|
if (Main.instanced_events.containsKey(clz))
|
||||||
Main.instanced_events.get(clazz).add(container);
|
Main.instanced_events.get(clz).add(container);
|
||||||
else {
|
else {
|
||||||
Main.instanced_events.put(clazz, new ArrayList<>());
|
Main.instanced_events.put(clz, new ArrayList<>());
|
||||||
Main.instanced_events.get(clazz).add(container);
|
Main.instanced_events.get(clz).add(container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,18 +76,20 @@ public class Bus {
|
||||||
for (Method m : staticMethods) {
|
for (Method m : staticMethods) {
|
||||||
EventContainer container = new EventContainer();
|
EventContainer container = new EventContainer();
|
||||||
container.instance = null;
|
container.instance = null;
|
||||||
|
container.method = m;
|
||||||
container.clazz = clazz;
|
container.clazz = clazz;
|
||||||
if (m.isAnnotationPresent((Priority.class)))
|
if (m.isAnnotationPresent((Priority.class)))
|
||||||
container.Level = m.getAnnotation(Priority.class).Level();
|
container.Level = m.getAnnotation(Priority.class).Level();
|
||||||
else container.Level = PriorityLevel.LOWEST;
|
else container.Level = PriorityLevel.LOWEST;
|
||||||
|
|
||||||
|
Class<?> clz = m.getParameters()[0].getType();
|
||||||
container.IsSingleshot = m.isAnnotationPresent(SingleshotEvent.class);
|
container.IsSingleshot = m.isAnnotationPresent(SingleshotEvent.class);
|
||||||
|
|
||||||
if (Main.static_events.containsKey(clazz))
|
if (Main.static_events.containsKey(clz))
|
||||||
Main.static_events.get(clazz).add(container);
|
Main.static_events.get(clz).add(container);
|
||||||
else {
|
else {
|
||||||
Main.static_events.put(clazz, new ArrayList<>());
|
Main.static_events.put(clz, new ArrayList<>());
|
||||||
Main.static_events.get(clazz).add(container);
|
Main.static_events.get(clz).add(container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue