fix(profile): 在用户不存在正版账号的情况下不允许进行离线以及第三方登录 (#1917)

This commit is contained in:
tangge233
2025-11-20 22:01:20 +08:00
committed by GitHub
parent ce55cea5f0
commit efcd2b9333
4 changed files with 36 additions and 50 deletions

View File

@@ -247,7 +247,6 @@ Public Class FormMain
Catch ex As Exception
Log(ex, "清理自动更新文件失败")
End Try
GetCoR() '获取区域限制状态
GetSystemInfo()
End Sub, "Start Loader", ThreadPriority.Lowest)

View File

@@ -2034,15 +2034,6 @@ RetryDir:
Inherits Exception
End Class
Public IsRestrictedFeatAllowed As Boolean = False
''' <summary>
''' 获取区域限制状态,用于判断是否允许使用部分区域限制功能。
''' </summary>
Public Sub GetCoR()
If TimeZoneInfo.Local.Id = "China Standard Time" AndAlso
(CultureInfo.CurrentCulture.Name = "zh-CN" OrElse CultureInfo.CurrentUICulture.Name = "zh-CN") Then IsRestrictedFeatAllowed = True
End Sub
Private Uuid As Integer = 1
Private UuidLock As Object
''' <summary>

View File

@@ -293,31 +293,15 @@ NextInner:
End If
#End If
'正版购买提示
If CurrentLaunchOptions?.SaveBatch Is Nothing AndAlso '保存脚本时不提示
Not Setup.Get("HintBuy") AndAlso SelectedProfile.Type <> McLoginType.Ms Then
If IsRestrictedFeatAllowed Then
RunInNewThread(
Sub()
Select Case Setup.Get("SystemLaunchCount")
Case 3, 8, 15, 30, 50, 70, 90, 110, 130, 180, 220, 280, 330, 380, 450, 550, 660, 750, 880, 950, 1100, 1300, 1500, 1700, 1900
If MyMsgBox("你已经启动了 " & Setup.Get("SystemLaunchCount") & " 次 Minecraft 啦!" & vbCrLf &
"如果觉得 Minecraft 还不错,可以购买正版支持一下,毕竟开发游戏也真的很不容易……不要一直白嫖啦。" & vbCrLf & vbCrLf &
"在登录一次正版账号后,就不会再出现这个提示了!",
"考虑一下正版?", "支持正版游戏!", "下次一定") = 1 Then
OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj")
End If
End Select
End Sub, "Buy Minecraft")
Else
Select Case MyMsgBox("你必须先登录正版账号才能启动游戏!", "正版验证", "购买正版", "试玩", "返回",
If Not ProfileList.Any(Function(x) x.Type = McLoginType.Ms) Then
Select Case MyMsgBox("你必须先登录正版账号才能启动游戏!", "正版验证", "购买正版", "试玩", "返回",
Button1Action:=Sub() OpenWebsite("https://www.xbox.com/zh-cn/games/store/minecraft-java-bedrock-edition-for-pc/9nxp44l49shj"))
Case 2
Hint("游戏将以试玩模式启动!", HintType.Critical)
CurrentLaunchOptions.ExtraArgs.Add("--demo")
Case 3
Throw New Exception("$$")
End Select
End If
Case 2
Hint("游戏将以试玩模式启动!", HintType.Critical)
CurrentLaunchOptions.ExtraArgs.Add("--demo")
Case 3
Throw New Exception("$$")
End Select
End If
End Sub
@@ -594,7 +578,6 @@ SkipLogin:
'结束
McLoginMsRefreshTime = TimeUtils.GetTimeTick()
ProfileLog("正版验证完成")
Setup.Set("HintBuy", True) '关闭正版购买提示
If IsSkipAuth Then
Data.Progress = 0.99
Data.Output = New McLoginResult With {.AccessToken = SelectedProfile.AccessToken,

View File

@@ -1,6 +1,7 @@
Imports System.Net.Http
Imports System.Security.Cryptography
Imports System.IO
Imports PCL.Core.App
Public Module ModProfile
@@ -231,23 +232,35 @@ Public Module ModProfile
Public Sub CreateProfile()
Dim selectedAuthTypeNum As Integer? = Nothing '验证类型序号
RunInUiWait(Sub()
Dim authTypeList As New List(Of IMyRadio) From {
Dim authTypeList As List(Of IMyRadio)
If ProfileList.Any(Function(x) x.Type = McLoginType.Ms) Then
authTypeList = New List(Of IMyRadio) From
{
New MyListItem With {
.Title = "正版验证",
.Type = MyListItem.CheckType.RadioBox,
.Logo = Logo.IconButtonAuth
},
.Title = "正版验证",
.Type = MyListItem.CheckType.RadioBox,
.Logo = Logo.IconButtonAuth
}, New MyListItem With {
.Title = "第三方验证",
.Type = MyListItem.CheckType.RadioBox,
.Logo = Logo.IconButtonThirdparty
},
New MyListItem With {
.Title = "第三方验证",
.Type = MyListItem.CheckType.RadioBox,
.Logo = Logo.IconButtonThirdparty
},
New MyListItem With {
.Title = "离线验证",
.Type = MyListItem.CheckType.RadioBox,
.Logo = Logo.IconButtonOffline
.Title = "离线验证",
.Type = MyListItem.CheckType.RadioBox,
.Logo = Logo.IconButtonOffline
}
}
}
Else
authTypeList = New List(Of IMyRadio) From
{
New MyListItem With {
.Title = "正版验证",
.Type = MyListItem.CheckType.RadioBox,
.Logo = Logo.IconButtonAuth
}
}
End If
selectedAuthTypeNum = MyMsgBoxSelect(authTypeList, "新建档案 - 选择验证类型", "继续", "取消")
End Sub)
If selectedAuthTypeNum Is Nothing Then Exit Sub
@@ -715,7 +728,7 @@ Retry:
Next
Throw New Exception("未知错误(" & res & "")
Catch ex As Exception
If ex.GetType.Equals(GetType(Tasks.TaskCanceledException)) Then
If ex.GetType.Equals(GetType(TaskCanceledException)) Then
Hint("更改皮肤失败:与 Mojang 皮肤服务器的连接超时,请检查你的网络是否通畅!", HintType.Critical)
Else
Log(ex, "更改皮肤失败", LogLevel.Hint)