From c50bc55f774e296c63c9bc5c438f85b83f3dd609 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Thu, 12 Jun 2014 21:16:31 +0200 Subject: [PATCH] Improve JavaDoc documentation of WrappedGameProfile. --- .../protocol/wrappers/WrappedGameProfile.java | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java index e7b81829..3c332ddb 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedGameProfile.java @@ -99,7 +99,40 @@ public class WrappedGameProfile extends AbstractWrapper { } } } - + + /** + * Construct a new game profile with the given properties. + *

+ * 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) { if (id == null) return null; @@ -129,33 +162,6 @@ public class WrappedGameProfile extends AbstractWrapper { } return UUID.fromString(id); } - - /** - * Construct a new game profile with the given properties. - *

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