mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-15 20:51:45 +03:00
[FEATURE] API лаунчера, доступное извне без знания о маппингах ProGuard
This commit is contained in:
parent
0e278b715b
commit
053ca39dfe
5 changed files with 45 additions and 2 deletions
|
@ -20,9 +20,9 @@
|
||||||
-keepattributes Signature
|
-keepattributes Signature
|
||||||
-adaptresourcefilecontents META-INF/MANIFEST.MF
|
-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.** {
|
||||||
*;
|
*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -32,6 +32,8 @@
|
||||||
import pro.gravit.launcher.LauncherAgent;
|
import pro.gravit.launcher.LauncherAgent;
|
||||||
import pro.gravit.launcher.LauncherConfig;
|
import pro.gravit.launcher.LauncherConfig;
|
||||||
import pro.gravit.launcher.LauncherEngine;
|
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.client.events.ClientLauncherInitPhase;
|
||||||
import pro.gravit.launcher.guard.LauncherGuardManager;
|
import pro.gravit.launcher.guard.LauncherGuardManager;
|
||||||
import pro.gravit.launcher.gui.JSRuntimeProvider;
|
import pro.gravit.launcher.gui.JSRuntimeProvider;
|
||||||
|
@ -518,6 +520,11 @@ public static void main(String... args) throws Throwable {
|
||||||
LogHelper.error(e);
|
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");
|
LogHelper.debug("Starting JVM and client WatchService");
|
||||||
FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher();
|
FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher();
|
||||||
FileNameMatcher clientMatcher = profile.getClientUpdateMatcher();
|
FileNameMatcher clientMatcher = profile.getClientUpdateMatcher();
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import pro.gravit.launcher.LauncherAPI;
|
import pro.gravit.launcher.LauncherAPI;
|
||||||
|
import pro.gravit.launcher.api.AuthService;
|
||||||
import pro.gravit.launcher.events.request.AuthRequestEvent;
|
import pro.gravit.launcher.events.request.AuthRequestEvent;
|
||||||
import pro.gravit.launcher.guard.LauncherGuardManager;
|
import pro.gravit.launcher.guard.LauncherGuardManager;
|
||||||
import pro.gravit.launcher.hasher.FileNameMatcher;
|
import pro.gravit.launcher.hasher.FileNameMatcher;
|
||||||
|
@ -100,6 +101,12 @@ public static void setAuthParams(AuthRequestEvent event) {
|
||||||
Request.setSession(event.session);
|
Request.setSession(event.session);
|
||||||
}
|
}
|
||||||
LauncherGuardManager.guard.setProtectToken(event.protectToken);
|
LauncherGuardManager.guard.setProtectToken(event.protectToken);
|
||||||
|
AuthService.permissions = event.permissions;
|
||||||
|
if(event.playerProfile != null)
|
||||||
|
{
|
||||||
|
AuthService.username = event.playerProfile.username;
|
||||||
|
AuthService.uuid = event.playerProfile.uuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
|
|
Loading…
Reference in a new issue