How can I import com.mojang.authlib.GameProfile

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.

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; 

or

import net.minecraft.util.SOMETHINGLONG.GameProfile 

without needing to explain anything why this line is possible.

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. .

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.

7

3 Answers

To build up on SPY_me's answer, here is my solution if you're using Gradle:

repositories { // ... maven { name = 'minecraft-repo' url = ' // 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 } 

If you want to download this library directly, here is the jar:

1
 <repositories> <repository> <id>minecraft-repo</id> <url> </repository> </repositories> <dependencies> <dependency> <groupId>com.mojang</groupId> <artifactId>authlib</artifactId> <version>1.5.21</version> <scope>provided</scope> </dependency> </dependencies>
1

Since you use Intellij i guess youre using Maven?

If so then paste this in your pom.yml:

<repositories> <repository> <id>spigot-repo</id> <url> </repository> </repositories> <dependencies> <!--Spigot API--> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.8.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> <!--Bukkit API--> <dependency> <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> <version>1.8.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> <!--CraftBukkit API--> <dependency> <groupId>org.bukkit</groupId> <artifactId>craftbukkit</artifactId> <version>1.8.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> </dependencies>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like