https://github.com/snowiiii/mojangapi
Simple & User Friendly Java Mojang API
https://github.com/snowiiii/mojangapi
java mojang mojang-api
Last synced: 9 months ago
JSON representation
Simple & User Friendly Java Mojang API
- Host: GitHub
- URL: https://github.com/snowiiii/mojangapi
- Owner: Snowiiii
- License: gpl-3.0
- Created: 2023-01-29T18:22:43.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-12-30T14:00:13.000Z (over 1 year ago)
- Last Synced: 2025-01-11T00:48:11.685Z (over 1 year ago)
- Topics: java, mojang, mojang-api
- Language: Java
- Homepage:
- Size: 164 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mojang API for Java
The Mojang API for Java is a library that provides Java developers with an easy-to-use interface for accessing Mojang's APIs. This library makes it simple to fetch game profiles and UUIDs from Mojang's servers, and cache them locally for faster access.
### Getting Started
To get started with the Mojang API for Java, you can add it to your Maven or Gradle project as a dependency.
#### Maven
```xml
eldonexus-repo
https://eldonexus.de/repository/maven-public/
```
Then add the dependency:
```xml
de.snowii
mojang-api
1.1.0
```
### Gradle
Add the following repository to your build.gradle file:
```groovy
repositories {
mavenCentral()
maven("https://eldonexus.de/repository/maven-public/")
}
```
Then add the dependency:
```groovy
dependencies {
implementation("de.snowii:mojang-api:1.1.0")
}
```
### Using the API
Once you have added the library to your project, you can use the API in the MojangAPI class. For example, to get a GameProfile object for a given username:
```java
GameProfile profile = MojangAPI.getGameProfile("Notch");
```
You can also get a GameProfile by UUID:
```java
GameProfile profile = MojangAPI.getGameProfile(UUID.fromString("7bd9c2cb-079f-4f5b-925d-4bffdcf24aa8"));
```
### Using a Proxy
If you are using a proxy, you can set it at the beginning of your code with:
```java
MojangJSONParser.setProxy();
```