use of org.powerbot.bot.rt6.client.NodeSub in project powerbot by powerbot.
the class Chat method register.
public void register() {
if (!registered.compareAndSet(false, true)) {
return;
}
final EventDispatcher e = ((AbstractBot) ctx.bot()).dispatcher;
e.add(new PaintListener() {
private final AtomicReference<NodeSub> previous = new AtomicReference<NodeSub>(null);
@Override
public void repaint(final Graphics graphics) {
final Client client = ctx.client();
if (client == null) {
return;
}
final NodeSubQueue q = client.getLoggerEntries();
final NodeSub s = q.getSentinel();
NodeSub c = s.getNextSub();
if (previous.get() != null && !previous.get().isNull()) {
final NodeSub n = previous.get().getNextSub();
c = n.isNull() ? c : n;
}
while (!s.equals(c)) {
final MessageEntry m = new MessageEntry(c.reflector, c);
e.dispatch(new MessageEvent(m));
previous.set(c);
c = c.getNextSub();
}
}
});
}
Aggregations