diff options
3 files changed, 15 insertions, 18 deletions
diff --git a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java index cedb25e..37a54b7 100644 --- a/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java +++ b/common/src/main/java/de/hype/bbsentials/common/chat/Chat.java @@ -237,7 +237,6 @@ public class Chat { message.replaceInJson("/viewprofile \\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}", "/socialoptions guild " + message.getPlayerName() + " " + message.getUnformattedString()); } else if (BBsentials.config.doAllChatCustomMenu) { - System.out.println("User: '" + message.getPlayerName() + "' | Message: " + message.getUnformattedString()); message.replaceInJson("/socialoptions " + message.getPlayerName(), "/socialoptions sb " + message.getPlayerName() + " " + message.getUnformattedString()); } diff --git a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java index 69be09b..42bc29c 100644 --- a/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java +++ b/common/src/main/java/de/hype/bbsentials/common/communication/BBsentialConnection.java @@ -52,16 +52,9 @@ public class BBsentialConnection { return true; } else { - BBsentials.connection.sendCommand("?emergency server-hacked? chchest command " + command); String emergencyMessage = "We detected that there was a command used which is not configured to be safe! " + command + " please check if its safe. IMMEDIATELY report this to the Admins and Developer Hype_the_Time (@hackthetime). If it is not safe immediately remove BBsentials!!!!!!!! "; System.out.println(emergencyMessage); Chat.sendPrivateMessageToSelfFatal("ยง4" + emergencyMessage + "\n\n"); - /*try { - Thread.sleep(5000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - throw new RuntimeException(emergencyMessage);*/ } return false; } @@ -501,15 +494,16 @@ public class BBsentialConnection { } Random r1 = new Random(); Random r2 = new Random(System.identityHashCode(new Object())); - BigInteger random1Bi = new BigInteger(128, r1); - BigInteger random2Bi = new BigInteger(128, r2); + BigInteger random1Bi = new BigInteger(64, r1); + BigInteger random2Bi = new BigInteger(64, r2); BigInteger serverBi = random1Bi.xor(random2Bi); String clientRandom = serverBi.toString(16); String serverId = clientRandom + packet.serverIdSuffix; if (BBsentials.config.useMojangAuth) { - String serverID = EnvironmentCore.mcUtils.mojangAuth(serverId); - sendPacket(new RequestConnectPacket(BBsentials.config.getMCUUID(), serverID, BBsentials.getConfig().getApiVersion(), AuthenticationConstants.MOJANG)); + EnvironmentCore.mcUtils.mojangAuth(serverId); + RequestConnectPacket connectPacket = new RequestConnectPacket(BBsentials.config.getMCUUID(), clientRandom, BBsentials.getConfig().getApiVersion(), AuthenticationConstants.MOJANG); + sendPacket(connectPacket); } else { sendPacket(new RequestConnectPacket(BBsentials.config.getMCUUID(), BBsentials.getConfig().getApiKey(), BBsentials.getConfig().getApiVersion(), AuthenticationConstants.DATABASE)); diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java index d3a8ae3..ce2c0bb 100644 --- a/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java +++ b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java @@ -10,8 +10,6 @@ import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; import java.io.File; -import java.math.BigInteger; -import java.util.Random; public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils { public boolean isWindowFocused() { @@ -48,10 +46,16 @@ public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils { } public String mojangAuth(String serverId) { - try { - MinecraftClient.getInstance().getSessionService().joinServer(MinecraftClient.getInstance().getGameProfile().getId(), MinecraftClient.getInstance().getSession().getAccessToken(), serverId); - } catch (AuthenticationException ignored) { - return ""; + boolean success = false; + int tries = 10; + while (tries > 0 && !success) { + tries--; + try { + MinecraftClient.getInstance().getSessionService().joinServer(MinecraftClient.getInstance().getGameProfile().getId(), MinecraftClient.getInstance().getSession().getAccessToken(), serverId); + success = true; + } catch (AuthenticationException ignored) { + + } } return serverId; } |