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