如何导入 com.mojang.authlib.GameProfile [英] How can I import com.mojang.authlib.GameProfile
问题描述
我目前正在进入 Spigot Pugin 开发并需要访问 GameProfile,因为我需要它作为插件(用于更改皮肤的东西).我正在使用 Eclipse.
I am currently getting into Spigot Pugin developement and need to access GameProfile, because I need it for a plugin (Stuff for changing Skins). I'm using Eclipse.
现在,我已经观看了大量使用 GameProfile 的教程,而所有这些教程都是为了
Now, I've watched a whole ton of tutorials in which GameProfile was used, and all these tutorials just went for
import com.mojang.authlib.GameProfile;
或
import net.minecraft.util.SOMETHINGLONG.GameProfile
无需解释为什么这条线是可能的.
without needing to explain anything why this line is possible.
有一个人和我一样在使用第二个命令时遇到了同样的问题,但显然可以用第一个命令解决它,所以我试图让这个命令运行起来.https://www.spigotmc.org/threads/how-to-import-net-minecraft-util.252371/.
Here is a guy that had the same problem like me with the second command but apparently could solve it with the first one, so im trying to get this one running. https://www.spigotmc.org/threads/how-to-import-net-minecraft-util.252371/.
如果我尝试包含这样的内容,我会看到 com.google.common
、com.oracle
和 com.sun
但 com.mojang 无处可见.我发现它必须对您添加到项目中的 .jar 文件执行某些操作,但我不知道如何将 com.mojang... 添加到可导入文件中.
If I try to include stuff like this, I see com.google.common
, com.oracle
and com.sun
but com.mojang is nowhere to be seen. I found it has to do something with the .jar files you add to your project, but I don't know how to get com.mojang... into the importable files.
推荐答案
要建立在 SPY_me 的答案的基础上,这里是如果您使用 Gradle,我的解决方案是:
To build up on SPY_me's answer, here is my solution if you're using 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:
If you want to download this library directly, here is the jar:
https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar
这篇关于如何导入 com.mojang.authlib.GameProfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!