فهرست منبع

添加微软登陆方法

Snow 1 سال پیش
والد
کامیت
f9cdcc53f8

+ 9 - 15
.idea/artifacts/SNGL_FX17_jar.xml

@@ -5,53 +5,47 @@
       <element id="module-output" name="SNGL-FX17" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-controls:mac-aarch64:21-ea+17" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/modules/ehcache-core/3.10.8/ehcache-core-3.10.8.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc/3.1.4/jmccc-3.1.4.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.glassfish.jaxb:txw2:3.0.0-M5" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/modules/ehcache-api/3.10.8/ehcache-api-3.10.8.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.glassfish.jaxb:jaxb-runtime:3.0.0-M5" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/core5/httpcore5/5.2/httpcore5-5.2.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/commons/commons-compress/1.22/commons-compress-1.22.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: com.sun.istack:istack-commons-runtime:4.0.0" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/core5/httpcore5-h2/5.2/httpcore5-h2-5.2.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:mac-aarch64:21-ea+17" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-mojang-api/3.1.4/jmccc-mojang-api-3.1.4.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/javax/cache/cache-api/1.1.1/cache-api-1.1.1.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-yggdrasil-authenticator/3.1.4/jmccc-yggdrasil-authenticator-3.1.4.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-fxml:mac-aarch64:21-ea+17" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/terracotta/terracotta-utilities-tools/0.0.15/terracotta-utilities-tools-0.0.15.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-microsoft-authenticator/3.1.4/jmccc-microsoft-authenticator-3.1.4.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.apache.httpcomponents:httpcore:4.4.16" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-base:21-ea+17" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/terracotta/statistics/2.1.2/statistics-2.1.2.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-graphics:21-ea+17" />
       <element id="library" level="project" name="Maven: com.sun.activation:jakarta.activation:2.0.0" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpasyncclient/4.1.5/httpasyncclient-4.1.5.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/tukaani/xz/1.9/xz-1.9.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-fxml:21-ea+17" />
       <element id="library" level="project" name="Maven: org.glassfish.jaxb:jaxb-core:3.0.0-M5" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/github/mkpaz/atlantafx-base/2.0.0/atlantafx-base-2.0.0.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.16" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/client5/httpclient5-fluent/5.2.1/httpclient5-fluent-5.2.1.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.10.0/jna-platform-5.10.0.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/sizeof/0.4.3/sizeof-0.4.3.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/github/oshi/oshi-core/5.8.6/oshi-core-5.8.6.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/terracotta/offheap-store/2.5.3/offheap-store-2.5.3.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/httpcomponents/client5/httpclient5/5.2.1/httpclient5-5.2.1.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/log4j/log4j/1.2.17/log4j-1.2.17.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-codec/commons-codec/1.11/commons-codec-1.11.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-controls:21-ea+17" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ehcache/modules/ehcache-impl/3.10.8/ehcache-impl-3.10.8.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/cn/hutool/hutool-all/5.6.0/hutool-all-5.6.0.jar" path-in-jar="/" />
-      <element id="extracted-dir" path="$MAVEN_REPOSITORY$/dev/3-3/jmccc-mcdownloader/3.1.4/jmccc-mcdownloader-3.1.4.jar" path-in-jar="/" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.10.0/jna-5.10.0.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.ehcache:ehcache:3.10.0" />
       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/ow2/asm/asm/9.4/asm-9.4.jar" path-in-jar="/" />
       <element id="library" level="project" name="Maven: org.openjfx:javafx-base:mac-aarch64:21-ea+17" />
       <element id="library" level="project" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:3.0.0" />
+      <element id="library" level="project" name="Maven: dev.3-3:jmccc-microsoft-authenticator:3.1.4" />
+      <element id="library" level="project" name="Maven: dev.3-3:jmccc-mcdownloader:3.1.4" />
+      <element id="library" level="project" name="Maven: dev.3-3:jmccc:3.1.4" />
+      <element id="library" level="project" name="Maven: dev.3-3:jmccc-yggdrasil-authenticator:3.1.4" />
+      <element id="library" level="project" name="Maven: log4j:log4j:1.2.17" />
+      <element id="library" level="project" name="Maven: org.slf4j:slf4j-api:1.7.32" />
+      <element id="library" level="project" name="Maven: dev.3-3:jmccc-mojang-api:3.1.4" />
+      <element id="library" level="project" name="Maven: com.google.code.gson:gson:2.10.1" />
+      <element id="library" level="project" name="Maven: cn.hutool:hutool-all:5.6.0" />
     </root>
   </artifact>
 </component>

+ 18 - 47
pom.xml

@@ -43,31 +43,6 @@
             <artifactId>atlantafx-base</artifactId>
             <version>2.0.0</version>
         </dependency>
-        <dependency>
-            <groupId>dev.3-3</groupId>
-            <artifactId>jmccc</artifactId>
-            <version>3.1.4</version>
-        </dependency>
-        <dependency>
-            <groupId>dev.3-3</groupId>
-            <artifactId>jmccc-microsoft-authenticator</artifactId>
-            <version>3.1.4</version>
-        </dependency>
-        <dependency>
-            <groupId>dev.3-3</groupId>
-            <artifactId>jmccc-mcdownloader</artifactId>
-            <version>3.1.4</version>
-        </dependency>
-        <dependency>
-            <groupId>dev.3-3</groupId>
-            <artifactId>jmccc-mojang-api</artifactId>
-            <version>3.1.4</version>
-        </dependency>
-        <dependency>
-            <groupId>dev.3-3</groupId>
-            <artifactId>jmccc-mcdownloader</artifactId>
-            <version>3.1.4</version>
-        </dependency>
         <dependency>
             <groupId>com.github.oshi</groupId>
             <artifactId>oshi-core</artifactId>
@@ -78,28 +53,6 @@
             <artifactId>hutool-all</artifactId>
             <version>5.6.0</version>
         </dependency>
-
-        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.17</version>
-        </dependency>
-        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
-        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-api</artifactId>
-            <version>2.21.1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.logging.log4j</groupId>
-            <artifactId>log4j-slf4j-impl</artifactId>
-            <version>2.21.1</version>
-            <scope>test</scope>
-        </dependency>
-
         <dependency>
             <groupId>org.ehcache</groupId>
             <artifactId>ehcache</artifactId>
@@ -123,6 +76,24 @@
             <artifactId>httpcore-nio</artifactId>
             <version>4.4.16</version>
         </dependency>
+        <dependency>
+            <groupId> org.apache.cassandra</groupId>
+            <artifactId>cassandra-all</artifactId>
+            <version>0.8.1</version>
+
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+            </exclusions>
+
+        </dependency>
+
 
     </dependencies>
 

+ 4 - 3
src/main/java/com/snowchen/snglfx17/AppCore/DownloadCore.java

@@ -9,6 +9,7 @@ import org.to2mbn.jmccc.mcdownloader.download.concurrent.CallbackAdapter;
 import org.to2mbn.jmccc.option.MinecraftDirectory;
 import org.to2mbn.jmccc.version.Version;
 import org.to2mbn.jmccc.mcdownloader.provider.DefaultLayoutProvider;
+import com.snowchen.snglfx17.AppCore.LaunchCore;
 
 public class DownloadCore {
     public class BmclApiProvider extends DefaultLayoutProvider {
@@ -42,13 +43,13 @@ public class DownloadCore {
 
     public static void DownloadMinecraftVersion() {
         // 下载位置(要下载到的.minecraft目录)
-        MinecraftDirectory dir = new MinecraftDirectory("/home/yushijinhun/.minecraft");
+        MinecraftDirectory dir = new MinecraftDirectory(LaunchCore.Game_Directory+"/versions");
 
         // 创建MinecraftDownloader
         MinecraftDownloader downloader = MinecraftDownloaderBuilder.create().build();
 
-        // 下载Minecraft1.9
-        downloader.downloadIncrementally(dir, "1.20.2", new CallbackAdapter<Version>() {
+        // 下载Minecraft1.x
+        downloader.downloadIncrementally(dir, "1.20.1", new CallbackAdapter<Version>() {
 
             @Override
             public void done(Version result) {

+ 5 - 5
src/main/java/com/snowchen/snglfx17/AppCore/LaunchCore.java

@@ -10,8 +10,8 @@ import org.to2mbn.jmccc.option.LaunchOption;
 import org.to2mbn.jmccc.option.MinecraftDirectory;
 
 import org.to2mbn.jmccc.option.WindowSize;
-import org.to2mbn.jmccc.auth.Authenticator;
-import org.to2mbn.jmccc.util.ExtraArgumentsTemplates;
+import jmccc.microsoft.MicrosoftAuthenticator;
+
 
 import java.io.File;
 import java.io.IOException;
@@ -33,7 +33,7 @@ public class LaunchCore {
                 .nativeFastCheck(true) //是否开启快速检查Natives文件
                 .build(); //构建Laucher对象
         try {
-             option = new LaunchOption(Game_Version,new OfflineAuthenticator(Player_Name),
+             option = new LaunchOption(Game_Version, MicrosoftAuthenticator.login(it -> System.out.println(it.message)),
                     new MinecraftDirectory(Game_Directory));//启动指令
             GameOption();//启动设置
             launcher.launch(option, new ProcessListener()
@@ -67,8 +67,8 @@ public class LaunchCore {
         }else {
             option.setWindowSize(WindowSize.window(854, 480)); //窗口化,宽854高480
         }
-        option.extraJvmArguments().add(ExtraArgumentsTemplates.FML_IGNORE_INVALID_MINECRAFT_CERTIFICATES);
-        option.extraJvmArguments().add(ExtraArgumentsTemplates.FML_IGNORE_PATCH_DISCREPANCISE);//忽略FML标签
+        //option.extraJvmArguments().add(ExtraArgumentsTemplates.FML_IGNORE_INVALID_MINECRAFT_CERTIFICATES);
+        //option.extraJvmArguments().add(ExtraArgumentsTemplates.FML_IGNORE_PATCH_DISCREPANCISE);//忽略FML标签
         //option.setServerInfo(new ServerInfo("liyuuserver.com",1200));
         Map<String, String> vars = new HashMap<String, String>();
         vars.put("version_type", "Snowの启动器");

+ 25 - 1
src/main/java/com/snowchen/snglfx17/HelloController.java

@@ -26,6 +26,7 @@ public class HelloController {
                 " ___) | |\\  | |_| | |___ \n" +
                 "|____/|_| \\_|\\____|_____|");
         InitializeJavaEnviroment();
+        CheckRootDirectory();
         InitializeVersionChoice();
         InitializeMaxMem();
         SetMaxMemListen();
@@ -68,6 +69,29 @@ public class HelloController {
             showAlert("用户名不能为空");}
 
     }
+    private void CheckRootDirectory(){
+        // 获取程序的根目录
+        String rootPath = System.getProperty("user.dir");
+
+        // 创建 .minecraft 目录的路径
+        String minecraftDirectoryPath = rootPath + File.separator + ".minecraft";
+        File minecraftDirectory = new File(minecraftDirectoryPath);
+
+        // 如果 .minecraft 目录不存在,就创建它
+        if (!minecraftDirectory.exists()) {
+            minecraftDirectory.mkdir();
+        }
+
+        // 创建 versions 子目录的路径
+        String versionsDirectoryPath = minecraftDirectoryPath + File.separator + "versions";
+        File versionsDirectory = new File(versionsDirectoryPath);
+
+        // 如果 versions 子目录不存在,就创建它
+        if (!versionsDirectory.exists()) {
+            versionsDirectory.mkdir();
+        }
+    }
+
     @FXML//刷新游戏文件夹按钮
     protected void ReloadGameDirectoryClick(){
         InitializeVersionChoice();
@@ -182,7 +206,7 @@ public class HelloController {
     }
     @FXML
     protected void TestDownload(){
-        System.out.println("开始测试");
+        System.out.println("开始下载1.20.1");
         DownloadCore.DownloadMinecraftVersion();
         //DownloadCore.DownloadRemoteVersionList();
         InitializeVersionChoice();

+ 1 - 2
src/main/java/module-info.java

@@ -2,11 +2,10 @@ module com.snowchen.snglfx17 {
     requires javafx.controls;
     requires javafx.fxml;
     requires atlantafx.base;
-    requires jmccc;
     requires java.desktop;
-    requires jmccc.mcdownloader;
     requires com.github.oshi;
     requires hutool.all;
+    requires jmccc.cli;
 
 
     opens com.snowchen.snglfx17 to javafx.fxml;