java - 如何导入 com.mojang.authlib.GameProfile
问题描述
我目前正在进入 Spigot Pugin 开发并需要访问 GameProfile,因为我需要它作为插件(用于更改皮肤的东西)。我正在使用 Eclipse。
现在,我已经看了一大堆使用 GameProfile 的教程,所有这些教程都是为了
import com.mojang.authlib.GameProfile;
或者
import net.minecraft.util.SOMETHINGLONG.GameProfile
无需解释为什么这条线是可能的。
这是一个与我有同样问题的人使用第二个命令,但显然可以用第一个命令解决它,所以我试图让这个命令运行。https://www.spigotmc.org/threads/how-to-import-net-minecraft-util.252371/。
如果我尝试包含这样的东西,我会看到,com.google.common
但是com.mojang 无处可寻。我发现它与您添加到项目中的 .jar 文件有关,但我不知道如何将 com.mojang... 放入可导入文件中。com.oracle
com.sun
解决方案
为了建立SPY_me 的答案,如果您使用 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:
https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar
推荐阅读
- javascript - 无法访问 js 对象属性
- android - React-native 错误:命令失败:./gradlew app: installDebug -PreactNativeDevServerPort = 8081
- java - Spring 批量集成测试
- python - 在 kivy 中检查子交互的语法
- r - 删除打印到文件中的多余行
- deep-learning - 改变学习率后,我们应该如何缩放权重衰减系数?
- nixos - 如何在nixos20.09上安装libmysqlclient.so.18?
- python - 读取 GCP 中以 blob 形式存在的 json 数据时出错。错误:json.decoder.JSONDecodeError:预期值:第 1 行第 1 列(字符 0)
- powershell - powersehll 中的变量、比较和运算符
- asp.net-mvc - 对如何通过 ViewBag 填充 DropDown 感到困惑