mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-03-29 04:28:16 +03:00
Чистка LauncherAPI
This commit is contained in:
parent
bae9a511bc
commit
311fee0443
28 changed files with 182 additions and 186 deletions
|
@ -68,39 +68,39 @@
|
||||||
|
|
||||||
public final class LaunchServer implements Runnable, AutoCloseable {
|
public final class LaunchServer implements Runnable, AutoCloseable {
|
||||||
public static final class Config extends ConfigObject {
|
public static final class Config extends ConfigObject {
|
||||||
@LauncherAPI
|
|
||||||
public final int port;
|
public final int port;
|
||||||
|
|
||||||
// Handlers & Providers
|
// Handlers & Providers
|
||||||
@LauncherAPI
|
|
||||||
public final AuthHandler[] authHandler;
|
public final AuthHandler[] authHandler;
|
||||||
@LauncherAPI
|
|
||||||
public final AuthProvider[] authProvider;
|
public final AuthProvider[] authProvider;
|
||||||
@LauncherAPI
|
|
||||||
public final TextureProvider textureProvider;
|
public final TextureProvider textureProvider;
|
||||||
@LauncherAPI
|
|
||||||
public final HWIDHandler hwidHandler;
|
public final HWIDHandler hwidHandler;
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
@LauncherAPI
|
|
||||||
public final ExeConf launch4j;
|
public final ExeConf launch4j;
|
||||||
@LauncherAPI
|
|
||||||
public final SignConf sign;
|
public final SignConf sign;
|
||||||
@LauncherAPI
|
|
||||||
public final boolean compress;
|
public final boolean compress;
|
||||||
@LauncherAPI
|
|
||||||
public final int authRateLimit;
|
public final int authRateLimit;
|
||||||
@LauncherAPI
|
|
||||||
public final int authRateLimitMilis;
|
public final int authRateLimitMilis;
|
||||||
@LauncherAPI
|
|
||||||
public final String authRejectString;
|
public final String authRejectString;
|
||||||
@LauncherAPI
|
|
||||||
public final String projectName;
|
public final String projectName;
|
||||||
@LauncherAPI
|
|
||||||
public final String whitelistRejectString;
|
public final String whitelistRejectString;
|
||||||
@LauncherAPI
|
|
||||||
public final boolean genMappings;
|
public final boolean genMappings;
|
||||||
@LauncherAPI
|
|
||||||
public final String binaryName;
|
public final String binaryName;
|
||||||
private final StringConfigEntry address;
|
private final StringConfigEntry address;
|
||||||
private final String bindAddress;
|
private final String bindAddress;
|
||||||
|
@ -143,27 +143,27 @@ private Config(BlockConfigEntry block, Path coredir,LaunchServer server) {
|
||||||
compress = block.getEntryValue("compress", BooleanConfigEntry.class);
|
compress = block.getEntryValue("compress", BooleanConfigEntry.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return address.getValue();
|
return address.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public String getBindAddress() {
|
public String getBindAddress() {
|
||||||
return bindAddress;
|
return bindAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public SocketAddress getSocketAddress() {
|
public SocketAddress getSocketAddress() {
|
||||||
return new InetSocketAddress(bindAddress, port);
|
return new InetSocketAddress(bindAddress, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void setAddress(String address) {
|
public void setAddress(String address) {
|
||||||
this.address.setValue(address);
|
this.address.setValue(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void verify() {
|
public void verify() {
|
||||||
VerifyHelper.verify(getAddress(), VerifyHelper.NOT_EMPTY, "LaunchServer address can't be empty");
|
VerifyHelper.verify(getAddress(), VerifyHelper.NOT_EMPTY, "LaunchServer address can't be empty");
|
||||||
}
|
}
|
||||||
|
@ -276,53 +276,53 @@ public static void main(String... args) throws Throwable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constant paths
|
// Constant paths
|
||||||
@LauncherAPI
|
|
||||||
public final Path dir;
|
public final Path dir;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final Path configFile;
|
public final Path configFile;
|
||||||
@LauncherAPI
|
|
||||||
public final Path publicKeyFile;
|
public final Path publicKeyFile;
|
||||||
@LauncherAPI
|
|
||||||
public final Path privateKeyFile;
|
public final Path privateKeyFile;
|
||||||
@LauncherAPI
|
|
||||||
public final Path updatesDir;
|
public final Path updatesDir;
|
||||||
public static LaunchServer server;
|
public static LaunchServer server;
|
||||||
@LauncherAPI
|
|
||||||
public final Path profilesDir;
|
public final Path profilesDir;
|
||||||
// Server config
|
// Server config
|
||||||
@LauncherAPI
|
|
||||||
public final Config config;
|
public final Config config;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final RSAPublicKey publicKey;
|
public final RSAPublicKey publicKey;
|
||||||
@LauncherAPI
|
|
||||||
public final RSAPrivateKey privateKey;
|
public final RSAPrivateKey privateKey;
|
||||||
@LauncherAPI
|
|
||||||
public final boolean portable;
|
public final boolean portable;
|
||||||
// Launcher binary
|
// Launcher binary
|
||||||
@LauncherAPI
|
|
||||||
public final LauncherBinary launcherBinary;
|
public final LauncherBinary launcherBinary;
|
||||||
@LauncherAPI
|
|
||||||
public final LauncherBinary launcherEXEBinary;
|
public final LauncherBinary launcherEXEBinary;
|
||||||
// HWID ban + anti-brutforce
|
// HWID ban + anti-brutforce
|
||||||
@LauncherAPI
|
|
||||||
public final AuthLimiter limiter;
|
public final AuthLimiter limiter;
|
||||||
@LauncherAPI
|
|
||||||
public final SessionManager sessionManager;
|
public final SessionManager sessionManager;
|
||||||
// Server
|
// Server
|
||||||
@LauncherAPI
|
|
||||||
public final ModulesManager modulesManager;
|
public final ModulesManager modulesManager;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final BuildHookManager buildHookManager;
|
public final BuildHookManager buildHookManager;
|
||||||
@LauncherAPI
|
|
||||||
public final ProguardConf proguardConf;
|
public final ProguardConf proguardConf;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final CommandHandler commandHandler;
|
public final CommandHandler commandHandler;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final ServerSocketHandler serverSocketHandler;
|
public final ServerSocketHandler serverSocketHandler;
|
||||||
|
|
||||||
private final AtomicBoolean started = new AtomicBoolean(false);
|
private final AtomicBoolean started = new AtomicBoolean(false);
|
||||||
|
@ -445,7 +445,7 @@ private LauncherBinary binary() {
|
||||||
return new EXELauncherBinary(this);
|
return new EXELauncherBinary(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void buildLauncherBinaries() throws IOException {
|
public void buildLauncherBinaries() throws IOException {
|
||||||
launcherBinary.build();
|
launcherBinary.build();
|
||||||
launcherEXEBinary.build();
|
launcherEXEBinary.build();
|
||||||
|
@ -504,23 +504,23 @@ private void generateConfigIfNotExists() throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
@SuppressWarnings("ReturnOfCollectionOrArrayField")
|
@SuppressWarnings("ReturnOfCollectionOrArrayField")
|
||||||
public Collection<SignedObjectHolder<ClientProfile>> getProfiles() {
|
public Collection<SignedObjectHolder<ClientProfile>> getProfiles() {
|
||||||
return profilesList;
|
return profilesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public SignedObjectHolder<HashedDir> getUpdateDir(String name) {
|
public SignedObjectHolder<HashedDir> getUpdateDir(String name) {
|
||||||
return updatesDirMap.get(name);
|
return updatesDirMap.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public Set<Entry<String, SignedObjectHolder<HashedDir>>> getUpdateDirs() {
|
public Set<Entry<String, SignedObjectHolder<HashedDir>>> getUpdateDirs() {
|
||||||
return updatesDirMap.entrySet();
|
return updatesDirMap.entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void rebindServerSocket() {
|
public void rebindServerSocket() {
|
||||||
serverSocketHandler.close();
|
serverSocketHandler.close();
|
||||||
CommonHelper.newThread("Server Socket Thread", false, serverSocketHandler).start();
|
CommonHelper.newThread("Server Socket Thread", false, serverSocketHandler).start();
|
||||||
|
@ -539,7 +539,7 @@ public void run() {
|
||||||
rebindServerSocket();
|
rebindServerSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void syncLauncherBinaries() throws IOException {
|
public void syncLauncherBinaries() throws IOException {
|
||||||
LogHelper.info("Syncing launcher binaries");
|
LogHelper.info("Syncing launcher binaries");
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ public void syncLauncherBinaries() throws IOException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void syncProfilesDir() throws IOException {
|
public void syncProfilesDir() throws IOException {
|
||||||
LogHelper.info("Syncing profiles dir");
|
LogHelper.info("Syncing profiles dir");
|
||||||
List<SignedObjectHolder<ClientProfile>> newProfies = new LinkedList<>();
|
List<SignedObjectHolder<ClientProfile>> newProfies = new LinkedList<>();
|
||||||
|
@ -565,7 +565,7 @@ public void syncProfilesDir() throws IOException {
|
||||||
profilesList = Collections.unmodifiableList(newProfies);
|
profilesList = Collections.unmodifiableList(newProfies);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void syncUpdatesDir(Collection<String> dirs) throws IOException {
|
public void syncUpdatesDir(Collection<String> dirs) throws IOException {
|
||||||
LogHelper.info("Syncing updates dir");
|
LogHelper.info("Syncing updates dir");
|
||||||
Map<String, SignedObjectHolder<HashedDir>> newUpdatesDirMap = new HashMap<>(16);
|
Map<String, SignedObjectHolder<HashedDir>> newUpdatesDirMap = new HashMap<>(16);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
public final class AuthException extends IOException {
|
public final class AuthException extends IOException {
|
||||||
private static final long serialVersionUID = -2586107832847245863L;
|
private static final long serialVersionUID = -2586107832847245863L;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public AuthException(String message) {
|
public AuthException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public String toString() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static final long TIMEOUT = 10 * 60 * 1000; //10 минут
|
public static final long TIMEOUT = 10 * 60 * 1000; //10 минут
|
||||||
public final int rateLimit;
|
public final int rateLimit;
|
||||||
public final int rateLimitMilis;
|
public final int rateLimitMilis;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||||
|
|
||||||
public final class MySQLSourceConfig extends ConfigObject implements AutoCloseable {
|
public final class MySQLSourceConfig extends ConfigObject implements AutoCloseable {
|
||||||
@LauncherAPI
|
|
||||||
public static final int TIMEOUT = VerifyHelper.verifyInt(
|
public static final int TIMEOUT = VerifyHelper.verifyInt(
|
||||||
Integer.parseUnsignedInt(System.getProperty("launcher.mysql.idleTimeout", Integer.toString(5000))),
|
Integer.parseUnsignedInt(System.getProperty("launcher.mysql.idleTimeout", Integer.toString(5000))),
|
||||||
VerifyHelper.POSITIVE, "launcher.mysql.idleTimeout can't be <= 5000");
|
VerifyHelper.POSITIVE, "launcher.mysql.idleTimeout can't be <= 5000");
|
||||||
|
@ -44,7 +44,7 @@ public final class MySQLSourceConfig extends ConfigObject implements AutoCloseab
|
||||||
private DataSource source;
|
private DataSource source;
|
||||||
private boolean hikari;
|
private boolean hikari;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public MySQLSourceConfig(String poolName, BlockConfigEntry block) {
|
public MySQLSourceConfig(String poolName, BlockConfigEntry block) {
|
||||||
super(block);
|
super(block);
|
||||||
this.poolName = poolName;
|
this.poolName = poolName;
|
||||||
|
@ -70,7 +70,7 @@ public synchronized void close() {
|
||||||
((HikariDataSource) source).close();
|
((HikariDataSource) source).close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public synchronized Connection getConnection() throws SQLException {
|
public synchronized Connection getConnection() throws SQLException {
|
||||||
if (source == null) { // New data source
|
if (source == null) { // New data source
|
||||||
MysqlDataSource mysqlSource = new MysqlDataSource();
|
MysqlDataSource mysqlSource = new MysqlDataSource();
|
||||||
|
|
|
@ -17,19 +17,19 @@ public abstract class AuthHandler extends ConfigObject implements AutoCloseable
|
||||||
private static final Map<String, Adapter<AuthHandler>> AUTH_HANDLERS = new ConcurrentHashMap<>(4);
|
private static final Map<String, Adapter<AuthHandler>> AUTH_HANDLERS = new ConcurrentHashMap<>(4);
|
||||||
private static boolean registredHandl = false;
|
private static boolean registredHandl = false;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static UUID authError(String message) throws AuthException {
|
public static UUID authError(String message) throws AuthException {
|
||||||
throw new AuthException(message);
|
throw new AuthException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static AuthHandler newHandler(String name, BlockConfigEntry block) {
|
public static AuthHandler newHandler(String name, BlockConfigEntry block) {
|
||||||
Adapter<AuthHandler> authHandlerAdapter = VerifyHelper.getMapValue(AUTH_HANDLERS, name,
|
Adapter<AuthHandler> authHandlerAdapter = VerifyHelper.getMapValue(AUTH_HANDLERS, name,
|
||||||
String.format("Unknown auth handler: '%s'", name));
|
String.format("Unknown auth handler: '%s'", name));
|
||||||
return authHandlerAdapter.convert(block);
|
return authHandlerAdapter.convert(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void registerHandler(String name, Adapter<AuthHandler> adapter) {
|
public static void registerHandler(String name, Adapter<AuthHandler> adapter) {
|
||||||
VerifyHelper.verifyIDName(name);
|
VerifyHelper.verifyIDName(name);
|
||||||
VerifyHelper.putIfAbsent(AUTH_HANDLERS, name, Objects.requireNonNull(adapter, "adapter"),
|
VerifyHelper.putIfAbsent(AUTH_HANDLERS, name, Objects.requireNonNull(adapter, "adapter"),
|
||||||
|
@ -50,26 +50,26 @@ public static void registerHandlers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected AuthHandler(BlockConfigEntry block) {
|
protected AuthHandler(BlockConfigEntry block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract UUID auth(AuthProviderResult authResult) throws IOException;
|
public abstract UUID auth(AuthProviderResult authResult) throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract UUID checkServer(String username, String serverID) throws IOException;
|
public abstract UUID checkServer(String username, String serverID) throws IOException;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void close() throws IOException;
|
public abstract void close() throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract boolean joinServer(String username, String accessToken, String serverID) throws IOException;
|
public abstract boolean joinServer(String username, String accessToken, String serverID) throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract UUID usernameToUUID(String username) throws IOException;
|
public abstract UUID usernameToUUID(String username) throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract String uuidToUsername(UUID uuid) throws IOException;
|
public abstract String uuidToUsername(UUID uuid) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
|
|
||||||
public abstract class CachedAuthHandler extends AuthHandler implements NeedGarbageCollection {
|
public abstract class CachedAuthHandler extends AuthHandler implements NeedGarbageCollection {
|
||||||
public static final class Entry {
|
public static final class Entry {
|
||||||
@LauncherAPI
|
|
||||||
public final UUID uuid;
|
public final UUID uuid;
|
||||||
private String username;
|
private String username;
|
||||||
private String accessToken;
|
private String accessToken;
|
||||||
private String serverID;
|
private String serverID;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public Entry(UUID uuid, String username, String accessToken, String serverID) {
|
public Entry(UUID uuid, String username, String accessToken, String serverID) {
|
||||||
this.uuid = Objects.requireNonNull(uuid, "uuid");
|
this.uuid = Objects.requireNonNull(uuid, "uuid");
|
||||||
this.username = Objects.requireNonNull(username, "username");
|
this.username = Objects.requireNonNull(username, "username");
|
||||||
|
@ -37,14 +37,14 @@ public Entry(UUID uuid, String username, String accessToken, String serverID) {
|
||||||
|
|
||||||
private final Map<String, UUID> usernamesCache = new HashMap<>(1024);
|
private final Map<String, UUID> usernamesCache = new HashMap<>(1024);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected CachedAuthHandler(BlockConfigEntry block) {
|
protected CachedAuthHandler(BlockConfigEntry block) {
|
||||||
super(block);
|
super(block);
|
||||||
if (block.hasEntry("garbage"))
|
if (block.hasEntry("garbage"))
|
||||||
if (block.getEntryValue("garbage", BooleanConfigEntry.class)) GarbageManager.registerNeedGC(this);
|
if (block.getEntryValue("garbage", BooleanConfigEntry.class)) GarbageManager.registerNeedGC(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected void addEntry(Entry entry) {
|
protected void addEntry(Entry entry) {
|
||||||
Entry previous = entryCache.put(entry.uuid, entry);
|
Entry previous = entryCache.put(entry.uuid, entry);
|
||||||
if (previous != null)
|
if (previous != null)
|
||||||
|
@ -72,10 +72,10 @@ public synchronized UUID checkServer(String username, String serverID) throws IO
|
||||||
serverID.equals(entry.serverID) ? entry.uuid : null;
|
serverID.equals(entry.serverID) ? entry.uuid : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected abstract Entry fetchEntry(String username) throws IOException;
|
protected abstract Entry fetchEntry(String username) throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected abstract Entry fetchEntry(UUID uuid) throws IOException;
|
protected abstract Entry fetchEntry(UUID uuid) throws IOException;
|
||||||
|
|
||||||
private Entry getEntry(String username) throws IOException {
|
private Entry getEntry(String username) throws IOException {
|
||||||
|
@ -118,10 +118,10 @@ public synchronized void garbageCollection() {
|
||||||
entryCache.clear();
|
entryCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected abstract boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException;
|
protected abstract boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected abstract boolean updateServerID(UUID uuid, String serverID) throws IOException;
|
protected abstract boolean updateServerID(UUID uuid, String serverID) throws IOException;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,7 +31,7 @@ public static final class Entry extends StreamObject {
|
||||||
private String accessToken;
|
private String accessToken;
|
||||||
private String serverID;
|
private String serverID;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public Entry(HInput input) throws IOException {
|
public Entry(HInput input) throws IOException {
|
||||||
username = VerifyHelper.verifyUsername(input.readString(64));
|
username = VerifyHelper.verifyUsername(input.readString(64));
|
||||||
if (input.readBoolean()) {
|
if (input.readBoolean()) {
|
||||||
|
@ -41,12 +41,12 @@ public Entry(HInput input) throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public Entry(String username) {
|
public Entry(String username) {
|
||||||
this.username = VerifyHelper.verifyUsername(username);
|
this.username = VerifyHelper.verifyUsername(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public Entry(String username, String accessToken, String serverID) {
|
public Entry(String username, String accessToken, String serverID) {
|
||||||
this(username);
|
this(username);
|
||||||
if (accessToken == null && serverID != null)
|
if (accessToken == null && serverID != null)
|
||||||
|
@ -67,17 +67,17 @@ private boolean checkServer(String username, String serverID) {
|
||||||
return username.equals(this.username) && serverID.equals(this.serverID);
|
return username.equals(this.username) && serverID.equals(this.serverID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public String getAccessToken() {
|
public String getAccessToken() {
|
||||||
return accessToken;
|
return accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public String getServerID() {
|
public String getServerID() {
|
||||||
return serverID;
|
return serverID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
@ -104,12 +104,12 @@ public void write(HOutput output) throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final Path file;
|
public final Path file;
|
||||||
@LauncherAPI
|
|
||||||
public final Path fileTmp;
|
public final Path fileTmp;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final boolean offlineUUIDs;
|
public final boolean offlineUUIDs;
|
||||||
// Instance
|
// Instance
|
||||||
private final SecureRandom random = SecurityHelper.newRandom();
|
private final SecureRandom random = SecurityHelper.newRandom();
|
||||||
|
@ -120,7 +120,7 @@ public void write(HOutput output) throws IOException {
|
||||||
|
|
||||||
private final Map<String, UUID> usernamesMap = new HashMap<>(256);
|
private final Map<String, UUID> usernamesMap = new HashMap<>(256);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected FileAuthHandler(BlockConfigEntry block) {
|
protected FileAuthHandler(BlockConfigEntry block) {
|
||||||
super(block);
|
super(block);
|
||||||
file = IOHelper.toPath(block.getEntryValue("file", StringConfigEntry.class));
|
file = IOHelper.toPath(block.getEntryValue("file", StringConfigEntry.class));
|
||||||
|
@ -138,7 +138,7 @@ protected FileAuthHandler(BlockConfigEntry block) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final void addAuth(UUID uuid, Entry entry) {
|
protected final void addAuth(UUID uuid, Entry entry) {
|
||||||
lock.writeLock().lock();
|
lock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
|
@ -202,7 +202,7 @@ public final void close() throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final Set<Map.Entry<UUID, Entry>> entrySet() {
|
protected final Set<Map.Entry<UUID, Entry>> entrySet() {
|
||||||
return Collections.unmodifiableMap(entryMap).entrySet();
|
return Collections.unmodifiableMap(entryMap).entrySet();
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ public final boolean joinServer(String username, String accessToken, String serv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected abstract void readAuthFile() throws IOException;
|
protected abstract void readAuthFile() throws IOException;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -258,6 +258,6 @@ public final String uuidToUsername(UUID uuid) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected abstract void writeAuthFileTmp() throws IOException;
|
protected abstract void writeAuthFileTmp() throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public boolean joinServer(String username, String accessToken, String serverID)
|
||||||
return getHandler().joinServer(username, accessToken, serverID);
|
return getHandler().joinServer(username, accessToken, serverID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void setBackend(AuthHandler handler) {
|
public void setBackend(AuthHandler handler) {
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,14 @@ public abstract class HWIDHandler extends ConfigObject implements AutoCloseable
|
||||||
public static final HWID nullHWID = HWID.gen(0, 0, 0);
|
public static final HWID nullHWID = HWID.gen(0, 0, 0);
|
||||||
private static boolean registredHandl = false;
|
private static boolean registredHandl = false;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static HWIDHandler newHandler(String name, BlockConfigEntry block) {
|
public static HWIDHandler newHandler(String name, BlockConfigEntry block) {
|
||||||
Adapter<HWIDHandler> authHandlerAdapter = VerifyHelper.getMapValue(HW_HANDLERS, name,
|
Adapter<HWIDHandler> authHandlerAdapter = VerifyHelper.getMapValue(HW_HANDLERS, name,
|
||||||
String.format("Unknown HWID handler: '%s'", name));
|
String.format("Unknown HWID handler: '%s'", name));
|
||||||
return authHandlerAdapter.convert(block);
|
return authHandlerAdapter.convert(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void registerHandler(String name, Adapter<HWIDHandler> adapter) {
|
public static void registerHandler(String name, Adapter<HWIDHandler> adapter) {
|
||||||
VerifyHelper.verifyIDName(name);
|
VerifyHelper.verifyIDName(name);
|
||||||
VerifyHelper.putIfAbsent(HW_HANDLERS, name, Objects.requireNonNull(adapter, "adapter"),
|
VerifyHelper.putIfAbsent(HW_HANDLERS, name, Objects.requireNonNull(adapter, "adapter"),
|
||||||
|
|
|
@ -18,12 +18,12 @@ public abstract class AuthProvider extends ConfigObject implements AutoCloseable
|
||||||
private static boolean registredProv = false;
|
private static boolean registredProv = false;
|
||||||
private LaunchServer server;
|
private LaunchServer server;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static AuthProviderResult authError(String message) throws AuthException {
|
public static AuthProviderResult authError(String message) throws AuthException {
|
||||||
throw new AuthException(message);
|
throw new AuthException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static AuthProvider newProvider(String name, BlockConfigEntry block,LaunchServer server) {
|
public static AuthProvider newProvider(String name, BlockConfigEntry block,LaunchServer server) {
|
||||||
VerifyHelper.verifyIDName(name);
|
VerifyHelper.verifyIDName(name);
|
||||||
ServerAdapter<AuthProvider> authHandlerAdapter = VerifyHelper.getMapValue(AUTH_PROVIDERS, name,
|
ServerAdapter<AuthProvider> authHandlerAdapter = VerifyHelper.getMapValue(AUTH_PROVIDERS, name,
|
||||||
|
@ -31,7 +31,7 @@ public static AuthProvider newProvider(String name, BlockConfigEntry block,Launc
|
||||||
return authHandlerAdapter.convert(block,server);
|
return authHandlerAdapter.convert(block,server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void registerProvider(String name, ServerAdapter<AuthProvider> adapter) {
|
public static void registerProvider(String name, ServerAdapter<AuthProvider> adapter) {
|
||||||
VerifyHelper.putIfAbsent(AUTH_PROVIDERS, name, Objects.requireNonNull(adapter, "adapter"),
|
VerifyHelper.putIfAbsent(AUTH_PROVIDERS, name, Objects.requireNonNull(adapter, "adapter"),
|
||||||
String.format("Auth provider has been already registered: '%s'", name));
|
String.format("Auth provider has been already registered: '%s'", name));
|
||||||
|
@ -57,20 +57,20 @@ public AuthHandler getAccociateHandler(int this_position)
|
||||||
return server.config.authHandler[this_position];
|
return server.config.authHandler[this_position];
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected AuthProvider(BlockConfigEntry block, LaunchServer launchServer) {
|
protected AuthProvider(BlockConfigEntry block, LaunchServer launchServer) {
|
||||||
super(block);
|
super(block);
|
||||||
server = launchServer;
|
server = launchServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract AuthProviderResult auth(String login, String password, String ip) throws Exception;
|
public abstract AuthProviderResult auth(String login, String password, String ip) throws Exception;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void close() throws IOException;
|
public abstract void close() throws IOException;
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface ServerAdapter<O extends ConfigObject> {
|
public interface ServerAdapter<O extends ConfigObject> {
|
||||||
@LauncherAPI
|
|
||||||
O convert(BlockConfigEntry entry,LaunchServer server);
|
O convert(BlockConfigEntry entry,LaunchServer server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
public abstract class DigestAuthProvider extends AuthProvider {
|
public abstract class DigestAuthProvider extends AuthProvider {
|
||||||
private final DigestAlgorithm digest;
|
private final DigestAlgorithm digest;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected DigestAuthProvider(BlockConfigEntry block, LaunchServer server) {
|
protected DigestAuthProvider(BlockConfigEntry block, LaunchServer server) {
|
||||||
super(block,server);
|
super(block,server);
|
||||||
digest = DigestAlgorithm.byName(block.getEntryValue("digest", StringConfigEntry.class));
|
digest = DigestAlgorithm.byName(block.getEntryValue("digest", StringConfigEntry.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final void verifyDigest(String validDigest, String password) throws AuthException {
|
protected final void verifyDigest(String validDigest, String password) throws AuthException {
|
||||||
boolean valid;
|
boolean valid;
|
||||||
if (digest == DigestAlgorithm.PLAIN)
|
if (digest == DigestAlgorithm.PLAIN)
|
||||||
|
|
|
@ -31,7 +31,7 @@ private AuthProvider getProvider() {
|
||||||
return VerifyHelper.verify(provider, Objects::nonNull, "Backend auth provider wasn't set");
|
return VerifyHelper.verify(provider, Objects::nonNull, "Backend auth provider wasn't set");
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void setBackend(AuthProvider provider) {
|
public void setBackend(AuthProvider provider) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public void clear() {
|
||||||
// File constants
|
// File constants
|
||||||
private final Path faviconFile;
|
private final Path faviconFile;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public EXEL4JLauncherBinary(LaunchServer server) {
|
public EXEL4JLauncherBinary(LaunchServer server) {
|
||||||
super(server, server.dir.resolve(server.config.binaryName + ".exe"));
|
super(server, server.dir.resolve(server.config.binaryName + ".exe"));
|
||||||
faviconFile = server.dir.resolve("favicon.ico");
|
faviconFile = server.dir.resolve("favicon.ico");
|
||||||
|
|
|
@ -71,17 +71,17 @@ private static ZipEntry newEntry(String fileName) {
|
||||||
return newZipEntry(Launcher.RUNTIME_DIR + IOHelper.CROSS_SEPARATOR + fileName);
|
return newZipEntry(Launcher.RUNTIME_DIR + IOHelper.CROSS_SEPARATOR + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final Path runtimeDir;
|
public final Path runtimeDir;
|
||||||
public final Path guardDir;
|
public final Path guardDir;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final Path initScriptFile;
|
public final Path initScriptFile;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final Path obfJar;
|
public final Path obfJar;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public JARLauncherBinary(LaunchServer server) throws IOException {
|
public JARLauncherBinary(LaunchServer server) throws IOException {
|
||||||
super(server, server.dir.resolve(server.config.binaryName + ".jar"),
|
super(server, server.dir.resolve(server.config.binaryName + ".jar"),
|
||||||
server.dir.resolve(server.config.binaryName + (server.config.sign.enabled ? "-sign.jar" : "-obf.jar")));
|
server.dir.resolve(server.config.binaryName + (server.config.sign.enabled ? "-sign.jar" : "-obf.jar")));
|
||||||
|
@ -252,7 +252,7 @@ private void stdBuild() throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void tryUnpackRuntime() throws IOException {
|
public void tryUnpackRuntime() throws IOException {
|
||||||
// Verify is runtime dir unpacked
|
// Verify is runtime dir unpacked
|
||||||
if (IOHelper.isDir(runtimeDir))
|
if (IOHelper.isDir(runtimeDir))
|
||||||
|
@ -271,7 +271,7 @@ public void tryUnpackRuntime() throws IOException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@LauncherAPI
|
|
||||||
public void tryUnpackGuard() throws IOException {
|
public void tryUnpackGuard() throws IOException {
|
||||||
// Verify is runtime dir unpacked
|
// Verify is runtime dir unpacked
|
||||||
if (IOHelper.isDir(guardDir))
|
if (IOHelper.isDir(guardDir))
|
||||||
|
|
|
@ -10,46 +10,46 @@
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
public abstract class LauncherBinary {
|
public abstract class LauncherBinary {
|
||||||
@LauncherAPI
|
|
||||||
protected final LaunchServer server;
|
protected final LaunchServer server;
|
||||||
@LauncherAPI
|
|
||||||
protected final Path binaryFile;
|
protected final Path binaryFile;
|
||||||
protected final Path syncBinaryFile;
|
protected final Path syncBinaryFile;
|
||||||
private volatile SignedBytesHolder binary;
|
private volatile SignedBytesHolder binary;
|
||||||
private volatile byte[] hash;
|
private volatile byte[] hash;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected LauncherBinary(LaunchServer server, Path binaryFile) {
|
protected LauncherBinary(LaunchServer server, Path binaryFile) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.binaryFile = binaryFile;
|
this.binaryFile = binaryFile;
|
||||||
syncBinaryFile = binaryFile;
|
syncBinaryFile = binaryFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected LauncherBinary(LaunchServer server, Path binaryFile, Path syncBinaryFile) {
|
protected LauncherBinary(LaunchServer server, Path binaryFile, Path syncBinaryFile) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.binaryFile = binaryFile;
|
this.binaryFile = binaryFile;
|
||||||
this.syncBinaryFile = syncBinaryFile;
|
this.syncBinaryFile = syncBinaryFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract void build() throws IOException;
|
public abstract void build() throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final boolean exists() {
|
public final boolean exists() {
|
||||||
return IOHelper.isFile(syncBinaryFile);
|
return IOHelper.isFile(syncBinaryFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final SignedBytesHolder getBytes() {
|
public final SignedBytesHolder getBytes() {
|
||||||
return binary;
|
return binary;
|
||||||
}
|
}
|
||||||
@LauncherAPI
|
|
||||||
public final byte[] getHash() {
|
public final byte[] getHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final boolean sync() throws IOException {
|
public final boolean sync() throws IOException {
|
||||||
boolean exists = exists();
|
boolean exists = exists();
|
||||||
binary = exists ? new SignedBytesHolder(IOHelper.read(syncBinaryFile), server.privateKey) : null;
|
binary = exists ? new SignedBytesHolder(IOHelper.read(syncBinaryFile), server.privateKey) : null;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
|
||||||
public abstract class Command {
|
public abstract class Command {
|
||||||
@LauncherAPI
|
|
||||||
protected static String parseUsername(String username) throws CommandException {
|
protected static String parseUsername(String username) throws CommandException {
|
||||||
try {
|
try {
|
||||||
return VerifyHelper.verifyUsername(username);
|
return VerifyHelper.verifyUsername(username);
|
||||||
|
@ -16,7 +16,7 @@ protected static String parseUsername(String username) throws CommandException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected static UUID parseUUID(String s) throws CommandException {
|
protected static UUID parseUUID(String s) throws CommandException {
|
||||||
try {
|
try {
|
||||||
return UUID.fromString(s);
|
return UUID.fromString(s);
|
||||||
|
@ -25,24 +25,24 @@ protected static UUID parseUUID(String s) throws CommandException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final LaunchServer server;
|
protected final LaunchServer server;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected Command(LaunchServer server) {
|
protected Command(LaunchServer server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract String getArgsDescription(); // "<required> [optional]"
|
public abstract String getArgsDescription(); // "<required> [optional]"
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract String getUsageDescription();
|
public abstract String getUsageDescription();
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract void invoke(String... args) throws Exception;
|
public abstract void invoke(String... args) throws Exception;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final void verifyArgs(String[] args, int min) throws CommandException {
|
protected final void verifyArgs(String[] args, int min) throws CommandException {
|
||||||
if (args.length < min)
|
if (args.length < min)
|
||||||
throw new CommandException("Command usage: " + getArgsDescription());
|
throw new CommandException("Command usage: " + getArgsDescription());
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
public final class CommandException extends Exception {
|
public final class CommandException extends Exception {
|
||||||
private static final long serialVersionUID = -6588814993972117772L;
|
private static final long serialVersionUID = -6588814993972117772L;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public CommandException(String message) {
|
public CommandException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public CommandException(Throwable exc) {
|
public CommandException(Throwable exc) {
|
||||||
super(exc);
|
super(exc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,18 +120,18 @@ protected CommandHandler(LaunchServer server) {
|
||||||
registerCommand("unban", new UnbanCommand(server));
|
registerCommand("unban", new UnbanCommand(server));
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract void bell() throws IOException;
|
public abstract void bell() throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract void clear() throws IOException;
|
public abstract void clear() throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final Map<String, Command> commandsMap() {
|
public final Map<String, Command> commandsMap() {
|
||||||
return Collections.unmodifiableMap(commands);
|
return Collections.unmodifiableMap(commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final void eval(String line, boolean bell) {
|
public final void eval(String line, boolean bell) {
|
||||||
LogHelper.info("Command '%s'", line);
|
LogHelper.info("Command '%s'", line);
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public final void eval(String line, boolean bell) {
|
||||||
eval(args, bell);
|
eval(args, bell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final void eval(String[] args, boolean bell) {
|
public final void eval(String[] args, boolean bell) {
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -171,7 +171,7 @@ public final void eval(String[] args, boolean bell) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final Command lookup(String name) throws CommandException {
|
public final Command lookup(String name) throws CommandException {
|
||||||
Command command = commands.get(name);
|
Command command = commands.get(name);
|
||||||
if (command == null)
|
if (command == null)
|
||||||
|
@ -179,7 +179,7 @@ public final Command lookup(String name) throws CommandException {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract String readLine() throws IOException;
|
public abstract String readLine() throws IOException;
|
||||||
|
|
||||||
private void readLoop() throws IOException {
|
private void readLoop() throws IOException {
|
||||||
|
@ -187,7 +187,7 @@ private void readLoop() throws IOException {
|
||||||
eval(line, true);
|
eval(line, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public final void registerCommand(String name, Command command) {
|
public final void registerCommand(String name, Command command) {
|
||||||
VerifyHelper.verifyIDName(name);
|
VerifyHelper.verifyIDName(name);
|
||||||
VerifyHelper.putIfAbsent(commands, name, Objects.requireNonNull(command, "command"),
|
VerifyHelper.putIfAbsent(commands, name, Objects.requireNonNull(command, "command"),
|
||||||
|
|
|
@ -54,12 +54,12 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
||||||
|
|
||||||
private static final String JSON_EXTENSION = ".json";
|
private static final String JSON_EXTENSION = ".json";
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static Path resolveIndexFile(Path assetDir, String name) {
|
public static Path resolveIndexFile(Path assetDir, String name) {
|
||||||
return assetDir.resolve(INDEXES_DIR).resolve(name + JSON_EXTENSION);
|
return assetDir.resolve(INDEXES_DIR).resolve(name + JSON_EXTENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static Path resolveObjectFile(Path assetDir, String hash) {
|
public static Path resolveObjectFile(Path assetDir, String hash) {
|
||||||
return assetDir.resolve(OBJECTS_DIR).resolve(hash.substring(0, 2)).resolve(hash);
|
return assetDir.resolve(OBJECTS_DIR).resolve(hash.substring(0, 2)).resolve(hash);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,32 +8,32 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
|
|
||||||
public class SessionManager implements NeedGarbageCollection {
|
public class SessionManager implements NeedGarbageCollection {
|
||||||
@LauncherAPI
|
|
||||||
public static final long SESSION_TIMEOUT = 10 * 60 * 1000; // 10 минут
|
public static final long SESSION_TIMEOUT = 10 * 60 * 1000; // 10 минут
|
||||||
public static final boolean NON_GARBAGE_SERVER = true;
|
public static final boolean NON_GARBAGE_SERVER = true;
|
||||||
private Set<Client> clientSet = new HashSet<>(128);
|
private Set<Client> clientSet = new HashSet<>(128);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public boolean addClient(Client client) {
|
public boolean addClient(Client client) {
|
||||||
clientSet.add(client);
|
clientSet.add(client);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void garbageCollection() {
|
public void garbageCollection() {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
clientSet.removeIf(c -> (c.timestamp + SESSION_TIMEOUT < time) && ((c.type == Client.Type.USER) || ((c.type == Client.Type.SERVER) && !NON_GARBAGE_SERVER ) ));
|
clientSet.removeIf(c -> (c.timestamp + SESSION_TIMEOUT < time) && ((c.type == Client.Type.USER) || ((c.type == Client.Type.SERVER) && !NON_GARBAGE_SERVER ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public Client getClient(long session) {
|
public Client getClient(long session) {
|
||||||
for (Client c : clientSet)
|
for (Client c : clientSet)
|
||||||
if (c.session == session) return c;
|
if (c.session == session) return c;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public Client getOrNewClient(long session) {
|
public Client getOrNewClient(long session) {
|
||||||
for (Client c : clientSet)
|
for (Client c : clientSet)
|
||||||
if (c.session == session) return c;
|
if (c.session == session) return c;
|
||||||
|
@ -42,7 +42,7 @@ public Client getOrNewClient(long session) {
|
||||||
return newClient;
|
return newClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void updateClient(long session) {
|
public void updateClient(long session) {
|
||||||
for (Client c : clientSet) {
|
for (Client c : clientSet) {
|
||||||
if (c.session == session) {
|
if (c.session == session) {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
public abstract class Response {
|
public abstract class Response {
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface Factory<R> {
|
public interface Factory<R> {
|
||||||
@LauncherAPI
|
|
||||||
Response newResponse(LaunchServer server, long id, HInput input, HOutput output, String ip);
|
Response newResponse(LaunchServer server, long id, HInput input, HOutput output, String ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,24 +57,24 @@ public static void registerResponses() {
|
||||||
registerResponse(RequestType.SERVERAUTH.getNumber(), AuthServerResponse::new);
|
registerResponse(RequestType.SERVERAUTH.getNumber(), AuthServerResponse::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void requestError(String message) throws RequestException {
|
public static void requestError(String message) throws RequestException {
|
||||||
throw new RequestException(message);
|
throw new RequestException(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final LaunchServer server;
|
protected final LaunchServer server;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final HInput input;
|
protected final HInput input;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final HOutput output;
|
protected final HOutput output;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final String ip;
|
protected final String ip;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final long session;
|
protected final long session;
|
||||||
|
|
||||||
protected Response(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
protected Response(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
@ -85,20 +85,20 @@ protected Response(LaunchServer server, long session, HInput input, HOutput outp
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final void debug(String message) {
|
protected final void debug(String message) {
|
||||||
LogHelper.subDebug("#%d %s", session, message);
|
LogHelper.subDebug("#%d %s", session, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected final void debug(String message, Object... args) {
|
protected final void debug(String message, Object... args) {
|
||||||
debug(String.format(message, args));
|
debug(String.format(message, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract void reply() throws Exception;
|
public abstract void reply() throws Exception;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
@SuppressWarnings("MethodMayBeStatic") // Intentionally not static
|
@SuppressWarnings("MethodMayBeStatic") // Intentionally not static
|
||||||
protected final void writeNoError(HOutput output) throws IOException {
|
protected final void writeNoError(HOutput output) throws IOException {
|
||||||
output.writeString("", 0);
|
output.writeString("", 0);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public final class NettyServerSocketHandler implements Runnable, AutoCloseable {
|
||||||
private static final String WEBSOCKET_PATH = "/api";
|
private static final String WEBSOCKET_PATH = "/api";
|
||||||
private static SSLServerSocketFactory ssf;
|
private static SSLServerSocketFactory ssf;
|
||||||
private static final ThreadFactory THREAD_FACTORY = r -> CommonHelper.newThread("Network Thread", true, r);
|
private static final ThreadFactory THREAD_FACTORY = r -> CommonHelper.newThread("Network Thread", true, r);
|
||||||
@LauncherAPI
|
|
||||||
public volatile boolean logConnections = Boolean.getBoolean("launcher.logConnections");
|
public volatile boolean logConnections = Boolean.getBoolean("launcher.logConnections");
|
||||||
|
|
||||||
private final AtomicReference<ServerSocket> serverSocket = new AtomicReference<>();
|
private final AtomicReference<ServerSocket> serverSocket = new AtomicReference<>();
|
||||||
|
@ -191,14 +191,14 @@ public void initChannel(NioSocketChannel ch) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void registerCustomResponse(String name, Response.Factory factory) {
|
public void registerCustomResponse(String name, Response.Factory factory) {
|
||||||
VerifyHelper.verifyIDName(name);
|
VerifyHelper.verifyIDName(name);
|
||||||
VerifyHelper.putIfAbsent(customResponses, name, Objects.requireNonNull(factory, "factory"),
|
VerifyHelper.putIfAbsent(customResponses, name, Objects.requireNonNull(factory, "factory"),
|
||||||
String.format("Custom response has been already registered: '%s'", name));
|
String.format("Custom response has been already registered: '%s'", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void setListener(Listener listener) {
|
public void setListener(Listener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
@ -214,13 +214,13 @@ public void setListener(Listener listener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
@LauncherAPI
|
|
||||||
boolean onConnect(long id, InetAddress address);
|
boolean onConnect(long id, InetAddress address);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
void onDisconnect(long id, Exception e);
|
void onDisconnect(long id, Exception e);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
boolean onHandshake(long id, Integer type);
|
boolean onHandshake(long id, Integer type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,19 @@
|
||||||
|
|
||||||
public final class ServerSocketHandler implements Runnable, AutoCloseable {
|
public final class ServerSocketHandler implements Runnable, AutoCloseable {
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
@LauncherAPI
|
|
||||||
boolean onConnect(InetAddress address);
|
boolean onConnect(InetAddress address);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
void onDisconnect(Exception e);
|
void onDisconnect(Exception e);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
boolean onHandshake(long session, Integer type);
|
boolean onHandshake(long session, Integer type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ThreadFactory THREAD_FACTORY = r -> CommonHelper.newThread("Network Thread", true, r);
|
private static final ThreadFactory THREAD_FACTORY = r -> CommonHelper.newThread("Network Thread", true, r);
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public volatile boolean logConnections = Boolean.getBoolean("launcher.logConnections");
|
public volatile boolean logConnections = Boolean.getBoolean("launcher.logConnections");
|
||||||
// Instance
|
// Instance
|
||||||
private final LaunchServer server;
|
private final LaunchServer server;
|
||||||
|
@ -109,7 +109,7 @@ public void run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void setListener(Listener listener) {
|
public void setListener(Listener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public Texture getSkinTexture(UUID uuid, String username, String client) throws
|
||||||
return getProvider().getSkinTexture(uuid, username, client);
|
return getProvider().getSkinTexture(uuid, username, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void setBackend(TextureProvider provider) {
|
public void setBackend(TextureProvider provider) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public abstract class TextureProvider extends ConfigObject implements AutoClosea
|
||||||
private static final Map<String, Adapter<TextureProvider>> TEXTURE_PROVIDERS = new ConcurrentHashMap<>(2);
|
private static final Map<String, Adapter<TextureProvider>> TEXTURE_PROVIDERS = new ConcurrentHashMap<>(2);
|
||||||
private static boolean registredProv = false;
|
private static boolean registredProv = false;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static TextureProvider newProvider(String name, BlockConfigEntry block) {
|
public static TextureProvider newProvider(String name, BlockConfigEntry block) {
|
||||||
VerifyHelper.verifyIDName(name);
|
VerifyHelper.verifyIDName(name);
|
||||||
Adapter<TextureProvider> authHandlerAdapter = VerifyHelper.getMapValue(TEXTURE_PROVIDERS, name,
|
Adapter<TextureProvider> authHandlerAdapter = VerifyHelper.getMapValue(TEXTURE_PROVIDERS, name,
|
||||||
|
@ -24,7 +24,7 @@ public static TextureProvider newProvider(String name, BlockConfigEntry block) {
|
||||||
return authHandlerAdapter.convert(block);
|
return authHandlerAdapter.convert(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void registerProvider(String name, Adapter<TextureProvider> adapter) {
|
public static void registerProvider(String name, Adapter<TextureProvider> adapter) {
|
||||||
VerifyHelper.putIfAbsent(TEXTURE_PROVIDERS, name, Objects.requireNonNull(adapter, "adapter"),
|
VerifyHelper.putIfAbsent(TEXTURE_PROVIDERS, name, Objects.requireNonNull(adapter, "adapter"),
|
||||||
String.format("Texture provider has been already registered: '%s'", name));
|
String.format("Texture provider has been already registered: '%s'", name));
|
||||||
|
@ -41,7 +41,7 @@ public static void registerProviders() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
protected TextureProvider(BlockConfigEntry block) {
|
protected TextureProvider(BlockConfigEntry block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,9 @@ protected TextureProvider(BlockConfigEntry block) {
|
||||||
@Override
|
@Override
|
||||||
public abstract void close() throws IOException;
|
public abstract void close() throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract Texture getCloakTexture(UUID uuid, String username, String client) throws IOException;
|
public abstract Texture getCloakTexture(UUID uuid, String username, String client) throws IOException;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public abstract Texture getSkinTexture(UUID uuid, String username, String client) throws IOException;
|
public abstract Texture getSkinTexture(UUID uuid, String username, String client) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public final class LauncherConfig extends StreamObject {
|
||||||
public static final String ADDRESS_OVERRIDE = System.getProperty(ADDRESS_OVERRIDE_PROPERTY, null);
|
public static final String ADDRESS_OVERRIDE = System.getProperty(ADDRESS_OVERRIDE_PROPERTY, null);
|
||||||
private static final AutogenConfig config = new AutogenConfig();
|
private static final AutogenConfig config = new AutogenConfig();
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static AutogenConfig getAutogenConfig() {
|
public static AutogenConfig getAutogenConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
||||||
public PublicURLClassLoader classloader;
|
public PublicURLClassLoader classloader;
|
||||||
protected ModuleContext context;
|
protected ModuleContext context;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public void autoload(Path dir) throws IOException {
|
public void autoload(Path dir) throws IOException {
|
||||||
LogHelper.info("Load modules");
|
LogHelper.info("Load modules");
|
||||||
if (Files.notExists(dir)) Files.createDirectory(dir);
|
if (Files.notExists(dir)) Files.createDirectory(dir);
|
||||||
|
@ -70,7 +70,7 @@ public void close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void initModules() {
|
public void initModules() {
|
||||||
for (Module m : modules) {
|
for (Module m : modules) {
|
||||||
m.init(context);
|
m.init(context);
|
||||||
|
@ -79,13 +79,13 @@ public void initModules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void load(Module module) {
|
public void load(Module module) {
|
||||||
modules.add(module);
|
modules.add(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void load(Module module, boolean preload) {
|
public void load(Module module, boolean preload) {
|
||||||
load(module);
|
load(module);
|
||||||
if (!preload) module.init(context);
|
if (!preload) module.init(context);
|
||||||
|
@ -93,7 +93,7 @@ public void load(Module module, boolean preload) {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void loadModule(URL jarpath, boolean preload) throws ClassNotFoundException, IllegalAccessException, InstantiationException, URISyntaxException, IOException {
|
public void loadModule(URL jarpath, boolean preload) throws ClassNotFoundException, IllegalAccessException, InstantiationException, URISyntaxException, IOException {
|
||||||
JarFile f = new JarFile(Paths.get(jarpath.toURI()).toString());
|
JarFile f = new JarFile(Paths.get(jarpath.toURI()).toString());
|
||||||
Manifest m = f.getManifest();
|
Manifest m = f.getManifest();
|
||||||
|
@ -103,7 +103,7 @@ public void loadModule(URL jarpath, boolean preload) throws ClassNotFoundExcepti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void loadModule(URL jarpath, String classname, boolean preload) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
public void loadModule(URL jarpath, String classname, boolean preload) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||||
classloader.addURL(jarpath);
|
classloader.addURL(jarpath);
|
||||||
Class<?> moduleclass = Class.forName(classname, true, classloader);
|
Class<?> moduleclass = Class.forName(classname, true, classloader);
|
||||||
|
@ -124,7 +124,7 @@ public void postInitModules() {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void preInitModules() {
|
public void preInitModules() {
|
||||||
for (Module m : modules) {
|
for (Module m : modules) {
|
||||||
m.preInit(context);
|
m.preInit(context);
|
||||||
|
@ -133,7 +133,7 @@ public void preInitModules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void printModules() {
|
public void printModules() {
|
||||||
for (Module m : modules)
|
for (Module m : modules)
|
||||||
LogHelper.info("Module %s version: %s", m.getName(), m.getVersion());
|
LogHelper.info("Module %s version: %s", m.getName(), m.getVersion());
|
||||||
|
@ -141,7 +141,7 @@ public void printModules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@LauncherAPI
|
|
||||||
public void registerModule(Module module, boolean preload) {
|
public void registerModule(Module module, boolean preload) {
|
||||||
load(module, preload);
|
load(module, preload);
|
||||||
LogHelper.info("Module %s version: %s registered", module.getName(), module.getVersion());
|
LogHelper.info("Module %s version: %s registered", module.getName(), module.getVersion());
|
||||||
|
|
|
@ -39,10 +39,8 @@ public static OS byName(String name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MXBeans exports
|
// MXBeans exports
|
||||||
@LauncherAPI
|
|
||||||
public static final RuntimeMXBean RUNTIME_MXBEAN = ManagementFactory.getRuntimeMXBean();
|
public static final RuntimeMXBean RUNTIME_MXBEAN = ManagementFactory.getRuntimeMXBean();
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static final OperatingSystemMXBean OPERATING_SYSTEM_MXBEAN =
|
public static final OperatingSystemMXBean OPERATING_SYSTEM_MXBEAN =
|
||||||
ManagementFactory.getOperatingSystemMXBean();
|
ManagementFactory.getOperatingSystemMXBean();
|
||||||
// System properties
|
// System properties
|
||||||
|
@ -60,10 +58,8 @@ public static OS byName(String name) {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static final SecurityManager SECURITY_MANAGER = System.getSecurityManager();
|
public static final SecurityManager SECURITY_MANAGER = System.getSecurityManager();
|
||||||
// Public static fields
|
// Public static fields
|
||||||
@LauncherAPI
|
|
||||||
public static final Runtime RUNTIME = Runtime.getRuntime();
|
public static final Runtime RUNTIME = Runtime.getRuntime();
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static final ClassLoader LOADER = ClassLoader.getSystemClassLoader();
|
public static final ClassLoader LOADER = ClassLoader.getSystemClassLoader();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -76,18 +72,18 @@ public static OS byName(String name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@LauncherAPI
|
|
||||||
public static void addClassPath(URL url) {
|
public static void addClassPath(URL url) {
|
||||||
throw new IllegalArgumentException("Method Deprecated");
|
throw new IllegalArgumentException("Method Deprecated");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@LauncherAPI
|
|
||||||
public static void addNativePath(Path path) {
|
public static void addNativePath(Path path) {
|
||||||
throw new IllegalArgumentException("Method Deprecated");
|
throw new IllegalArgumentException("Method Deprecated");
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void appendVars(ProcessBuilder builder, Map<String, String> vars) {
|
public static void appendVars(ProcessBuilder builder, Map<String, String> vars) {
|
||||||
builder.environment().putAll(vars);
|
builder.environment().putAll(vars);
|
||||||
}
|
}
|
||||||
|
@ -111,17 +107,17 @@ public static void fullGC() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@LauncherAPI
|
|
||||||
public static Certificate[] getCertificates(String resource) {
|
public static Certificate[] getCertificates(String resource) {
|
||||||
throw new IllegalArgumentException("Method Deprecated");
|
throw new IllegalArgumentException("Method Deprecated");
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static String[] getClassPath() {
|
public static String[] getClassPath() {
|
||||||
return System.getProperty("java.class.path").split(File.pathSeparator);
|
return System.getProperty("java.class.path").split(File.pathSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static URL[] getClassPathURL() {
|
public static URL[] getClassPathURL() {
|
||||||
String[] cp = System.getProperty("java.class.path").split(File.pathSeparator);
|
String[] cp = System.getProperty("java.class.path").split(File.pathSeparator);
|
||||||
URL[] list = new URL[cp.length];
|
URL[] list = new URL[cp.length];
|
||||||
|
@ -175,7 +171,7 @@ public static String systemToJvmProperty(String name) {
|
||||||
return String.format("-D%s=%s", name, System.getProperties().getProperty(name));
|
return String.format("-D%s=%s", name, System.getProperties().getProperty(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static void verifySystemProperties(Class<?> mainClass, boolean requireSystem) {
|
public static void verifySystemProperties(Class<?> mainClass, boolean requireSystem) {
|
||||||
Locale.setDefault(Locale.US);
|
Locale.setDefault(Locale.US);
|
||||||
// Verify class loader
|
// Verify class loader
|
||||||
|
|
Loading…
Reference in a new issue