Java 如何导入com.mojang.authlib.GameProfile

Java 如何导入com.mojang.authlib.GameProfile,java,minecraft,Java,Minecraft,我目前正在进行Spigot Pugin开发,需要访问GameProfile,因为我需要它作为插件(用于更改皮肤的东西)。我正在使用Eclipse 现在,我已经看了一大堆使用GameProfile的教程,所有这些教程都很受欢迎 import com.mojang.authlib.GameProfile; 或 不需要解释为什么这条线是可能的 这里有一个家伙和我一样,在第二个命令上有同样的问题,但显然可以用第一个命令来解决,所以我试着运行这个命令 如果我尝试包含这样的内容,我会看到com.googl

我目前正在进行Spigot Pugin开发,需要访问GameProfile,因为我需要它作为插件(用于更改皮肤的东西)。我正在使用Eclipse

现在,我已经看了一大堆使用GameProfile的教程,所有这些教程都很受欢迎

import com.mojang.authlib.GameProfile;

不需要解释为什么这条线是可能的

这里有一个家伙和我一样,在第二个命令上有同样的问题,但显然可以用第一个命令来解决,所以我试着运行这个命令


如果我尝试包含这样的内容,我会看到
com.google.common
com.oracle
com.sun
,但是com.mojang却不见踪影。我发现它与您添加到项目中的.jar文件有关,但我不知道如何获取com.mojang。。。导入到可导入的文件中。

既然您使用Intellij,我猜您使用的是Maven

如果是,则将其粘贴到pom.yml中:


插销式回购
https://hub.spigotmc.org/nexus/content/repositories/snapshots/
org.spigotmc
插口api
1.8.8-R0.1-快照
假如
org.bukkit
布基特
1.8.8-R0.1-快照
假如
org.bukkit
克拉夫布基特
1.8.8-R0.1-快照
假如

既然你用的是Intellij,我猜你用的是Maven

如果是,则将其粘贴到pom.yml中:


插销式回购
https://hub.spigotmc.org/nexus/content/repositories/snapshots/
org.spigotmc
插口api
1.8.8-R0.1-快照
假如
org.bukkit
布基特
1.8.8-R0.1-快照
假如
org.bukkit
克拉夫布基特
1.8.8-R0.1-快照
假如

布雷克拉夫特回购协议
https://libraries.minecraft.net/
com.mojang
authlib
1.5.21
假如

布雷克拉夫特回购协议
https://libraries.minecraft.net/
com.mojang
authlib
1.5.21
假如
如果您使用Gradle,下面是我的解决方案:

repositories {
    // ...
    maven {
        name = 'minecraft-repo'
        url = 'https://libraries.minecraft.net/'
        // this lets gradle know where to look for authlib
    }
}

dependencies {
    // ...
    compile 'com.mojang:authlib:1.5.21'
    // this adds the library to the project and the jar when you compile your project
}
如果您想直接下载这个库,下面是jar:

如果您使用Gradle,下面是我的解决方案:

repositories {
    // ...
    maven {
        name = 'minecraft-repo'
        url = 'https://libraries.minecraft.net/'
        // this lets gradle know where to look for authlib
    }
}

dependencies {
    // ...
    compile 'com.mojang:authlib:1.5.21'
    // this adds the library to the project and the jar when you compile your project
}
如果您想直接下载这个库,下面是jar:


试着从here错误502下载JAR,这个文件不见了……正如那个spiget博客所说,一切都应该被移动到
net.minecraft
,可能是在微软从Mojang收购了minecraft之后。因此,无论您从何处下载Minecraft服务器JAR,您都应该使用它。您可能引用了一本旧教程,这似乎也解释了两种导入方法。事实上,我在我的´.minecraft/versions`文件夹中包含了1.12.2 jar,但这个ony给了我net.minecraft.servers.*试着从here下载jar错误502,这个文件不见了…正如那个spiget博客所说,一切都应该被移动到
net.minecraft
,可能是在微软从Mojang收购minecraft之后。因此,无论您从何处下载Minecraft服务器JAR,您都应该使用它。您可能引用了一本旧教程,这似乎也解释了两种导入方法。实际上,我在我的´.minecraft/versions`文件夹中包含了1.12.2 jar,但这个ony给了我net.minecraft.servers.*请提供更多上下文。你为什么把这两件事添加到Maven pom中?这个问题没有提到Maven,只有Eclipse。请提供更多的上下文。你为什么把这两件事添加到Maven pom中?这个问题没有提到Maven,只提到Eclipse。只想补充一点,您可以访问
.Minecraft/versions//.json
(请参阅),查看特定版本的Minecraft使用了哪些库。使用的库数组位于属性
下。例如,1.16.4使用
com.mojang.authlib.2.1.28
。只需添加一点,您可以通过转到
.Minecraft/versions//.json
(请参阅)查看特定版本的Minecraft使用了哪些库。使用的库数组位于属性
下。例如,1.16.4使用
com.mojang.authlib.2.1.28