Skip to content

Commit abff914

Browse files
committed
optimized code - path management
1 parent f5b6525 commit abff914

1 file changed

Lines changed: 16 additions & 42 deletions

File tree

src/tagapi_3/Local.java

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -616,58 +616,45 @@ public String[] generateMinecraftArguments(String OS, String auth_player_name, S
616616
//the above will change it to single space.
617617
//split it to String and move it to ArrayList
618618
String[] tempArgsSplit = cmdArgs.split(" ");
619-
for (int i =0; i<tempArgsSplit.length;i++)
620-
{
621-
if (tempArgsSplit[i].equals("${auth_player_name}"))
622-
{
619+
for (int i = 0; i < tempArgsSplit.length; i++) {
620+
if (tempArgsSplit[i].equals("${auth_player_name}")) {
623621
tempArgsSplit[i] = auth_player_name;
624622
}
625-
if (tempArgsSplit[i].equals("${version_name}"))
626-
{
623+
if (tempArgsSplit[i].equals("${version_name}")) {
627624
tempArgsSplit[i] = version_name;
628625
}
629-
if (tempArgsSplit[i].equals("${game_directory}"))
630-
{
626+
if (tempArgsSplit[i].equals("${game_directory}")) {
631627
tempArgsSplit[i] = game_directory;
632628
}
633-
if (tempArgsSplit[i].equals("${assets_root}"))
634-
{
629+
if (tempArgsSplit[i].equals("${assets_root}")) {
635630
tempArgsSplit[i] = assets_root;
636631
}
637-
if (tempArgsSplit[i].equals("${assets_index_name}"))
638-
{
632+
if (tempArgsSplit[i].equals("${assets_index_name}")) {
639633
tempArgsSplit[i] = assets_index_name;
640634
}
641-
if (tempArgsSplit[i].equals("${auth_uuid}"))
642-
{
635+
if (tempArgsSplit[i].equals("${auth_uuid}")) {
643636
tempArgsSplit[i] = auth_uuid;
644637
}
645-
if (tempArgsSplit[i].equals("${auth_access_token}"))
646-
{
638+
if (tempArgsSplit[i].equals("${auth_access_token}")) {
647639
tempArgsSplit[i] = auth_access_token;
648640
}
649-
if (tempArgsSplit[i].equals("${user_properties}"))
650-
{
641+
if (tempArgsSplit[i].equals("${user_properties}")) {
651642
tempArgsSplit[i] = user_properties;
652643
}
653-
if (tempArgsSplit[i].equals("${user_type}"))
654-
{
644+
if (tempArgsSplit[i].equals("${user_type}")) {
655645
tempArgsSplit[i] = user_type;
656646
}
657-
if (tempArgsSplit[i].equals("${version_type}"))
658-
{
647+
if (tempArgsSplit[i].equals("${version_type}")) {
659648
tempArgsSplit[i] = version_type;
660649
}
661-
if (tempArgsSplit[i].equals("${game_assets}"))
662-
{
650+
if (tempArgsSplit[i].equals("${game_assets}")) {
663651
tempArgsSplit[i] = game_assets;
664652
}
665-
if (tempArgsSplit[i].equals("${auth_session}"))
666-
{
653+
if (tempArgsSplit[i].equals("${auth_session}")) {
667654
tempArgsSplit[i] = auth_session;
668655
}
669656
}
670-
657+
671658
return tempArgsSplit;
672659
}
673660

@@ -676,25 +663,12 @@ public String generateLibrariesArguments(String OS) {
676663
Utils utils = new Utils();
677664
for (int i = 0; i < libraries_path.size(); i++) {
678665
if (i == libraries_path.size() - 1) {
679-
if (OS.equals("Linux")) {
680-
cp = cp + libraries_path.get(i).toString().replace(" ", "%20");
681-
682-
} else if (OS.equals("Mac")) {
683-
cp = cp + libraries_path.get(i).toString();
684666

685-
} else {
686-
//for dirty windows
687-
cp = cp + "\"" + libraries_path.get(i).toString() + "\"";
688-
}
689-
} else if (OS.equals("Linux")) {
690-
cp = cp + libraries_path.get(i).toString().replace(" ", "%20") + utils.getArgsDiv(OS);
667+
cp = cp + libraries_path.get(i).toString();
691668

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

695-
} else {
696-
//for dirty windows
697-
cp = cp + "\"" + libraries_path.get(i).toString() + "\"" + utils.getArgsDiv(OS);
698672
}
699673
}
700674
return cp;

0 commit comments

Comments
 (0)