Skip to content

Commit

Permalink
Merge pull request #19 from thefightagainstmalware/patch-url-error
Browse files Browse the repository at this point in the history
Patch bug when there is space in path name
  • Loading branch information
pandaninjas authored Nov 24, 2023
2 parents 8db2585 + 0731abd commit 083d41d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/gq/malwarefight/nosession/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static String readString(InputStream i, Character delimiter) throws IOExc

public static boolean verifyServer(Socket s) throws IOException {
String fakeServerId = UUID.randomUUID().toString().replace("-", "");
String explanation = "This verifies that the server actually has a valid Minecraft token to comply with the EULA. Since the serverID is randomly generated, we cannot use this to login as your Minecraft account. This is similar to code in Skytils such as https://github.com/Skytils/SkytilsMod/blob/a92e75269e90f62475354acb3df9dd757c8358bd/src/main/kotlin/gg/skytils/skytilsmod/features/impl/handlers/MayorInfo.kt#L222";
@SuppressWarnings("unused") String explanation = "This verifies that the server actually has a valid Minecraft token to comply with the EULA. Since the serverID is randomly generated, we cannot use this to login as your Minecraft account. This is similar to code in Skytils such as https://github.com/Skytils/SkytilsMod/blob/a92e75269e90f62475354acb3df9dd757c8358bd/src/main/kotlin/gg/skytils/skytilsmod/features/impl/handlers/MayorInfo.kt#L222";
s.getOutputStream().write(("login " + fakeServerId).getBytes(StandardCharsets.UTF_8));
try {
GameProfile profile = Minecraft.getMinecraft().getSessionService().hasJoinedServer(Minecraft.getMinecraft().getSession().getProfile(), fakeServerId);
Expand Down Expand Up @@ -150,7 +150,7 @@ public static File getLibraryPathAsFile(Class<?> c) throws URISyntaxException {
if (uri.endsWith(".class")) {
uri = processString(uri); // stupid reference to a class within a jar
}
return new File(new URI(uri));
return new File(new URI(uri.replace(" ", "%20") /* this is pretty stupid but it works */));
}

public static String getLibraryPath(Class<?> c) throws URISyntaxException {
Expand Down

0 comments on commit 083d41d

Please sign in to comment.