Skip to content

Commit 68f8750

Browse files
authored
Merge pull request #152 from zBinFinn/fix/auth-request-error
fix: auth request error
2 parents be93aa4 + dca4dab commit 68f8750

1 file changed

Lines changed: 28 additions & 26 deletions

File tree

‎src/main/java/dev/dfonline/codeclient/websocket/SocketHandler.java‎

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -209,34 +209,36 @@ private void promptUserAcceptScopes() {
209209
if (unapprovedAuthScopes.isEmpty()) return;
210210
if (CodeClient.MC.player == null) return;
211211

212-
ClientPlayerEntity player = CodeClient.MC.player;
212+
CodeClient.MC.executeSync(() -> {
213+
ClientPlayerEntity player = CodeClient.MC.player;
213214

214-
// Send the user the scopes to approve
215-
Utility.sendMessage(Text.translatable("codeclient.api.scope.prompt"));
216-
for (AuthScope scope : unapprovedAuthScopes) {
217-
player.sendMessage(
215+
// Send the user the scopes to approve
216+
Utility.sendMessage(Text.translatable("codeclient.api.scope.prompt"));
217+
for (AuthScope scope : unapprovedAuthScopes) {
218+
Utility.sendMessage(
218219
Text.empty()
219-
.append(
220-
Text.literal("- ")
221-
.formatted(Formatting.DARK_GRAY)
222-
)
223-
.append(
224-
Text.translatable("codeclient.api.scope.type." + scope.translationKey)
225-
.formatted(Formatting.WHITE)
226-
.append(" ")
227-
.append(
228-
Text.literal("(")
229-
.append(Text.translatable("codeclient.api.danger." + scope.dangerLevel.translationKey))
230-
.append(Text.literal(")"))
231-
.formatted(scope.dangerLevel.color, Formatting.ITALIC)
232-
)
233-
)
234-
.setStyle(Style.EMPTY.withHoverEvent(
235-
new HoverEvent.ShowText(Text.translatable("codeclient.api.danger." + scope.dangerLevel.translationKey + ".description"))
236-
)), false
237-
);
238-
}
239-
Utility.sendMessage(Text.translatable("codeclient.api.run_auth"));
220+
.append(
221+
Text.literal("- ")
222+
.formatted(Formatting.DARK_GRAY)
223+
)
224+
.append(
225+
Text.translatable("codeclient.api.scope.type." + scope.translationKey)
226+
.formatted(Formatting.WHITE)
227+
.append(" ")
228+
.append(
229+
Text.literal("(")
230+
.append(Text.translatable("codeclient.api.danger." + scope.dangerLevel.translationKey))
231+
.append(Text.literal(")"))
232+
.formatted(scope.dangerLevel.color, Formatting.ITALIC)
233+
)
234+
)
235+
.setStyle(Style.EMPTY.withHoverEvent(
236+
new HoverEvent.ShowText(Text.translatable("codeclient.api.danger." + scope.dangerLevel.translationKey + ".description"))
237+
))
238+
);
239+
}
240+
Utility.sendMessage(Text.translatable("codeclient.api.run_auth"));
241+
});
240242
}
241243

242244
private void next() {

0 commit comments

Comments
 (0)