Ignore registration of a object that is already registered. Preventing duplicate callback invocations. Thanks King_Lemming for pointing this out.
This commit is contained in:
parent
0e571eeb19
commit
cea0edfdb1
1 changed files with 5 additions and 0 deletions
|
@ -24,6 +24,11 @@ public class EventBus
|
|||
|
||||
public void register(Object target)
|
||||
{
|
||||
if (listeners.containsKey(target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Set<? extends Class<?>> supers = TypeToken.of(target.getClass()).getTypes().rawTypes();
|
||||
for (Method method : target.getClass().getMethods())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue