public class UUIDFetcher extends Object implements Callable<Map<String,UUID>>
UUID
s for one or multiple players
on the serverConstructor and Description |
---|
UUIDFetcher(List<String> names)
Passes the names to the other constructor, and
true for rate
limiting |
UUIDFetcher(List<String> names,
boolean rateLimiting)
Makes a copy of the names to be retrieved
|
Modifier and Type | Method and Description |
---|---|
Map<String,UUID> |
call()
Makes a request to mojang's servers of a sublist of at most 100 player's
names.
|
Map<String,UUID> |
callWithProgessOutput(boolean output,
Logger log,
java.util.function.Predicate<? super Integer> doOutput)
Makes a request to mojang's servers of a sublist of at most 100 player's
names.
|
static UUID |
fromBytes(byte[] array)
Returns a
UUID from a byte array |
static UUID |
getUUIDOf(String name)
Returns the
UUID of a player's username. |
static byte[] |
toBytes(UUID uuid)
Converts a
UUID into bytes |
public UUIDFetcher(List<String> names, boolean rateLimiting)
names
- The player names to retrieverateLimiting
- Whether or not to rate limit requests to Mojangpublic UUIDFetcher(List<String> names)
true
for rate
limitingnames
- The names to convertUUIDFetcher(List, boolean)
public Map<String,UUID> call() throws IOException, org.json.simple.parser.ParseException, InterruptedException
call
in interface Callable<Map<String,UUID>>
Map
of player names to their UUID
sIOException
- If there's a problem sending or receiving the requestorg.json.simple.parser.ParseException
- If the request response cannot be readInterruptedException
- If the thread is interrupted while sleepingpublic Map<String,UUID> callWithProgessOutput(boolean output, Logger log, java.util.function.Predicate<? super Integer> doOutput) throws IOException, org.json.simple.parser.ParseException, InterruptedException
output
- Whether or not to print outputlog
- The Logger
to print todoOutput
- A Predicate
representing when to output a numberMap
of player names to their UUID
sIOException
- If there's a problem sending or receiving the requestorg.json.simple.parser.ParseException
- If the request response cannot be readInterruptedException
- If the thread is interrupted while sleepingpublic static byte[] toBytes(UUID uuid)
UUID
into bytesuuid
- The UUID
to convertpublic static UUID fromBytes(byte[] array)
UUID
from a byte arrayarray
- The byte array to convertUUID
objectIllegalArgumentException
- if the array length is not 16public static UUID getUUIDOf(String name) throws IOException, org.json.simple.parser.ParseException, InterruptedException
UUID
of a player's username. Note that this is a
blocking methodname
- The username of the player to fetch a UUID
forUUID
of the player name that is passedIOException
- If there's a problem sending or receiving the requestorg.json.simple.parser.ParseException
- If the request response cannot be readInterruptedException
- If the thread is interrupted while sleepingCopyright © 2015. All rights reserved.