aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java')
-rw-r--r--src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java b/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java
index 40a8586..d808a15 100644
--- a/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java
+++ b/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java
@@ -3,11 +3,6 @@ package gq.malwarefight.nosession;
import gq.malwarefight.nosession.relaunch.Relaunch;
import gq.malwarefight.nosession.tweaks.initial.InitialTweaker;
import gq.malwarefight.nosession.utils.Utils;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import net.minecraft.launchwrapper.Launch;
-import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
-
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
@@ -15,10 +10,14 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import net.minecraft.launchwrapper.Launch;
+import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
@IFMLLoadingPlugin.MCVersion("1.8.9")
@IFMLLoadingPlugin.Name("NoSession trolling")
@@ -67,6 +66,11 @@ public class NoSessionLoadingPlugin implements IFMLLoadingPlugin {
public static ArrayList<String> constructLaunchArgs(HashMap<String, String> args) {
ArrayList<String> constructedArgs = new ArrayList<>();
for (Entry<String, String> entry: args.entrySet()) {
+ if (entry.getKey().equals("--accessToken")) {
+ constructedArgs.add(entry.getKey());
+ constructedArgs.add("<noSessionAccessToken>");
+ continue;
+ }
constructedArgs.add(entry.getKey());
constructedArgs.add(entry.getValue());
}
@@ -102,15 +106,15 @@ public class NoSessionLoadingPlugin implements IFMLLoadingPlugin {
// test if we can find the token in Launch.blackboard.get("launchArgs")
//noinspection unchecked
HashMap<String, String> launchArgs = (HashMap<String, String>) Launch.blackboard.get("launchArgs");
- Pattern pattern = Pattern.compile("(?<token>eyJhbGciOiJIUzI1NiJ9\\.[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*)");
- Matcher match = pattern.matcher(launchArgs.get("launchArgs"));
+ Pattern pattern = Pattern.compile("(ey[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*)");
+ Matcher match = pattern.matcher(launchArgs.get("--accessToken"));
if (match.find()) {
// relaunch now !
System.out.println("=======================");
System.out.println("NoSession: relaunching without the token");
System.out.println("=======================");
try {
- Relaunch.relaunch(constructLaunchArgs(launchArgs), Launch.minecraftHome, Launch.assetsDir, "1.8.9");
+ Relaunch.relaunch(constructLaunchArgs(launchArgs));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);