Просмотр исходного кода

修改微软登陆方法,增加登录方式选择框

Snow 1 год назад
Родитель
Сommit
5ba7103e10

+ 4 - 4
.idea/artifacts/SNGL_FX17_jar.xml

@@ -22,12 +22,10 @@
       <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$/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$/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" />
@@ -40,12 +38,14 @@
       <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" />
+      <element id="library" level="project" name="Maven: io.github.mkpaz:atlantafx-base:2.0.0" />
+      <element id="library" level="project" name="Maven: com.github.oshi:oshi-core:5.8.6" />
+      <element id="library" level="project" name="Maven: commons-logging:commons-logging:1.2" />
+      <element id="library" level="project" name="Maven: commons-codec:commons-codec:1.11" />
     </root>
   </artifact>
 </component>

+ 25 - 0
pom.xml

@@ -93,6 +93,31 @@
             </exclusions>
 
         </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>
 
 
     </dependencies>

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

@@ -71,7 +71,7 @@ public class LaunchCore {
         //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の启动器");
+        vars.put("version_type", "SNGL");
         option.commandlineVariables().putAll(vars);
 
 

+ 28 - 13
src/main/java/com/snowchen/snglfx17/Test.java

@@ -3,19 +3,34 @@ import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.io.IOException;
 
+import java.util.Map;
+import java.util.UUID;
+import org.to2mbn.jmccc.auth.AuthenticationException;
+import org.to2mbn.jmccc.auth.yggdrasil.core.GameProfile;
+import org.to2mbn.jmccc.auth.yggdrasil.core.PropertiesGameProfile;
+import org.to2mbn.jmccc.auth.yggdrasil.core.texture.Texture;
+import org.to2mbn.jmccc.auth.yggdrasil.core.texture.TextureType;
+import org.to2mbn.jmccc.auth.yggdrasil.core.yggdrasil.YggdrasilProfileServiceBuilder;
+import org.to2mbn.jmccc.auth.yggdrasil.core.ProfileService;
+import org.to2mbn.jmccc.auth.yggdrasil.core.texture.Textures;
 public class Test {
-    public static void main(String[] args) {
-        ProcessBuilder pb = new ProcessBuilder("/bin/bash", "-c", "/usr/libexec/java_home -V");
-        try {
-            Process process = pb.start();
-            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
-            String line;
-            while ((line = reader.readLine()) != null) {
-                System.out.println(line);
-            }
-            process.waitFor();
-        } catch (IOException | InterruptedException e) {
-            e.printStackTrace();
+
+        public static void main(String[] args) throws AuthenticationException {
+            ProfileService profileService = YggdrasilProfileServiceBuilder.buildDefault();
+
+            // 查询ztcjohn的uuid
+            UUID uuid = profileService.lookupGameProfile("Misuke").getUUID();
+            System.out.println(uuid);
+
+            // 根据uuid获取GameProfile
+            // 注意啦!假如lookupUUIDByName没找到对应玩家就会返回null。我这里因为是演示所以偷懒不做判断,大家写的时候记得一定要判断一下
+            GameProfile profile = profileService.getGameProfile(uuid);
+
+            // 获取GameProfile的皮肤
+            // 同上,假如getGameProfile没找到对应玩家就会返回null。我这里是偷懒,大家写的时候千万不要学
+            Map<TextureType, Texture> textures = profileService.getTextures((PropertiesGameProfile) profile);
+            System.out.println(textures);
         }
+
     }
-}
+

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

@@ -5,7 +5,10 @@ module com.snowchen.snglfx17 {
     requires java.desktop;
     requires com.github.oshi;
     requires hutool.all;
-    requires jmccc.cli;
+    requires jmccc;
+    requires jmccc.microsoft.authenticator;
+    requires jmccc.mcdownloader;
+    requires jmccc.yggdrasil.authenticator;
 
 
     opens com.snowchen.snglfx17 to javafx.fxml;

+ 8 - 2
src/main/resources/com/snowchen/snglfx17/hello-view.fxml

@@ -52,13 +52,19 @@
                               <Font name="164-SSJianZhengTi" size="18.0" />
                            </font>
                         </CheckBox>
-                        <Text layoutX="14.0" layoutY="401.0" strokeType="OUTSIDE" strokeWidth="0.0" text="SNGL Ver 0.2 Alpha" wrappingWidth="182.0791015625" AnchorPane.bottomAnchor="6.046875" AnchorPane.leftAnchor="13.5" AnchorPane.rightAnchor="478.9208984375" AnchorPane.topAnchor="387.5" />
+                        <Text layoutX="14.0" layoutY="401.0" strokeType="OUTSIDE" strokeWidth="0.0" text="SNGL Ver 0.2 .1 Alpha" wrappingWidth="182.0791015625" AnchorPane.bottomAnchor="6.046875" AnchorPane.leftAnchor="13.5" AnchorPane.rightAnchor="478.9208984375" AnchorPane.topAnchor="387.5" />
                         <Hyperlink layoutX="529.0" layoutY="384.0" prefHeight="25.0" prefWidth="134.0" text="Powered by JMCCC" textAlignment="RIGHT" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="529.0" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="384.0" />
-                        <TextArea fx:id="LogArea" editable="false" layoutX="12.0" layoutY="11.0" prefHeight="374.0" prefWidth="420.0" promptText="Launcher Version:SNGL Ver0.2 Alpha" wrapText="true" AnchorPane.bottomAnchor="25.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="243.0" AnchorPane.topAnchor="11.0">
+                        <TextArea fx:id="LogArea" editable="false" layoutX="12.0" layoutY="11.0" prefHeight="374.0" prefWidth="420.0" promptText="Launcher Version:SNGL Ver0.2.1 Alpha" wrapText="true" AnchorPane.bottomAnchor="25.0" AnchorPane.leftAnchor="12.0" AnchorPane.rightAnchor="243.0" AnchorPane.topAnchor="11.0">
                            <font>
                               <Font name="Consolas" size="13.0" />
                            </font></TextArea>
                         <Separator layoutX="431.0" layoutY="-3.0" orientation="VERTICAL" prefHeight="416.0" prefWidth="28.0" AnchorPane.bottomAnchor="-3.0" AnchorPane.leftAnchor="431.0" AnchorPane.rightAnchor="216.0" AnchorPane.topAnchor="-3.0" />
+                        <Text layoutX="463.0" layoutY="188.0" strokeType="OUTSIDE" strokeWidth="0.0" text="登录方式" textAlignment="CENTER" wrappingWidth="72.21630859375" AnchorPane.bottomAnchor="218.5087890625" AnchorPane.leftAnchor="463.0" AnchorPane.rightAnchor="139.78369140625" AnchorPane.topAnchor="173.603515625">
+                           <font>
+                              <Font name="164-SSJianZhengTi" size="18.0" />
+                           </font>
+                        </Text>
+                        <ChoiceBox fx:id="LoginChoice" layoutX="539.0" layoutY="166.0" minHeight="5.0" minWidth="10.0" prefHeight="32.0" prefWidth="110.0" />
 
    </children>
                   </AnchorPane>