Skip to content

Commit

Permalink
optimized code - path management
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarx committed Sep 4, 2016
1 parent f5b6525 commit abff914
Showing 1 changed file with 16 additions and 42 deletions.
58 changes: 16 additions & 42 deletions src/tagapi_3/Local.java
Original file line number Diff line number Diff line change
Expand Up @@ -616,58 +616,45 @@ public String[] generateMinecraftArguments(String OS, String auth_player_name, S
//the above will change it to single space.
//split it to String and move it to ArrayList
String[] tempArgsSplit = cmdArgs.split(" ");
for (int i =0; i<tempArgsSplit.length;i++)
{
if (tempArgsSplit[i].equals("${auth_player_name}"))
{
for (int i = 0; i < tempArgsSplit.length; i++) {
if (tempArgsSplit[i].equals("${auth_player_name}")) {
tempArgsSplit[i] = auth_player_name;
}
if (tempArgsSplit[i].equals("${version_name}"))
{
if (tempArgsSplit[i].equals("${version_name}")) {
tempArgsSplit[i] = version_name;
}
if (tempArgsSplit[i].equals("${game_directory}"))
{
if (tempArgsSplit[i].equals("${game_directory}")) {
tempArgsSplit[i] = game_directory;
}
if (tempArgsSplit[i].equals("${assets_root}"))
{
if (tempArgsSplit[i].equals("${assets_root}")) {
tempArgsSplit[i] = assets_root;
}
if (tempArgsSplit[i].equals("${assets_index_name}"))
{
if (tempArgsSplit[i].equals("${assets_index_name}")) {
tempArgsSplit[i] = assets_index_name;
}
if (tempArgsSplit[i].equals("${auth_uuid}"))
{
if (tempArgsSplit[i].equals("${auth_uuid}")) {
tempArgsSplit[i] = auth_uuid;
}
if (tempArgsSplit[i].equals("${auth_access_token}"))
{
if (tempArgsSplit[i].equals("${auth_access_token}")) {
tempArgsSplit[i] = auth_access_token;
}
if (tempArgsSplit[i].equals("${user_properties}"))
{
if (tempArgsSplit[i].equals("${user_properties}")) {
tempArgsSplit[i] = user_properties;
}
if (tempArgsSplit[i].equals("${user_type}"))
{
if (tempArgsSplit[i].equals("${user_type}")) {
tempArgsSplit[i] = user_type;
}
if (tempArgsSplit[i].equals("${version_type}"))
{
if (tempArgsSplit[i].equals("${version_type}")) {
tempArgsSplit[i] = version_type;
}
if (tempArgsSplit[i].equals("${game_assets}"))
{
if (tempArgsSplit[i].equals("${game_assets}")) {
tempArgsSplit[i] = game_assets;
}
if (tempArgsSplit[i].equals("${auth_session}"))
{
if (tempArgsSplit[i].equals("${auth_session}")) {
tempArgsSplit[i] = auth_session;
}
}

return tempArgsSplit;
}

Expand All @@ -676,25 +663,12 @@ public String generateLibrariesArguments(String OS) {
Utils utils = new Utils();
for (int i = 0; i < libraries_path.size(); i++) {
if (i == libraries_path.size() - 1) {
if (OS.equals("Linux")) {
cp = cp + libraries_path.get(i).toString().replace(" ", "%20");

} else if (OS.equals("Mac")) {
cp = cp + libraries_path.get(i).toString();

} else {
//for dirty windows
cp = cp + "\"" + libraries_path.get(i).toString() + "\"";
}
} else if (OS.equals("Linux")) {
cp = cp + libraries_path.get(i).toString().replace(" ", "%20") + utils.getArgsDiv(OS);
cp = cp + libraries_path.get(i).toString();

} else if (OS.equals("Mac")) {
} else {
cp = cp + libraries_path.get(i).toString() + utils.getArgsDiv(OS);

} else {
//for dirty windows
cp = cp + "\"" + libraries_path.get(i).toString() + "\"" + utils.getArgsDiv(OS);
}
}
return cp;
Expand Down

0 comments on commit abff914

Please sign in to comment.