bedrock fix

This commit is contained in:
jannis committed 2026-11-06 16:30:30 +01:00
1 parent 8d3c750ea1
commit acb7b17eb0
3 files changed
+19 -8

No files matched your search

@@ -77,7 +77,8 @@ public final class Api {
JsonElement error = json.get("error");
if (error != null && error.isJsonPrimitive()) message = error.getAsString();
} catch (RuntimeException ignored) {}
throw new SignupError(code, "Signup fehlgeschlagen (" + status + "/" + code + "): " + message);
throw new SignupError(code, "Signup fehlgeschlagen (" + status + "/" + code + "): " + message
+ " [username=" + username + ", uuid=" + uuid + ", edition=" + edition + "]");
}
private static HttpResponse<String> call(String method, String path, String body, boolean withAuth) {
@@ -94,7 +94,7 @@ public final class Dialog {
null,
false,
false,
DialogAfterAction.NONE,
DialogAfterAction.CLOSE,
List.of(plain(Component.text(message), rulesWidth)),
List.of()
),
@@ -105,14 +105,14 @@ public final class Dialog {
public static boolean handleClick(Player player, DialogState state, Key key, CompoundBinaryTag payload) {
state.pendingError = null;
saveCurrentPage(state, payload);
if (key.equals(backKey)) {
state.previousPage();
showPage(player, state, null);
return false;
}
saveCurrentPage(state, payload);
Component error = validateCurrentPage(player, state);
if (error != null) {
showPage(player, state, error);
@@ -186,10 +186,12 @@ public final class Dialog {
String fullTitle = "Schritt " + state.pageNumber() + "/" + state.pageCount() + " – " + title;
boolean bedrock = PlayerHandler.isBedrockUuid(player.getUuid());
List<DialogActionButton> buttons = new ArrayList<>();
if (!state.isFirstPage()) buttons.add(button("← Zurück", backKey));
if (state.isLastPage()) buttons.add(button("Anmeldung abschließen", finishKey));
else buttons.add(button("Weiter →", nextKey, state.isFirstPage() ? cancelWidth : buttonWidth));
if (!state.isFirstPage()) buttons.add(bedrock ? 1 : 0, button("← Zurück", backKey));
buttons.add(button("Anmeldung abbrechen", cancelKey, cancelWidth));
player.showDialog(new net.minestom.server.dialog.Dialog.MultiAction(
@@ -198,7 +200,7 @@ public final class Dialog {
null,
false,
false,
state.isLastPage() ? DialogAfterAction.CLOSE : DialogAfterAction.NONE,
bedrock || state.isLastPage() ? DialogAfterAction.CLOSE : DialogAfterAction.NONE,
body,
inputs
),
@@ -298,5 +300,4 @@ public final class Dialog {
private static Component error(String text) {
return Component.text(text, NamedTextColor.RED);
}
}
@@ -113,12 +113,14 @@ public final class PlayerHandler {
private static void cancel(Player player) {
states.remove(player.getUuid());
lastLook.remove(player.getUuid());
player.closeDialog();
player.kick("Anmeldung abgebrochen. Du kannst dich jederzeit erneut anmelden.");
}
private static void disconnect(Player player) {
states.remove(player.getUuid());
lastLook.remove(player.getUuid());
player.closeDialog();
player.kick("Wir freuen uns auf dich!");
}
@@ -144,7 +146,7 @@ public final class PlayerHandler {
state.secondName,
birthdayIso,
state.phoneNumber,
player.getUsername(),
signupUsername(player),
player.getUuid(),
isBedrockUuid(player.getUuid()) ? "bedrock" : "java"
);
@@ -190,6 +192,13 @@ public final class PlayerHandler {
states.put(player.getUuid(), done);
showDialog(player, done);
}
private static String signupUsername(Player player) {
String username = player.getUsername();
if (isBedrockUuid(player.getUuid()) && username.startsWith(".")) return username.substring(1);
return username;
}
public static boolean isBedrockUuid(UUID uuid) {
return uuid.getMostSignificantBits() == 0;
}