http-api: Use observeOn to run code on the ClientThread
This commit is contained in:
@@ -828,9 +828,9 @@ public class ChatCommandsPlugin extends Plugin
|
||||
ItemPrice item = retrieveFromList(results, search);
|
||||
CLIENT.lookupItem(item.getId())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.from(clientThread))
|
||||
.subscribe(
|
||||
(osbresult) ->
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
int itemId = item.getId();
|
||||
int itemPrice = itemManager.getItemPrice(itemId);
|
||||
@@ -865,7 +865,7 @@ public class ChatCommandsPlugin extends Plugin
|
||||
messageNode.setRuneLiteFormatMessage(response);
|
||||
chatMessageManager.update(messageNode);
|
||||
client.refreshChat();
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,9 +371,9 @@ public class ExaminePlugin extends Plugin
|
||||
int finalQuantity = quantity;
|
||||
CLIENT.lookupItem(id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.from(clientThread))
|
||||
.subscribe(
|
||||
(osbresult) ->
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
message
|
||||
.append(ChatColorType.NORMAL)
|
||||
@@ -400,7 +400,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("ea)");
|
||||
}
|
||||
}),
|
||||
},
|
||||
(e) -> log.error(e.toString())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -552,13 +552,13 @@ public class GrandExchangePlugin extends Plugin
|
||||
|
||||
CLIENT.lookupItem(itemId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.from(clientThread))
|
||||
.subscribe(
|
||||
(osbresult) ->
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
final String text = geText.getText() + OSB_GE_TEXT + StackFormatter.formatNumber(osbresult.getOverall_average());
|
||||
geText.setText(text);
|
||||
}),
|
||||
},
|
||||
(e) -> log.debug("Error getting price of item {}", itemId, e)
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user