Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved ChatboxListener problem

Joined
Jul 15, 2016
Messages
152
1.Runemate version 2.57.0
2.Affected games OSRS (i don't play Rs3 so idk rs3 maybe too)
3.Code used:
Code:
@Override
public void onMessageReceived(MessageEvent messageEvent) {
    try {
        System.out.println("Executing onMessageReceived");
        if (messageEvent != null) {
            message = messageEvent.getMessage();
            if (message != null) {
                this.lastMessage = message;
                newMessage = true;
            }
        }
    } catch (Exception e){
        System.out.println("NULL POINTER EXCEPTION");
    }
}

Stack trace:
Code:
java.lang.NullPointerException
 at nul.iiiiiIiiiIIii.class(kfc:174)
 at com.runemate.game.api.hybrid.local.hud.interfaces.Chatbox$Message.hashCode(kyb:8812)
 at java.util.HashMap.hash(HashMap.java:338)
 at java.util.HashMap.put(HashMap.java:611)
 at java.util.HashSet.add(HashSet.java:219)
 at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
 at java.util.LinkedHashSet.<init>(LinkedHashSet.java:169)
 at nul.IIIIIiiIiiiIi.class(job:137)
 at nul.iiIIIiiIIIiIi.run(ypb:82)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
 at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)
I've added try\catch to make sure it is not my code throwing exception.
Also i've tryed adding\removing listener to
getEventDispatcher(). but if exception was thrown - it won't help. As well as creating new listener this way
Code:
public void removeAndAddListener() {
    System.out.println("Before removing " + getEventDispatcher().getListeners());
    if (listener == null) {
        getEventDispatcher().removeListener(this);
    } else {
        getEventDispatcher().removeListener(listener);
    }
    listener = null;
    listener = new ChatboxListener() {
        @Override
        public void onMessageReceived(MessageEvent messageEvent) {
            ((MagicArena)Environment.getBot()).onMessageReceived(messageEvent);
        }
    };
    System.out.println("After removing " + getEventDispatcher().getListeners());
    getEventDispatcher().addListener(listener);
    System.out.println("After adding " + getEventDispatcher().getListeners());
}

This bug is very hard to catch cos it happens not often, and bot continue working after throwing this exception until it need to do something after chat message appears. Chatlistener is not working anymore so bot is not working too as expected, but its continue to loop and perform some stupid actions, not as it is supposed to.
This might be a cause of tons of bans.
@Cloud @Party @SlashnHax
 
Top