mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Fix[datedetect]: Read original release date instead of the modded release date
This commit is contained in:
parent
ce145b50e9
commit
b021a1fd5c
@ -82,13 +82,10 @@ import java.lang.ref.WeakReference;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@SuppressWarnings("IOStreamConstructor")
|
@SuppressWarnings("IOStreamConstructor")
|
||||||
@ -346,11 +343,11 @@ public final class Tools {
|
|||||||
|
|
||||||
String userType = "mojang";
|
String userType = "mojang";
|
||||||
try {
|
try {
|
||||||
Date creationDate = DateUtils.parseReleaseDate(versionInfo.releaseTime);
|
Date creationDate = DateUtils.getOriginalReleaseDate(versionInfo);
|
||||||
// Minecraft 22w43a which adds chat reporting (and signing) was released on
|
// Minecraft 22w43a which adds chat reporting (and signing) was released on
|
||||||
// 26th October 2022. So, if the date is not before that (meaning it is equal or higher)
|
// 26th October 2022. So, if the date is not before that (meaning it is equal or higher)
|
||||||
// change the userType to MSA to fix the missing signature
|
// change the userType to MSA to fix the missing signature
|
||||||
if(creationDate != null && !DateUtils.dateBefore(creationDate, 2022, 10, 26)) {
|
if(creationDate != null && !DateUtils.dateBefore(creationDate, 2022, 9, 26)) {
|
||||||
userType = "msa";
|
userType = "msa";
|
||||||
}
|
}
|
||||||
}catch (ParseException e) {
|
}catch (ParseException e) {
|
||||||
|
@ -4,6 +4,9 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import net.kdt.pojavlaunch.JMinecraftVersionList;
|
||||||
|
import net.kdt.pojavlaunch.Tools;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -41,4 +44,21 @@ public class DateUtils {
|
|||||||
Log.i("DateUtils","isBefore:"+date.before(comparsionDate));
|
Log.i("DateUtils","isBefore:"+date.before(comparsionDate));
|
||||||
return date.before(comparsionDate);
|
return date.before(comparsionDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the original release date of a game version, ignoring any mods (if present)
|
||||||
|
* @param gameVersion the JMinecraftVersionList.Version object
|
||||||
|
* @return the game's original release date
|
||||||
|
*/
|
||||||
|
public static Date getOriginalReleaseDate(JMinecraftVersionList.Version gameVersion) throws ParseException {
|
||||||
|
if(Tools.isValidString(gameVersion.inheritsFrom)) {
|
||||||
|
gameVersion = Tools.getVersionInfo(gameVersion.inheritsFrom, true);
|
||||||
|
}else {
|
||||||
|
// The launcher's inheritor mutilates the version object, causing it to have the original
|
||||||
|
// version's ID but modded version's dates. Work around it by re-reading the version without
|
||||||
|
// inheriting.
|
||||||
|
gameVersion = Tools.getVersionInfo(gameVersion.id, true);
|
||||||
|
}
|
||||||
|
return parseReleaseDate(gameVersion.releaseTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import net.kdt.pojavlaunch.extra.ExtraCore;
|
|||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
|
|
||||||
/** Class here to help with various stuff to help run lower versions smoothly */
|
/** Class here to help with various stuff to help run lower versions smoothly */
|
||||||
public class OldVersionsUtils {
|
public class OldVersionsUtils {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user