Change the default authenticated token to 0
This commit is contained in:
@@ -80,7 +80,6 @@ public abstract class IMinecraftLoader {
|
||||
res.addAll(Arrays.asList(StrUtils.tokenize(v.getJavaArgs())));
|
||||
|
||||
if (!v.isNoJVMArgs() && !(jv != null && jv.isEarlyAccess())) {
|
||||
//res.add("-Xincgc");
|
||||
res.add("-XX:+UseConcMarkSweepGC");
|
||||
res.add("-XX:+CMSIncrementalMode");
|
||||
res.add("-XX:-UseAdaptiveSizePolicy");
|
||||
@@ -107,14 +106,14 @@ public abstract class IMinecraftLoader {
|
||||
}
|
||||
|
||||
if (!StrUtils.isBlank(v.getPermSize()) && !v.isNoJVMArgs())
|
||||
if (jv != null && jv.getVersion() != null && (jv.getVersion().startsWith("1.8") || jv.getVersion().startsWith("1.9")));
|
||||
if (jv != null && jv.getParsedVersion() >= JdkVersion.JAVA_18);
|
||||
else res.add("-XX:MaxPermSize=" + v.getPermSize() + "m");
|
||||
|
||||
if (!v.isNoJVMArgs()) appendJVMArgs(res);
|
||||
|
||||
HMCLog.log("On making java.library.path.");
|
||||
|
||||
res.add("-Djava.library.path=" + provider.getDecompressNativesToLocation().getPath());//v.getSelectedMinecraftVersion().getNatives(v.getCanonicalGameDirFile()));
|
||||
res.add("-Djava.library.path=" + provider.getDecompressNativesToLocation().getPath());
|
||||
res.add("-Dfml.ignoreInvalidMinecraftCertificates=true");
|
||||
res.add("-Dfml.ignorePatchDiscrepancies=true");
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class OfflineAuthenticator extends IAuthenticator {
|
||||
String uuid = getUUIDFromUserName(info.username);
|
||||
result.setSession(uuid);
|
||||
result.setUserId(uuid);
|
||||
result.setAccessToken("${auth_access_token}");
|
||||
result.setAccessToken("0");
|
||||
result.setUserType("Legacy");
|
||||
result.setErrorReason(C.i18n("login.no_Player007"));
|
||||
return result;
|
||||
|
||||
@@ -45,12 +45,12 @@ public final class YggdrasilAuthenticator extends IAuthenticator {
|
||||
public YggdrasilAuthenticator(String clientToken) {
|
||||
super(clientToken);
|
||||
service = new YggdrasilAuthenticationService(Proxy.NO_PROXY, clientToken);
|
||||
ua = (YggdrasilUserAuthentication)service.createUserAuthentication(Agent.MINECRAFT);
|
||||
ua = (YggdrasilUserAuthentication) service.createUserAuthentication(Agent.MINECRAFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserProfileProvider login(LoginInfo info) {
|
||||
if(ua.canPlayOnline()) {
|
||||
if (ua.canPlayOnline()) {
|
||||
UserProfileProvider result = new UserProfileProvider();
|
||||
result.setUserName(info.username);
|
||||
result.setSuccess(true);
|
||||
@@ -64,46 +64,45 @@ public final class YggdrasilAuthenticator extends IAuthenticator {
|
||||
}
|
||||
UserProfileProvider result = new UserProfileProvider();
|
||||
String usr = info.username;
|
||||
if(info.username == null || !info.username.contains("@")) {
|
||||
if (info.username == null || !info.username.contains("@")) {
|
||||
result.setSuccess(false);
|
||||
result.setErrorReason(C.i18n("login.not_email"));
|
||||
return result;
|
||||
}
|
||||
String pwd = info.password;
|
||||
|
||||
if(!ua.isLoggedIn())
|
||||
if (!ua.isLoggedIn())
|
||||
ua.setPassword(pwd);
|
||||
ua.setUsername(usr);
|
||||
try {
|
||||
ua.logIn();
|
||||
if(!ua.isLoggedIn()) throw new Exception(C.i18n("login.wrong_password"));
|
||||
if (!ua.isLoggedIn()) throw new Exception(C.i18n("login.wrong_password"));
|
||||
GameProfile selectedProfile = ua.getSelectedProfile();
|
||||
GameProfile[] profiles = ua.getAvailableProfiles();
|
||||
String[] names;
|
||||
String username;
|
||||
if(selectedProfile == null) {
|
||||
if(ArrayUtils.isNotEmpty(profiles)) {
|
||||
if (selectedProfile == null)
|
||||
if (ArrayUtils.isNotEmpty(profiles)) {
|
||||
names = new String[profiles.length];
|
||||
for(int i = 0; i < profiles.length; i++) {
|
||||
for (int i = 0; i < profiles.length; i++)
|
||||
names[i] = profiles[i].getName();
|
||||
}
|
||||
Selector s = new Selector(null, names, C.i18n("login.choose_charactor"));
|
||||
s.setVisible(true);
|
||||
selectedProfile = profiles[s.sel];
|
||||
username = names[s.sel];
|
||||
} else {
|
||||
} else
|
||||
username = JOptionPane.showInputDialog(C.i18n("login.no_charactor"));
|
||||
}
|
||||
} else {
|
||||
else
|
||||
username = selectedProfile.getName();
|
||||
}
|
||||
result.setUserName(username);
|
||||
result.setSuccess(true);
|
||||
result.setUserId(selectedProfile == null ? OfflineAuthenticator.getUUIDFromUserName(username) : UUIDTypeAdapter.fromUUID(selectedProfile.getId()));
|
||||
result.setUserProperties(new GsonBuilder().registerTypeAdapter(PropertyMap.class, new LegacyPropertyMapSerializer()).create().toJson(ua.getUserProperties()));
|
||||
result.setUserPropertyMap(new GsonBuilder().registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create().toJson(ua.getUserProperties()));
|
||||
result.setAccessToken(ua.getAuthenticatedToken());
|
||||
result.setSession(ua.getAuthenticatedToken());
|
||||
String authToken = ua.getAuthenticatedToken();
|
||||
if (authToken == null) authToken = "0";
|
||||
result.setAccessToken(authToken);
|
||||
result.setSession(authToken);
|
||||
result.setUserType(ua.getUserType().getName());
|
||||
} catch (Exception ex) {
|
||||
result.setErrorReason(ex.getMessage());
|
||||
@@ -131,7 +130,7 @@ public final class YggdrasilAuthenticator extends IAuthenticator {
|
||||
}
|
||||
|
||||
public void onLoadSettings(Map settings) {
|
||||
if(settings == null) return;
|
||||
if (settings == null) return;
|
||||
ua.loadFromStorage(settings);
|
||||
}
|
||||
|
||||
@@ -140,7 +139,7 @@ public final class YggdrasilAuthenticator extends IAuthenticator {
|
||||
UserProfileProvider info = new UserProfileProvider();
|
||||
try {
|
||||
ua.logIn();
|
||||
if(!ua.isLoggedIn()) throw new Exception(C.i18n("login.wrong_password"));
|
||||
if (!ua.isLoggedIn()) throw new Exception(C.i18n("login.wrong_password"));
|
||||
GameProfile profile = ua.getSelectedProfile();
|
||||
info.setUserName(profile.getName());
|
||||
info.setSuccess(true);
|
||||
|
||||
@@ -417,7 +417,6 @@
|
||||
<Component class="javax.swing.JTextField" name="txtJavaDir">
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="txtJavaDirFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtJavaDirActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel11">
|
||||
|
||||
@@ -420,11 +420,6 @@ public class GameSettingsPanel extends javax.swing.JPanel {
|
||||
txtJavaDirFocusLost(evt);
|
||||
}
|
||||
});
|
||||
txtJavaDir.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
txtJavaDirActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel11.setText(bundle.getString("settings.java_dir")); // NOI18N
|
||||
|
||||
@@ -948,7 +943,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
}//GEN-LAST:event_btnRefreshVersionsActionPerformed
|
||||
|
||||
private void btnRefreshForgeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshForgeActionPerformed
|
||||
forge.refreshVersions();//refreshForgeVersions();
|
||||
forge.refreshVersions();
|
||||
}//GEN-LAST:event_btnRefreshForgeActionPerformed
|
||||
|
||||
private void btnDownloadForgeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadForgeActionPerformed
|
||||
@@ -1130,10 +1125,6 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
|
||||
profile.setMaxMemory(txtMaxMemory.getText());
|
||||
}//GEN-LAST:event_txtMaxMemoryFocusLost
|
||||
|
||||
private void txtJavaDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtJavaDirActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_txtJavaDirActionPerformed
|
||||
|
||||
private void txtJavaDirFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtJavaDirFocusLost
|
||||
profile.setJavaDir(txtJavaDir.getText());
|
||||
}//GEN-LAST:event_txtJavaDirFocusLost
|
||||
|
||||
@@ -44,6 +44,10 @@ public final class JdkVersion {
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public int getParsedVersion() {
|
||||
return parseVersion(getVersion());
|
||||
}
|
||||
/**
|
||||
* -1 - unkown 0 - 32Bit 1 - 64Bit
|
||||
*/
|
||||
@@ -79,10 +83,6 @@ public final class JdkVersion {
|
||||
* Constant identifying the 1.5 JVM (Java 5).
|
||||
*/
|
||||
public static final int UNKOWN = 2;
|
||||
/**
|
||||
* Constant identifying the 1.5 JVM (Java 5).
|
||||
*/
|
||||
public static final int JAVA_15 = 2;
|
||||
/**
|
||||
* Constant identifying the 1.6 JVM (Java 6).
|
||||
*/
|
||||
@@ -106,17 +106,21 @@ public final class JdkVersion {
|
||||
static {
|
||||
javaVersion = System.getProperty("java.version");
|
||||
// version String should look like "1.4.2_10"
|
||||
majorJavaVersion = parseVersion(javaVersion);
|
||||
}
|
||||
|
||||
private static int parseVersion(String javaVersion) {
|
||||
if(StrUtils.isBlank(javaVersion)) return UNKOWN;
|
||||
int a = UNKOWN;
|
||||
if (javaVersion.contains("1.9."))
|
||||
majorJavaVersion = JAVA_18;
|
||||
a = JAVA_19;
|
||||
else if (javaVersion.contains("1.8."))
|
||||
majorJavaVersion = JAVA_18;
|
||||
a = JAVA_18;
|
||||
else if (javaVersion.contains("1.7."))
|
||||
majorJavaVersion = JAVA_17;
|
||||
a = JAVA_17;
|
||||
else if (javaVersion.contains("1.6."))
|
||||
majorJavaVersion = JAVA_16;
|
||||
else
|
||||
// else leave 1.5 as default (it's either 1.5 or unknown)
|
||||
majorJavaVersion = JAVA_15;
|
||||
a = JAVA_16;
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,22 +152,6 @@ public final class JdkVersion {
|
||||
return majorJavaVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to determine if the current JVM is at least Java 1.6
|
||||
* (Java 6).
|
||||
*
|
||||
* @return <code>true</code> if the current JVM is at least Java 1.6
|
||||
* @deprecated as of Spring 3.0, in favor of reflective checks for the
|
||||
* specific Java 1.6 classes of interest
|
||||
* @see #getMajorJavaVersion()
|
||||
* @see #JAVA_16
|
||||
* @see #JAVA_17
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isAtLeastJava16() {
|
||||
return (majorJavaVersion >= JAVA_16);
|
||||
}
|
||||
|
||||
public static boolean isJava64Bit() {
|
||||
String jdkBit = System.getProperty("sun.arch.data.model");
|
||||
return jdkBit.contains("64");
|
||||
@@ -217,6 +205,6 @@ public final class JdkVersion {
|
||||
}
|
||||
|
||||
public boolean isEarlyAccess() {
|
||||
return ver != null && ver.endsWith("-ea");
|
||||
return getVersion() != null && getVersion().endsWith("-ea");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user