Skip to content

Commit

Permalink
Fixed #45
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghongxun committed Mar 4, 2016
1 parent 019fcf3 commit 587df1f
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 318 deletions.
129 changes: 0 additions & 129 deletions HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Launcher.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public boolean isAllowedToUseSelfURL() {
public String getParsedLibraryDownloadURL(String str) {
if (str == null)
return null;
else if (str.contains("scala-swing") || str.contains("scala-xml") || str.contains("scala-parser-combinators"))
return str.replace("http://files.minecraftforge.net/maven", "http://ftb.cursecdn.com/FTB2/maven/");
else if (str.contains("typesafe") || str.contains("scala"))
if (SupportedLocales.NOW_LOCALE.self == Locale.CHINA)
return str.replace("http://files.minecraftforge.net/maven", "http://maven.oschina.net/content/groups/public");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.jackhuang.hellominecraft.util.system.Platform;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.util.Utils;
import org.jackhuang.hellominecraft.launcher.Launcher;
import org.jackhuang.hellominecraft.launcher.core.GameException;
import org.jackhuang.hellominecraft.launcher.core.auth.UserProfileProvider;
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
Expand Down Expand Up @@ -130,12 +129,6 @@ else if (jv.getParsedVersion() >= JdkVersion.JAVA_18)

if (OS.os() != OS.WINDOWS)
res.add("-Duser.home=" + gameDir.getParent());

if (!options.isCanceledWrapper()) {
res.add("-cp");
res.add(StrUtils.parseParams("", Utils.getURLString(), File.pathSeparator));
res.add(Launcher.class.getCanonicalName());
}
}

@Override
Expand Down Expand Up @@ -168,9 +161,6 @@ public List<String> makeLaunchingCommand() throws GameException {
if (options.isFullscreen())
res.add("--fullscreen");

if (options.isDebug() && !options.isCanceledWrapper())
res.add("-debug");

if (StrUtils.isNotBlank(options.getProxyHost()) && StrUtils.isNotBlank(options.getProxyPort()) && MathUtils.canParseInt(options.getProxyPort())) {
res.add("--proxyHost");
res.add(options.getProxyHost());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class LaunchOptions {

private String name, versionName, javaArgs, minecraftArgs, maxMemory, permSize, width, height, serverIp, wrapper;
private String proxyHost, proxyPort, proxyUser, proxyPass, javaDir, launchVersion, type, precalledCommand;
private boolean fullscreen, debug, noJVMArgs, canceledWrapper;
private boolean fullscreen, noJVMArgs;
private JdkVersion java;
private File gameDir;
private GameDirType gameDirType;
Expand Down Expand Up @@ -127,14 +127,6 @@ public void setFullscreen(boolean fullscreen) {
this.fullscreen = fullscreen;
}

public boolean isDebug() {
return debug;
}

public void setDebug(boolean debug) {
this.debug = debug;
}

public GameDirType getGameDirType() {
return gameDirType;
}
Expand Down Expand Up @@ -167,14 +159,6 @@ public void setMinecraftArgs(String minecraftArgs) {
this.minecraftArgs = minecraftArgs;
}

public boolean isCanceledWrapper() {
return canceledWrapper;
}

public void setCanceledWrapper(boolean canceledWrapper) {
this.canceledWrapper = canceledWrapper;
}

public String getServerIp() {
return serverIp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,17 @@ public MinecraftLoader(LaunchOptions p, IMinecraftService provider, UserProfileP

@Override
protected void makeSelf(List<String> res) throws GameException {
StringBuilder library = new StringBuilder(options.isCanceledWrapper() ? "" : "-cp=");
StringBuilder library = new StringBuilder("");
for (MinecraftLibrary l : version.libraries)
if (l.allow() && !l.isRequiredToUnzip())
library.append(l.getFilePath(gameDir).getAbsolutePath()).append(File.pathSeparator);
File f = version.getJar(service.baseDirectory());
if (!f.exists())
throw new GameException("Minecraft jar does not exists");
library.append(IOUtils.tryGetCanonicalFilePath(f)).append(File.pathSeparator);
if (options.isCanceledWrapper())
res.add("-cp");
res.add("-cp");
res.add(library.toString().substring(0, library.length() - File.pathSeparator.length()));
String mainClass = version.mainClass;
res.add((options.isCanceledWrapper() ? "" : "-mainClass=") + mainClass);
res.add(version.mainClass);

String[] splitted = StrUtils.tokenize(version.minecraftArguments);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class VersionSetting {

private String javaArgs, minecraftArgs, maxMemory, permSize, width, height;
private String javaDir, precalledCommand, serverIp, java, wrapper;
private boolean fullscreen, debug, noJVMArgs, canceledWrapper;
private boolean fullscreen, noJVMArgs;

/**
* 0 - Close the launcher when the game starts.<br/>
Expand All @@ -59,7 +59,7 @@ public class VersionSetting {
public transient final EventHandler<String> propertyChanged = new EventHandler<>(this);

public VersionSetting() {
debug = fullscreen = canceledWrapper = false;
fullscreen = false;
launcherVisibility = 1;
gameDirType = 0;
javaDir = java = minecraftArgs = serverIp = precalledCommand = wrapper = "";
Expand All @@ -76,11 +76,9 @@ public VersionSetting(VersionSetting v) {
fullscreen = v.fullscreen;
javaArgs = v.javaArgs;
javaDir = v.javaDir;
debug = v.debug;
minecraftArgs = v.minecraftArgs;
permSize = v.permSize;
gameDirType = v.gameDirType;
canceledWrapper = v.canceledWrapper;
noJVMArgs = v.noJVMArgs;
launcherVisibility = v.launcherVisibility;
precalledCommand = v.precalledCommand;
Expand Down Expand Up @@ -193,15 +191,6 @@ public void setFullscreen(boolean fullscreen) {
propertyChanged.execute("fullscreen");
}

public boolean isDebug() {
return debug;
}

public void setDebug(boolean debug) {
this.debug = debug;
propertyChanged.execute("debug");
}

public LauncherVisibility getLauncherVisibility() {
return LauncherVisibility.values()[launcherVisibility];
}
Expand Down Expand Up @@ -249,15 +238,6 @@ public void setMinecraftArgs(String minecraftArgs) {
propertyChanged.execute("minecraftArgs");
}

public boolean isCanceledWrapper() {
return canceledWrapper;
}

public void setCanceledWrapper(boolean canceledWrapper) {
this.canceledWrapper = canceledWrapper;
propertyChanged.execute("canceledWrapper");
}

public String getPrecalledCommand() {
return precalledCommand;
}
Expand Down Expand Up @@ -287,8 +267,6 @@ public void setServerIp(String serverIp) {

public LaunchOptions createLaunchOptions(File gameDir) {
LaunchOptions x = new LaunchOptions();
x.setCanceledWrapper(isCanceledWrapper());
x.setDebug(isDebug());
x.setFullscreen(isFullscreen());
x.setWrapper(getWrapper());
x.setGameDir(gameDir);
Expand Down
Loading

0 comments on commit 587df1f

Please sign in to comment.