Skip to content
This repository was archived by the owner on Jul 8, 2020. It is now read-only.
/ uuid-java Public archive

[Deprecated] Java UUID API

License

Notifications You must be signed in to change notification settings

MC-API/uuid-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uuid-java Build Status

A Java implementation of the mc-api.net API.

Bugs and Issues

If you encounter any issues or bugs with our services or this library, please report them here.

Custom Handlers

A handler decides how a uuid or username is obtained. The default handler will just query the API and then cache the result. However you can create your own, custom handler.

There are two premade for Bukkit/Spigot and BungeeCord:

  • Bukkit Handler: Checks if player is online or has played before, before querying API
  • Bungee Handler: Checks if player is online before querying API

Just implement these somewhere within your project and then set it as the active handler using this example (example is for the BungeeHandler.

UUIDAPI.setHandler(new BungeeHandler());

We suggest you put it in the package: net.mcapi.uuid.handlers

Implementation

Setting request server

MC-API has multiple mirrors, you can choose your mirror like so:

UUIDAPI.setRegion(ServerRegion)

A list of mirrors can be found here. The default mirror is set to US.

Usage examples:

Username to UUID

UUID uuid = UUIDAPI.getUUID("AeroPvP");

Would return the UUID object for AeroPvP.

You can also get a string alternative (which does not contain hyphens)

String uuid = UUIDAPI.getUUIDString("AeroPvP");

UUID to Username

String playerName = UUIDAPI.getUsername("a8889e3068b84ce8963f4ea259c3ebe3");

Would return:

njb_said

Errors

If the given username or UUID is invalid, NULL would be returned!

Compilation

To compile just run mvn clean package or download the latest build from build.mc-api.net

Maven Repository

There is a maven repository at build.mc-api.net/plugin/repository/everything

Maven Configuration:

    <repositories>
        <repository>
            <id>mcapi</id>
            <url>http://build.mc-api.net/plugin/repository/everything/</url>
        </repository>
    </repositories>
    
    <dependencies>
        <dependency>
            <groupId>net.mcapi.uuid</groupId>
            <artifactId>uuid-java</artifactId>
            <version>1.1.3</version>
        </dependency>
    </dependencies>