diff --git a/LaunchServer/src/main/resources/pro/gravit/launchserver/defaults/proguard.cfg b/LaunchServer/src/main/resources/pro/gravit/launchserver/defaults/proguard.cfg index 0f109a1d..c15bcd6c 100644 --- a/LaunchServer/src/main/resources/pro/gravit/launchserver/defaults/proguard.cfg +++ b/LaunchServer/src/main/resources/pro/gravit/launchserver/defaults/proguard.cfg @@ -20,9 +20,9 @@ -keepattributes Signature -adaptresourcefilecontents META-INF/MANIFEST.MF --keeppackagenames com.mojang.**,net.minecraftforge.fml.**,cpw.mods.fml.**,com.google.gson.**,pro.gravit.repackage.**,org.fusesource.** +-keeppackagenames com.mojang.**,net.minecraftforge.fml.**,cpw.mods.fml.**,com.google.gson.**,pro.gravit.repackage.**,org.fusesource.**, pro.gravit.launcher.client.api.** --keep class com.mojang.**,net.minecraftforge.fml.**,cpw.mods.fml.**,com.google.gson.**,pro.gravit.repackage.**,org.fusesource.** { +-keep class com.mojang.**,net.minecraftforge.fml.**,cpw.mods.fml.**,com.google.gson.**,pro.gravit.repackage.**,org.fusesource.**, pro.gravit.launcher.client.api.** { *; } diff --git a/Launcher/src/main/java/pro/gravit/launcher/api/AuthService.java b/Launcher/src/main/java/pro/gravit/launcher/api/AuthService.java new file mode 100644 index 00000000..d6d8da59 --- /dev/null +++ b/Launcher/src/main/java/pro/gravit/launcher/api/AuthService.java @@ -0,0 +1,19 @@ +package pro.gravit.launcher.api; + +import pro.gravit.launcher.ClientPermissions; + +import java.util.UUID; + +public class AuthService { + public static String username; + public static ClientPermissions permissions = new ClientPermissions(); + public static UUID uuid; + public static boolean isAdmin() + { + return permissions.canAdmin; + } + public static boolean isServer() + { + return permissions.canServer; + } +} diff --git a/Launcher/src/main/java/pro/gravit/launcher/api/ClientService.java b/Launcher/src/main/java/pro/gravit/launcher/api/ClientService.java new file mode 100644 index 00000000..be931ec8 --- /dev/null +++ b/Launcher/src/main/java/pro/gravit/launcher/api/ClientService.java @@ -0,0 +1,10 @@ +package pro.gravit.launcher.api; + +import java.lang.instrument.Instrumentation; +import java.net.URL; + +public class ClientService { + public static Instrumentation instrumentation; + public static ClassLoader classLoader; + public static URL[] baseURLs; +} diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index c0fb76a8..75458e4c 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -32,6 +32,8 @@ import pro.gravit.launcher.LauncherAgent; import pro.gravit.launcher.LauncherConfig; import pro.gravit.launcher.LauncherEngine; +import pro.gravit.launcher.api.AuthService; +import pro.gravit.launcher.api.ClientService; import pro.gravit.launcher.client.events.ClientLauncherInitPhase; import pro.gravit.launcher.guard.LauncherGuardManager; import pro.gravit.launcher.gui.JSRuntimeProvider; @@ -518,6 +520,11 @@ public static void main(String... args) throws Throwable { LogHelper.error(e); } }; + AuthService.username = params.pp.username; + AuthService.uuid = params.pp.uuid; + ClientService.instrumentation = LauncherAgent.inst; + ClientService.classLoader = classLoader; + ClientService.baseURLs = classpathurls; LogHelper.debug("Starting JVM and client WatchService"); FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher(); FileNameMatcher clientMatcher = profile.getClientUpdateMatcher(); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/FunctionalBridge.java b/Launcher/src/main/java/pro/gravit/launcher/client/FunctionalBridge.java index efa11a15..560b5abe 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/FunctionalBridge.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/FunctionalBridge.java @@ -7,6 +7,7 @@ import java.util.concurrent.atomic.AtomicReference; import pro.gravit.launcher.LauncherAPI; +import pro.gravit.launcher.api.AuthService; import pro.gravit.launcher.events.request.AuthRequestEvent; import pro.gravit.launcher.guard.LauncherGuardManager; import pro.gravit.launcher.hasher.FileNameMatcher; @@ -100,6 +101,12 @@ public static void setAuthParams(AuthRequestEvent event) { Request.setSession(event.session); } LauncherGuardManager.guard.setProtectToken(event.protectToken); + AuthService.permissions = event.permissions; + if(event.playerProfile != null) + { + AuthService.username = event.playerProfile.username; + AuthService.uuid = event.playerProfile.uuid; + } } @FunctionalInterface