Archiviert
13
0

Improve JavaDoc documentation of WrappedGameProfile.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2014-06-12 21:16:31 +02:00
Ursprung ce216d0371
Commit c50bc55f77

Datei anzeigen

@ -100,6 +100,39 @@ public class WrappedGameProfile extends AbstractWrapper {
} }
} }
/**
* Construct a new game profile with the given properties.
* <p>
* Note that at least one of the parameters must be non-null.
* @param uuid - the UUID of the player, or NULL.
* @param name - the name of the player, or NULL.
*/
public WrappedGameProfile(UUID uuid, String name) {
super(GameProfile.class);
if (CREATE_STRING_STRING != null) {
setHandle(CREATE_STRING_STRING.invoke(uuid != null ? uuid.toString() : null, name));
} else {
setHandle(new GameProfile(uuid, name));
}
}
/**
* Construct a wrapper around an existing game profile.
* @param profile - the underlying profile, or NULL.
*/
public static WrappedGameProfile fromHandle(Object handle) {
if (handle == null)
return null;
return new WrappedGameProfile(handle);
}
/**
* Parse an UUID using very lax rules, as specified in {@link #WrappedGameProfile(UUID, String)}.
* @param id - text.
* @return The corresponding UUID.
* @throws IllegalArgumentException If we cannot parse the text.
*/
private static UUID parseUUID(String id) { private static UUID parseUUID(String id) {
if (id == null) if (id == null)
return null; return null;
@ -130,33 +163,6 @@ public class WrappedGameProfile extends AbstractWrapper {
return UUID.fromString(id); return UUID.fromString(id);
} }
/**
* Construct a new game profile with the given properties.
* <p>
* Note that at least one of the parameters must be non-null.
* @param uuid - the UUID of the player, or NULL.
* @param name - the name of the player, or NULL.
*/
public WrappedGameProfile(UUID uuid, String name) {
super(GameProfile.class);
if (CREATE_STRING_STRING != null) {
setHandle(CREATE_STRING_STRING.invoke(uuid != null ? uuid.toString() : null, name));
} else {
setHandle(new GameProfile(uuid, name));
}
}
/**
* Construct a wrapper around an existing game profile.
* @param profile - the underlying profile, or NULL.
*/
public static WrappedGameProfile fromHandle(Object handle) {
if (handle == null)
return null;
return new WrappedGameProfile(handle);
}
/** /**
* Retrieve the UUID of the player. * Retrieve the UUID of the player.
* <p> * <p>