mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-10 19:58:03 +01:00
cleaned up Code
This commit is contained in:
parent
9a9c079d13
commit
ff065e0a87
@ -19,8 +19,8 @@ package de.florianmichael.viafabricplus.definition.bedrock;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.util.FileSaver;
|
||||
import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import net.raphimc.mcauth.MinecraftAuth;
|
||||
import net.raphimc.mcauth.step.bedrock.StepMCChain;
|
||||
import net.raphimc.mcauth.util.MicrosoftConstants;
|
||||
@ -59,11 +59,8 @@ public class BedrockAccountHandler extends FileSaver {
|
||||
account = MinecraftAuth.Bedrock.Title.MC_CHAIN.refresh(httpClient, account);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (System.getProperty("VFPDebug") != null) {
|
||||
ViaFabricPlus.LOGGER.error("Failed to log into Bedrock account!", e);
|
||||
} else {
|
||||
ViaFabricPlus.LOGGER.error("Failed to log into Bedrock account! Use -DVFPDebug to show the log");
|
||||
}
|
||||
|
||||
ScreenUtil.crash("Failed to log into Bedrock account!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ import com.google.common.hash.Hashing;
|
||||
import com.google.common.io.Resources;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.providers.OldAuthProvider;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@ -38,7 +38,7 @@ public class BetaCraftImpl {
|
||||
if (mppass.contains("FAILED") || mppass.contains("SERVER NOT FOUND")) return "0";
|
||||
return mppass;
|
||||
} catch (Throwable e) {
|
||||
ViaFabricPlus.LOGGER.error("An unknown error occurred while authenticating with BetaCraft");
|
||||
ScreenUtil.crash("An unknown error occurred while authenticating with BetaCraft", e);
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ package de.florianmichael.viafabricplus.definition.c0_30.classicube;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.classicube.auth.ClassiCubeAccount;
|
||||
import de.florianmichael.viafabricplus.event.DisconnectConnectionCallback;
|
||||
import de.florianmichael.viafabricplus.protocolhack.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
|
||||
import de.florianmichael.viafabricplus.util.FileSaver;
|
||||
import de.florianmichael.viafabricplus.util.ScreenUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -58,11 +58,7 @@ public class ClassiCubeAccountHandler extends FileSaver {
|
||||
try {
|
||||
account = ClassiCubeAccount.fromJson(object);
|
||||
} catch (Exception e) {
|
||||
if (System.getProperty("VFPDebug") != null) {
|
||||
ViaFabricPlus.LOGGER.error("Failed to log into ClassiCube account!", e);
|
||||
} else {
|
||||
ViaFabricPlus.LOGGER.error("Failed to log into ClassiCube account! Use -DVFPDebug to show the log");
|
||||
}
|
||||
ScreenUtil.crash("Failed to log into ClassiCube account!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,7 @@ public class MixinConnectScreen_1 {
|
||||
|
||||
if (account != null) {
|
||||
userConnection.put(new AuthChainData(userConnection, account.mojangJwt(), account.identityJwt(), account.publicKey(), account.privateKey()));
|
||||
ViaFabricPlus.LOGGER.info("Created AuthChainData for Bedrock authentication!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.util;
|
||||
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.sound.PositionedSoundInstance;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
@ -32,6 +33,14 @@ public class ScreenUtil {
|
||||
return Formatting.GOLD + "[ViaFabricPlus] " + Formatting.WHITE + message;
|
||||
}
|
||||
|
||||
public static void crash(final String message, final Throwable e) {
|
||||
if (System.getProperty("VFPDebug") != null) {
|
||||
ViaFabricPlus.LOGGER.error(message, e);
|
||||
} else {
|
||||
ViaFabricPlus.LOGGER.error(message + ", Use -DVFPDebug to show the log");
|
||||
}
|
||||
}
|
||||
|
||||
public static String format(double a) {
|
||||
return String.format("%.2f", a);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user