From 12a42f8aba753f908b05ea98b8d6d9c6746e9df9 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 29 Oct 2016 14:10:27 +0200 Subject: [PATCH] Added some comments, documentation --- src/main/java/buttondevteam/lib/TBMCPlayer.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/buttondevteam/lib/TBMCPlayer.java b/src/main/java/buttondevteam/lib/TBMCPlayer.java index 9062790..6b52160 100644 --- a/src/main/java/buttondevteam/lib/TBMCPlayer.java +++ b/src/main/java/buttondevteam/lib/TBMCPlayer.java @@ -24,7 +24,7 @@ import com.palmergames.bukkit.towny.object.TownyUniverse; * @author Norbi * */ -public class TBMCPlayer implements AutoCloseable { +public class TBMCPlayer implements AutoCloseable { //TODO: Load player data in Core private static final String TBMC_PLAYERS_DIR = "TBMC/players"; private HashMap data = new HashMap<>(); @@ -127,11 +127,22 @@ public class TBMCPlayer implements AutoCloseable { private static HashMap LoadedPlayers = new HashMap<>(); /** + * This method returns a TBMC player from their name. Calling this method may return an offline player which will load it, therefore it's highly recommended to use {@link #close()} to unload the player data. Using + * try-with-resources may be the easiest way to achieve this. Example: + * + *
+	 * {@code
+	 * try(TBMCPlayer player = getFromName(p))
+	 * {
+	 * 	...
+	 * }
+	 * 
+ * * @param name * The player's name * @return The {@link TBMCPlayer} object for the player */ - public static TBMCPlayer GetFromName(String name) { + public static TBMCPlayer getFromName(String name) { @SuppressWarnings("deprecation") OfflinePlayer p = Bukkit.getOfflinePlayer(name); if (p != null) @@ -146,7 +157,7 @@ public class TBMCPlayer implements AutoCloseable { * *
 	 * {@code
-	 * try(TBMCPlayer player = GetPlayer(p))
+	 * try(TBMCPlayer player = getPlayer(p))
 	 * {
 	 * 	...
 	 * }