Fix javadoc build errors and fix #90

Attempt one at trying to fix the javadoc errors.
This commit is contained in:
graywolf336 2015-08-18 08:49:50 -05:00
parent 65635fe761
commit 63b43d1191
29 changed files with 424 additions and 115 deletions

View File

@ -8,7 +8,7 @@ import org.bukkit.Location;
/** /**
* Manages the handcuffing of players. * Manages the handcuffing of players.
* *
* <p /> * <p>&nbsp;</p>
* *
* Provides easy to use methods for adding, * Provides easy to use methods for adding,
* removing, and checking if someone has * removing, and checking if someone has

View File

@ -83,7 +83,12 @@ public class JailIO {
} }
} }
/** Prepares the storage engine to be used, returns true if everything went good. */ /**
* Prepares the storage engine to be used, returns true if everything went good.
*
* @param doInitialCreations whether to do the initial creations (database tables or files)
* @return Whether it was successful or not
*/
protected boolean prepareStorage(boolean doInitialCreations) { protected boolean prepareStorage(boolean doInitialCreations) {
int inital = storage == -1 ? -1 : storage; int inital = storage == -1 ? -1 : storage;
@ -1008,7 +1013,7 @@ public class JailIO {
cPS.setDouble(6, c.getTeleport().getYaw()); cPS.setDouble(6, c.getTeleport().getYaw());
cPS.setDouble(7, c.getTeleport().getPitch()); cPS.setDouble(7, c.getTeleport().getPitch());
if(c.hasChest()) { if(c.useChest()) {
cPS.setInt(8, c.getChestLocation().getBlockX()); cPS.setInt(8, c.getChestLocation().getBlockX());
cPS.setInt(9, c.getChestLocation().getBlockY()); cPS.setInt(9, c.getChestLocation().getBlockY());
cPS.setInt(10, c.getChestLocation().getBlockZ()); cPS.setInt(10, c.getChestLocation().getBlockZ());

View File

@ -341,52 +341,93 @@ public class JailMain extends JavaPlugin {
} }
} }
/** Gets the {@link HandCuffManager} instance. */ /**
* Gets the {@link HandCuffManager} instance.
*
* @return {@link HandCuffManager} instance
*/
public HandCuffManager getHandCuffManager() { public HandCuffManager getHandCuffManager() {
return this.hcm; return this.hcm;
} }
/** Gets the {@link JailIO} instance. */ /**
* Gets the {@link JailIO} instance.
*
* @return {@link JailIO} instance
*/
public JailIO getJailIO() { public JailIO getJailIO() {
return this.io; return this.io;
} }
/** Gets the {@link JailManager} instance. */ /**
* Gets the {@link JailManager} instance.
*
* @return {@link JailManager} instance
*/
public JailManager getJailManager() { public JailManager getJailManager() {
return this.jm; return this.jm;
} }
/** Gets an instance of the {@link IJailPayManager}. */ /**
* Gets an instance of the {@link IJailPayManager}.
*
* @return {@link IJailPayManager}
*/
public IJailPayManager getJailPayManager() { public IJailPayManager getJailPayManager() {
return this.jpm; return this.jpm;
} }
/** Gets the {@link PrisonerManager} instance. */ /**
* Gets the {@link PrisonerManager} instance.
*
* @return {@link PrisonerManager} instance
*/
public PrisonerManager getPrisonerManager() { public PrisonerManager getPrisonerManager() {
return this.pm; return this.pm;
} }
/** Gets an instance of the {@link JailStickManager}. */ /**
* Gets an instance of the {@link JailStickManager}.
*
* @return {@link JailStickManager}
*/
public IJailStickManager getJailStickManager() { public IJailStickManager getJailStickManager() {
return this.jsm; return this.jsm;
} }
/** Gets the {@link ScoreBoardManager} instance. */ /**
* Gets the {@link ScoreBoardManager} instance.
*
* @return {@link ScoreBoardManager} instance
*/
public ScoreBoardManager getScoreBoardManager() { public ScoreBoardManager getScoreBoardManager() {
return this.sbm; return this.sbm;
} }
/** Gets the {@link JailVoteManager} instance. */ /**
* Gets the {@link JailVoteManager} instance.
*
* @return {@link JailVoteManager} instance
*/
public JailVoteManager getJailVoteManager() { public JailVoteManager getJailVoteManager() {
return this.jvm; return this.jvm;
} }
/** Gets the {@link Update} instance. */ /**
* Gets the {@link Update} instance.
*
* @return {@link Update} instance
*/
public Update getUpdate() { public Update getUpdate() {
return this.update; return this.update;
} }
/** Sets whether the plugin is in debugging or not. */ /**
* Sets whether the plugin is in debugging or not.
*
* @param debug whether to be in debuggin or not
* @return Whether we we debugging or not.
*/
public boolean setDebugging(boolean debug) { public boolean setDebugging(boolean debug) {
this.debug = debug; this.debug = debug;
@ -397,7 +438,11 @@ public class JailMain extends JavaPlugin {
return this.debug; return this.debug;
} }
/** Returns if the plugin is in debug state or not. */ /**
* Returns if the plugin is in debug state or not.
*
* @return Whether we are debugging or not.
*/
public boolean inDebug() { public boolean inDebug() {
return this.debug; return this.debug;
} }

View File

@ -27,7 +27,7 @@ import com.graywolf336.jail.steps.JailCreationSteps;
/** /**
* Handles all things related to jails. * Handles all things related to jails.
* *
* <p> * <p>&nbsp;</p>
* *
* Stores the following: * Stores the following:
* <ul> * <ul>
@ -62,17 +62,29 @@ public class JailManager {
this.ccs = new CellCreationSteps(); this.ccs = new CellCreationSteps();
} }
/** Returns the instance of the plugin main class. */ /**
* Returns the instance of the plugin main class.
*
* @return {@link JailMain} instance
*/
public JailMain getPlugin() { public JailMain getPlugin() {
return this.plugin; return this.plugin;
} }
/** Returns a HashSet of all the jails. */ /**
* Returns a HashSet of all the jails.
*
* @return HashSet of all the jail instances.
*/
public HashSet<Jail> getJails() { public HashSet<Jail> getJails() {
return new HashSet<Jail>(jails.values()); return new HashSet<Jail>(jails.values());
} }
/** Returns an array of all the names of the jails. */ /**
* Returns an array of all the names of the jails.
*
* @return Array of the jail names
*/
public String[] getJailNames() { public String[] getJailNames() {
String[] toReturn = new String[jails.size()]; String[] toReturn = new String[jails.size()];
@ -88,7 +100,7 @@ public class JailManager {
/** /**
* Gets a list of Jail names that start with the provided prefix. * Gets a list of Jail names that start with the provided prefix.
* *
* <p> * <br /><br />
* *
* If the provided prefix is empty, then we add all of the jails. * If the provided prefix is empty, then we add all of the jails.
* *
@ -410,7 +422,7 @@ public class JailManager {
/** /**
* Forcefully clears all the jails if name provided is null. * Forcefully clears all the jails if name provided is null.
* *
* <p /> * <br /><br />
* *
* This method just clears them from the storage, doesn't release them. * This method just clears them from the storage, doesn't release them.
* *
@ -549,7 +561,12 @@ public class JailManager {
return this.jailCreators.containsKey(name.toLowerCase()) || this.cellCreators.containsKey(name.toLowerCase()); return this.jailCreators.containsKey(name.toLowerCase()) || this.cellCreators.containsKey(name.toLowerCase());
} }
/** Returns a message used for telling them what they're creating and what step they're on. */ /**
* Returns a message used for telling them what they're creating and what step they're on.
*
* @param player the name of the player to check
* @return The details for the step they're on
*/
public String getStepMessage(String player) { public String getStepMessage(String player) {
String message = ""; String message = "";
@ -592,7 +609,12 @@ public class JailManager {
return message; return message;
} }
/** Returns whether or not someone is creating a <strong>Jail</strong>. */ /**
* Returns whether or not someone is creating a <strong>Jail</strong>.
*
* @param name the player's name to check
* @return Whether they are creating a jail or not.
*/
public boolean isCreatingAJail(String name) { public boolean isCreatingAJail(String name) {
return this.jailCreators.containsKey(name.toLowerCase()); return this.jailCreators.containsKey(name.toLowerCase());
} }
@ -613,7 +635,12 @@ public class JailManager {
} }
} }
/** Returns the instance of the CreationPlayer for this player, null if there was none found. */ /**
* Returns the instance of the CreationPlayer for this player, null if there was none found.
*
* @param name the player's name
* @return gets the player's {@link CreationPlayer} instance
*/
public CreationPlayer getJailCreationPlayer(String name) { public CreationPlayer getJailCreationPlayer(String name) {
return this.jailCreators.get(name.toLowerCase()); return this.jailCreators.get(name.toLowerCase());
} }
@ -623,7 +650,12 @@ public class JailManager {
this.jailCreators.remove(name.toLowerCase()); this.jailCreators.remove(name.toLowerCase());
} }
/** Returns whether or not someone is creating a <strong>Cell</strong>. */ /**
* Returns whether or not someone is creating a <strong>Cell</strong>.
*
* @param name the player's name to check
* @return Whether they are creating a jail cell or not.
*/
public boolean isCreatingACell(String name) { public boolean isCreatingACell(String name) {
return this.cellCreators.containsKey(name.toLowerCase()); return this.cellCreators.containsKey(name.toLowerCase());
} }
@ -645,7 +677,12 @@ public class JailManager {
} }
} }
/** Returns the instance of the CreationPlayer for this player, null if there was none found. */ /**
* Returns the instance of the CreationPlayer for this player, null if there was none found.
*
* @param name the player's name to get
* @return The player's {@link CreationPlayer} instance.
*/
public CreationPlayer getCellCreationPlayer(String name) { public CreationPlayer getCellCreationPlayer(String name) {
return this.cellCreators.get(name.toLowerCase()); return this.cellCreators.get(name.toLowerCase());
} }
@ -655,12 +692,20 @@ public class JailManager {
this.cellCreators.remove(name.toLowerCase()); this.cellCreators.remove(name.toLowerCase());
} }
/** Gets the instance of the {@link JailCreationSteps}. */ /**
* Gets the instance of the {@link JailCreationSteps}.
*
* @return {@link JailCreationSteps} instance
*/
public JailCreationSteps getJailCreationSteps() { public JailCreationSteps getJailCreationSteps() {
return this.jcs; return this.jcs;
} }
/** Gets the instance of the {@link CellCreationSteps}. */ /**
* Gets the instance of the {@link CellCreationSteps}.
*
* @return the {@link CellCreationSteps} instance
*/
public CellCreationSteps getCellCreationSteps() { public CellCreationSteps getCellCreationSteps() {
return this.ccs; return this.ccs;
} }
@ -676,23 +721,43 @@ public class JailManager {
this.confirms.remove(name); this.confirms.remove(name);
} }
/** Checks if the given name is confirming something. */ /**
* Checks if the given name is confirming something.
*
* @param name the player's name
* @return Whether they are confirming something or not
*/
public boolean isConfirming(String name) { public boolean isConfirming(String name) {
return this.confirms.containsKey(name); return this.confirms.containsKey(name);
} }
/** Returns true if the confirmation has expired, false if it is still valid. */ /**
* Returns true if the confirmation has expired, false if it is still valid.
*
* @param name the player's name
* @return Whether their confirmation has expired or not.
*/
public boolean confirmingHasExpired(String name) { public boolean confirmingHasExpired(String name) {
//If the expiry time is LESS than the current time, it has expired //If the expiry time is LESS than the current time, it has expired
return this.confirms.get(name).getExpiryTime() < System.currentTimeMillis(); return this.confirms.get(name).getExpiryTime() < System.currentTimeMillis();
} }
/** Returns the original arguments for what we are confirming. */ /**
* Returns the original arguments for what we are confirming.
*
* @param name the player's name
* @return an array of strings which is their original arguments
*/
public String[] getOriginalArgs(String name) { public String[] getOriginalArgs(String name) {
return this.confirms.get(name).getArguments(); return this.confirms.get(name).getArguments();
} }
/** Returns what the given name is confirming. */ /**
* Returns what the given name is confirming.
*
* @param name the player's name
* @return What they are confirming
*/
public Confirmation getWhatIsConfirming(String name) { public Confirmation getWhatIsConfirming(String name) {
return this.confirms.get(name).getConfirming(); return this.confirms.get(name).getConfirming();
} }

View File

@ -19,7 +19,6 @@ import com.graywolf336.jail.events.PrisonerTimeChangeEvent;
* @author graywolf336 * @author graywolf336
* @since 2.x.x * @since 2.x.x
* @version 3.0.0 * @version 3.0.0
*
*/ */
public class JailTimer { public class JailTimer {
private JailMain pl; private JailMain pl;
@ -60,12 +59,16 @@ public class JailTimer {
}, 1200L, 1200L); }, 1200L, 1200L);
} }
/** Returns the instance of this timer. */ /**
* Returns the instance of this timer.
*
* @return the {@link Timer} instance
*/
public Timer getTimer() { public Timer getTimer() {
return this.timer; return this.timer;
} }
class TimeEvent implements Runnable { private class TimeEvent implements Runnable {
public void run() { public void run() {
long timePassed = System.currentTimeMillis() - lastTime; long timePassed = System.currentTimeMillis() - lastTime;
lastTime = System.currentTimeMillis(); lastTime = System.currentTimeMillis();

View File

@ -29,7 +29,8 @@ public class JailVoteManager {
/** /**
* Creates a new instance of this Jail Vote manager. * Creates a new instance of this Jail Vote manager.
* *
* @param plugin the {@link JailMain} instance
* @throws Exception When it can't load the time correctly * @throws Exception When it can't load the time correctly
*/ */
protected JailVoteManager(JailMain plugin) throws Exception { protected JailVoteManager(JailMain plugin) throws Exception {
@ -45,7 +46,11 @@ public class JailVoteManager {
this.minYes = plugin.getConfig().getInt(Settings.JAILMINYESVOTES.getPath()); this.minYes = plugin.getConfig().getInt(Settings.JAILMINYESVOTES.getPath());
} }
/** Gets all the votes to jail someone. */ /**
* Gets all the votes to jail someone.
*
* @return HashMap of all the votes
*/
public HashMap<String, JailVote> getVotes() { public HashMap<String, JailVote> getVotes() {
return this.votes; return this.votes;
} }
@ -121,17 +126,29 @@ public class JailVoteManager {
return this.votes.containsKey(name); return this.votes.containsKey(name);
} }
/** Returns the nice formatted time of how long a vote is open. */ /**
* Returns the nice formatted time of how long a vote is open.
*
* @return The vote length description
*/
public String getTimerLengthDescription() { public String getTimerLengthDescription() {
return this.timerDesc; return this.timerDesc;
} }
/** Returns the minimum amount of yes votes required to jail someone. */ /**
* Returns the minimum amount of yes votes required to jail someone.
*
* @return Minimum amount of votes required.
*/
public int getMinimumYesVotes() { public int getMinimumYesVotes() {
return this.minYes; return this.minYes;
} }
/** Gets the current running tasks ids. */ /**
* Gets the current running tasks ids.
*
* @return HashMap of all the current current tasks
*/
public HashMap<String, Integer> getRunningTasks() { public HashMap<String, Integer> getRunningTasks() {
return this.tasks; return this.tasks;
} }
@ -156,6 +173,7 @@ public class JailVoteManager {
* Calculates the votes, determining whether there are enough votes to jail the person or not. * Calculates the votes, determining whether there are enough votes to jail the person or not.
* *
* @param v the {@link JailVote} to do the calculation of. * @param v the {@link JailVote} to do the calculation of.
* @return the {@link JailVoteResult} of the vote.
*/ */
public JailVoteResult doTheVoteCalculation(JailVote v) { public JailVoteResult doTheVoteCalculation(JailVote v) {
JailVoteResult result; JailVoteResult result;

View File

@ -5,7 +5,7 @@ import com.graywolf336.jail.interfaces.IJailStickManager;
/** /**
* The static api interface for Jail plugin. * The static api interface for Jail plugin.
* *
* <p /> * <br /><br />
* *
* If you're looking for non-static methods, please see the * If you're looking for non-static methods, please see the
* {@link JailMain} interface. * {@link JailMain} interface.

View File

@ -32,7 +32,7 @@ import com.graywolf336.jail.interfaces.ICell;
/** /**
* Provides methods, non-statically, that do the preparing of jails, jailing, etc. * Provides methods, non-statically, that do the preparing of jails, jailing, etc.
* *
* <p /> * <br /><br />
* *
* <ul> * <ul>
* <li>{@link #prepareJail(Jail, ICell, Player, Prisoner) preparejail}</li> * <li>{@link #prepareJail(Jail, ICell, Player, Prisoner) preparejail}</li>
@ -66,7 +66,7 @@ public class PrisonerManager {
/** /**
* Does everything preparing for the jailing of the provided prisoner, if they are online it forwards it to {@link #jailPrisoner(Jail, ICell, Player, Prisoner)}. * Does everything preparing for the jailing of the provided prisoner, if they are online it forwards it to {@link #jailPrisoner(Jail, ICell, Player, Prisoner)}.
* *
* <p /> * <br /><br />
* *
* In this we do the following: * In this we do the following:
* <ol> * <ol>
@ -88,7 +88,6 @@ public class PrisonerManager {
* @throws JailRequiredException if the jail provided is null. * @throws JailRequiredException if the jail provided is null.
* @throws PrisonerAlreadyJailedException if the prisoner is already jailed. * @throws PrisonerAlreadyJailedException if the prisoner is already jailed.
* @throws PrisonerRequiredException if the prisoner's data provided is null. * @throws PrisonerRequiredException if the prisoner's data provided is null.
*
*/ */
public void prepareJail(final Jail jail, ICell cell, final Player player, final Prisoner prisoner) throws JailRequiredException, PrisonerAlreadyJailedException, PrisonerRequiredException { public void prepareJail(final Jail jail, ICell cell, final Player player, final Prisoner prisoner) throws JailRequiredException, PrisonerAlreadyJailedException, PrisonerRequiredException {
//Do some checks of whether the passed params are null. //Do some checks of whether the passed params are null.
@ -373,7 +372,9 @@ public class PrisonerManager {
/** /**
* Schedules a prisoner to be released, this method is to be used <strong>async</strong>. * Schedules a prisoner to be released, this method is to be used <strong>async</strong>.
* *
* <br /><br />
*
* If you're wanting to unjail a prisoner, see the {@link #unJail(Jail, ICell, Player, Prisoner, CommandSender)} method. * If you're wanting to unjail a prisoner, see the {@link #unJail(Jail, ICell, Player, Prisoner, CommandSender)} method.
* *
* @param prisoner to be released. * @param prisoner to be released.
@ -419,7 +420,7 @@ public class PrisonerManager {
/** /**
* Unjails a prisoner, <strong>sync</strong>, from jail, removing all their data. * Unjails a prisoner, <strong>sync</strong>, from jail, removing all their data.
* *
* <p /> * <br /><br />
* *
* Throws an exception if either the jail is null or the prisoner is null. * Throws an exception if either the jail is null or the prisoner is null.
* *
@ -564,7 +565,7 @@ public class PrisonerManager {
/** /**
* Forcefully unjails a {@link Prisoner prisoner} from {@link Jail}. * Forcefully unjails a {@link Prisoner prisoner} from {@link Jail}.
* *
* <p /> * <br /><br />
* *
* This method forcefully removes all the references to this prisoner, * This method forcefully removes all the references to this prisoner,
* meaning if they're offline the following won't happened: * meaning if they're offline the following won't happened:
@ -576,7 +577,7 @@ public class PrisonerManager {
* *
* But if they're online, it goes through the regular unjailing methods. * But if they're online, it goes through the regular unjailing methods.
* *
* <p /> * <br /><br />
* *
* @param prisoner to release * @param prisoner to release
* @param sender who is releasing the prisoner, <em>can be null</em> * @param sender who is releasing the prisoner, <em>can be null</em>
@ -592,7 +593,7 @@ public class PrisonerManager {
* Forcefully unjails a {@link Prisoner prisoner} from {@link Jail}. * Forcefully unjails a {@link Prisoner prisoner} from {@link Jail}.
* *
* *
* <p /> * <br /><br />
* *
* This method forcefully removes all the references to this prisoner, * This method forcefully removes all the references to this prisoner,
* meaning if they're offline the following won't happened: * meaning if they're offline the following won't happened:
@ -604,7 +605,7 @@ public class PrisonerManager {
* *
* But if they're online, it goes through the regular unjailing methods. * But if they're online, it goes through the regular unjailing methods.
* *
* <p /> * <br /><br />
* *
* @param jail the prisoner is in * @param jail the prisoner is in
* @param cell the prisoner is in, <em>can be null</em> * @param cell the prisoner is in, <em>can be null</em>

View File

@ -155,7 +155,11 @@ public class Update {
} }
} }
/** Returns true if there is an update needed, false if not. */ /**
* Returns true if there is an update needed, false if not.
*
* @return Whether an update is available
*/
public boolean isAvailable() { public boolean isAvailable() {
return this.needed; return this.needed;
} }
@ -165,7 +169,11 @@ public class Update {
return this.version; return this.version;
} }
/** Returns the new file url. */ /**
* Returns the new file url.
*
* @return New file's url
*/
public String getFileUrl() { public String getFileUrl() {
return this.fileUrl; return this.fileUrl;
} }

View File

@ -57,7 +57,7 @@ public class Util {
/** /**
* Checks if two numbers are inside a point, or something. * Checks if two numbers are inside a point, or something.
* *
* <p /> * <br /><br />
* *
* @param loc The location. * @param loc The location.
* @param first The first point * @param first The first point
@ -148,12 +148,23 @@ public class Util {
return result.toString(); return result.toString();
} }
/** Returns a colorful message from the color codes. */ /**
* Returns a colorful message from the color codes.
*
* @param message the message to colorize
* @return the colorized message
*/
public static String getColorfulMessage(String message) { public static String getColorfulMessage(String message) {
return message.replaceAll("(?i)&([0-9abcdefklmnor])", "\u00A7$1"); return ChatColor.translateAlternateColorCodes('&', message);
} }
/** Returns a message with all the possible variables replaced. */ /**
* Returns a message with all the possible variables replaced.
*
* @param p the {@link Prisoner} data
* @param msg the message to replace everything in
* @return The message with everything replaced and colorized.
*/
public static String replaceAllVariables(Prisoner p, String msg) { public static String replaceAllVariables(Prisoner p, String msg) {
msg = msg.replace("%player%", p.getLastKnownName()) msg = msg.replace("%player%", p.getLastKnownName())
.replace("%uuid%", p.getUUID().toString()) .replace("%uuid%", p.getUUID().toString())
@ -172,7 +183,13 @@ public class Util {
return getColorfulMessage(msg); return getColorfulMessage(msg);
} }
/** Replaces all the variables in the messages with their possible values. */ /**
* Replaces all the variables in the messages with their possible values.
*
* @param p the {@link Prisoner} data.
* @param msgs the messages
* @return the messages but variables replaced and colorized
*/
public static String[] replaceAllVariables(Prisoner p, String... msgs) { public static String[] replaceAllVariables(Prisoner p, String... msgs) {
String[] results = new String[msgs.length]; String[] results = new String[msgs.length];
@ -182,7 +199,11 @@ public class Util {
return results; return results;
} }
/** Returns the wand used throughout the different creation steps. */ /**
* Returns the wand used throughout the different creation steps.
*
* @return The {@link ItemStack} to use for creation
*/
public static ItemStack getWand() { public static ItemStack getWand() {
ItemStack wand = new ItemStack(Material.WOOD_SWORD); ItemStack wand = new ItemStack(Material.WOOD_SWORD);
ItemMeta meta = wand.getItemMeta(); ItemMeta meta = wand.getItemMeta();
@ -197,7 +218,6 @@ public class Util {
} }
/** /**
*
* Converts a string like '20minutes' into the appropriate amount of the given unit. * Converts a string like '20minutes' into the appropriate amount of the given unit.
* *
* @param time in a string to convert. * @param time in a string to convert.
@ -298,7 +318,11 @@ public class Util {
signLines = lines; signLines = lines;
} }
/** Gets all the lines which go on the cell signs. */ /**
* Gets all the lines which go on the cell signs.
*
* @return the strings for the signs
*/
public static String[] getSignLines() { public static String[] getSignLines() {
return signLines; return signLines;
} }
@ -325,7 +349,7 @@ public class Util {
* *
* @param playerInventory to turn into an array of strings. * @param playerInventory to turn into an array of strings.
* @return Array of strings: [ main content, armor content ] * @return Array of strings: [ main content, armor content ]
* @throws IllegalStateException * @throws IllegalStateException if any of the {@link ItemStack}s couldn't be parsed
*/ */
public static String[] playerInventoryToBase64(PlayerInventory playerInventory) throws IllegalStateException { public static String[] playerInventoryToBase64(PlayerInventory playerInventory) throws IllegalStateException {
//get the main content part, this doesn't return the armor //get the main content part, this doesn't return the armor
@ -339,13 +363,13 @@ public class Util {
* *
* A method to serialize an {@link ItemStack} array to Base64 String. * A method to serialize an {@link ItemStack} array to Base64 String.
* *
* <p /> * <br /><br />
* *
* Based off of {@link #toBase64(Inventory)}. * Based off of {@link #toBase64(Inventory)}.
* *
* @param items to turn into a Base64 String. * @param items to turn into a Base64 String.
* @return Base64 string of the items. * @return Base64 string of the items.
* @throws IllegalStateException * @throws IllegalStateException if any of the {@link ItemStack}s couldn't be parsed
*/ */
public static String itemStackArrayToBase64(ItemStack[] items) throws IllegalStateException { public static String itemStackArrayToBase64(ItemStack[] items) throws IllegalStateException {
try { try {
@ -371,16 +395,14 @@ public class Util {
/** /**
* A method to serialize an inventory to Base64 string. * A method to serialize an inventory to Base64 string.
* *
* <p /> * <br /><br />
* *
* Special thanks to Comphenix in the Bukkit forums or also known * Special thanks to Comphenix in the Bukkit forums or also known
* as aadnk on GitHub. * as aadnk on GitHub. <a href="https://gist.github.com/aadnk/8138186">Original Source</a>
*
* <a href="https://gist.github.com/aadnk/8138186">Original Source</a>
* *
* @param inventory to serialize * @param inventory to serialize
* @return Base64 string of the provided inventory * @return Base64 string of the provided inventory
* @throws IllegalStateException * @throws IllegalStateException if any of the {@link ItemStack}s couldn't be parsed
*/ */
public static String toBase64(Inventory inventory) throws IllegalStateException { public static String toBase64(Inventory inventory) throws IllegalStateException {
try { try {
@ -407,7 +429,7 @@ public class Util {
* *
* A method to get an {@link Inventory} from an encoded, Base64, string. * A method to get an {@link Inventory} from an encoded, Base64, string.
* *
* <p /> * <br /><br />
* *
* Special thanks to Comphenix in the Bukkit forums or also known * Special thanks to Comphenix in the Bukkit forums or also known
* as aadnk on GitHub. * as aadnk on GitHub.
@ -416,7 +438,7 @@ public class Util {
* *
* @param data Base64 string of data containing an inventory. * @param data Base64 string of data containing an inventory.
* @return Inventory created from the Base64 string. * @return Inventory created from the Base64 string.
* @throws IOException * @throws IOException if we were unable to parse the base64 string
*/ */
public static Inventory fromBase64(String data) throws IOException { public static Inventory fromBase64(String data) throws IOException {
if(data.isEmpty()) return Bukkit.getServer().createInventory(null, 0); if(data.isEmpty()) return Bukkit.getServer().createInventory(null, 0);
@ -441,13 +463,13 @@ public class Util {
/** /**
* Gets an array of ItemStacks from Base64 string. * Gets an array of ItemStacks from Base64 string.
* *
* <p /> * <br /><br />
* *
* Base off of {@link #fromBase64(String)}. * Base off of {@link #fromBase64(String)}.
* *
* @param data Base64 string to convert to ItemStack array. * @param data Base64 string to convert to ItemStack array.
* @return ItemStack array created from the Base64 string. * @return ItemStack array created from the Base64 string.
* @throws IOException * @throws IOException if we was unable to parse the base64 string
*/ */
public static ItemStack[] itemStackArrayFromBase64(String data) throws IOException { public static ItemStack[] itemStackArrayFromBase64(String data) throws IOException {
if(data.isEmpty()) return new ItemStack[] {}; if(data.isEmpty()) return new ItemStack[] {};

View File

@ -97,6 +97,10 @@ public class AnyCell implements ICell {
public boolean hasChest() { public boolean hasChest() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public boolean useChest() {
throw new UnsupportedOperationException();
}
public boolean setChanged(boolean changed) { public boolean setChanged(boolean changed) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View File

@ -16,12 +16,20 @@ public class CachePrisoner {
this.p = prisoner; this.p = prisoner;
} }
/** Gets the Jail this cache is in. */ /**
* Gets the {@link Jail} this cache is in.
*
* @return the {@link Jail} instance
*/
public Jail getJail() { public Jail getJail() {
return this.jail; return this.jail;
} }
/** Gets the Prisoner in this cache. */ /**
* Gets the {@link Prisoner} in this cache.
*
* @return the {@link Prisoner} instance
*/
public Prisoner getPrisoner() { public Prisoner getPrisoner() {
return this.p; return this.p;
} }

View File

@ -220,6 +220,10 @@ public class Cell implements ICell {
}else }else
return false; return false;
} }
public boolean useChest() {
return this.chest != null;
}
public boolean setChanged(boolean changed) { public boolean setChanged(boolean changed) {
return this.changed = changed; return this.changed = changed;

View File

@ -22,22 +22,38 @@ public class ConfirmPlayer {
this.expires = System.currentTimeMillis() + 10000L; this.expires = System.currentTimeMillis() + 10000L;
} }
/** Returns the name of the thing needing to confirm. */ /**
* Returns the name of the thing needing to confirm.
*
* @return the name of what is being confirmed
*/
public String getName() { public String getName() {
return this.name; return this.name;
} }
/** Returns the initial arguments they sent with their command. */ /**
* Returns the initial arguments they sent with their command.
*
* @return the initial arguments of the original command
*/
public String[] getArguments() { public String[] getArguments() {
return this.args; return this.args;
} }
/** Returns what they are {@link Confirmation confirming}. */ /**
* Returns what they are {@link Confirmation confirming}.
*
* @return the {@link Confirmation} of what they're confirming
*/
public Confirmation getConfirming() { public Confirmation getConfirming() {
return this.confirm; return this.confirm;
} }
/** Returns the time in milliseconds their confirmation time frame expires. */ /**
* Returns the time in milliseconds their confirmation time frame expires.
*
* @return the time their confirming expires
*/
public Long getExpiryTime() { public Long getExpiryTime() {
return this.expires; return this.expires;
} }

View File

@ -97,6 +97,10 @@ public class NoCell implements ICell {
public boolean hasChest() { public boolean hasChest() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public boolean useChest() {
throw new UnsupportedOperationException();
}
public boolean setChanged(boolean changed) { public boolean setChanged(boolean changed) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View File

@ -6,7 +6,6 @@ package com.graywolf336.jail.beans;
* @author graywolf336 * @author graywolf336
* @version 1.0.1 * @version 1.0.1
* @since 3.0.0 * @since 3.0.0
*
*/ */
public class Stick { public class Stick {
private String jail, reason; private String jail, reason;
@ -28,24 +27,36 @@ public class Stick {
this.health = health; this.health = health;
} }
/** Gets the name of the jail a player will be sent when jailed via this jail stick. */ /**
* Gets the name of the jail a player will be sent when jailed via this jail stick.
*
* @return the name of the jail this stick puts people in
*/
public String getJail() { public String getJail() {
return this.jail; return this.jail;
} }
/** Gets the reason a player will be jailed for when jailed via this stick. */ /**
* Gets the reason a player will be jailed for when jailed via this stick.
*
* @return the reason of jailing used by this stick
*/
public String getReason() { public String getReason() {
return this.reason; return this.reason;
} }
/** Gets the amount of time a player has to serve when they are jailed via this stick. */ /**
* Gets the amount of time a player has to serve when they are jailed via this stick.
*
* @return the amount of time someone is jailed via this stick
*/
public long getTime() { public long getTime() {
return this.time; return this.time;
} }
/** Gets the amount of health a player has to have before getting jailed via this stick. /** Gets the amount of health a player has to have before getting jailed via this stick.
* *
* <p /> * <br /><br />
* *
* See here for reference: http://dev.bukkit.org/bukkit-plugins/jail/tickets/415/ * See here for reference: http://dev.bukkit.org/bukkit-plugins/jail/tickets/415/
*/ */

View File

@ -8,7 +8,7 @@ import com.graywolf336.jail.JailMain;
/** /**
* Event thrown after the plugin is reloaded, internal usage only. * Event thrown after the plugin is reloaded, internal usage only.
* *
* <p /> * <br /><br />
* *
* This event is called right after the plugin and mostly everything has reloaded. * This event is called right after the plugin and mostly everything has reloaded.
* We listen to this event for updating various items in classes which are only * We listen to this event for updating various items in classes which are only

View File

@ -10,7 +10,7 @@ import com.graywolf336.jail.interfaces.ICell;
/** /**
* Event thrown when a prisoner is offline put will be put into jail next time they come online. * Event thrown when a prisoner is offline put will be put into jail next time they come online.
* *
* <p /> * <br /><br />
* *
* This event is called before everything for the jailing takes place, as the player is offline. * This event is called before everything for the jailing takes place, as the player is offline.
* This event is called for informative purposes, see {@link PrePrisonerJailedEvent} * This event is called for informative purposes, see {@link PrePrisonerJailedEvent}

View File

@ -14,7 +14,7 @@ import com.graywolf336.jail.interfaces.ICell;
/** /**
* Event thrown before we a player is jailed by someone hitting them with a {@link Stick jail stick}. * Event thrown before we a player is jailed by someone hitting them with a {@link Stick jail stick}.
* *
* <p /> * <br /><br />
* *
* This event is called right before we actually jail a player, and is cancellable. * This event is called right before we actually jail a player, and is cancellable.
* *

View File

@ -13,7 +13,7 @@ import com.graywolf336.jail.interfaces.ICell;
/** /**
* Event thrown before we are jailing a player, both offline and online players. * Event thrown before we are jailing a player, both offline and online players.
* *
* <p /> * <br /><br />
* *
* This event is called right before we actually jail a player, and is cancellable, whether the player is offline or online, getPlayer() will always return null if isOnline() return false. * This event is called right before we actually jail a player, and is cancellable, whether the player is offline or online, getPlayer() will always return null if isOnline() return false.
* *

View File

@ -11,7 +11,7 @@ import com.graywolf336.jail.interfaces.ICell;
/** /**
* Event thrown after a prisoner is released. * Event thrown after a prisoner is released.
* *
* <p /> * <br /><br />
* *
* This event is called before everything for the releasing takes place. * This event is called before everything for the releasing takes place.
* This event is called for informative purposes, see {@link PrisonerReleasedEvent} * This event is called for informative purposes, see {@link PrisonerReleasedEvent}

View File

@ -12,7 +12,7 @@ import com.graywolf336.jail.beans.Prisoner;
/** /**
* Event thrown before we transfer a prisoner, both offline and online prisoner. * Event thrown before we transfer a prisoner, both offline and online prisoner.
* *
* <p /> * <br /><br />
* *
* This event is called right before we actually transfer a prisoner, and is cancellable, whether the prisoner is offline or online, getPlayer() will always return null if isOnline() return false. * This event is called right before we actually transfer a prisoner, and is cancellable, whether the prisoner is offline or online, getPlayer() will always return null if isOnline() return false.
* *
@ -103,22 +103,38 @@ public class PrePrisonerTransferredEvent extends Event implements Cancellable {
this.targetCell = cell; this.targetCell = cell;
} }
/** Gets the {@link Prisoner} data for this prisoner. */ /**
* Gets the {@link Prisoner} data for this prisoner.
*
* @return the {@link Prisoner} instance
*/
public Prisoner getPrisoner() { public Prisoner getPrisoner() {
return this.prisoner; return this.prisoner;
} }
/** Gets the instance of the player being transferred <strong>but will return null if {@link #isOnline()} returns false</strong>. */ /**
* Gets the instance of the player being transferred <strong>but will return null if they're not online</strong>.
*
* @return the {@link Player} instance
*/
public Player getPlayer() { public Player getPlayer() {
return this.player; return this.player;
} }
/** Gets whether the prisoner being transferred is online or not. */ /**
* Gets whether the prisoner being transferred is online or not.
*
* @return Whether the player is online or not
*/
public boolean isPlayerOnline() { public boolean isPlayerOnline() {
return player != null; return player != null;
} }
/** Gets the name of what is transferring this prisoner. */ /**
* Gets the name of what is transferring this prisoner.
*
* @return name of the person who started the transfer
*/
public String getTransferor() { public String getTransferor() {
return this.transferor; return this.transferor;
} }

View File

@ -11,7 +11,7 @@ import com.graywolf336.jail.beans.Prisoner;
/** /**
* Event thrown after a prisoner is put into jail. * Event thrown after a prisoner is put into jail.
* *
* <p /> * <br /><br />
* *
* This event is called after everything for the jailing takes place. * This event is called after everything for the jailing takes place.
* This event is called for informative purposes, see {@link PrePrisonerJailedEvent} * This event is called for informative purposes, see {@link PrePrisonerJailedEvent}

View File

@ -11,7 +11,7 @@ import com.graywolf336.jail.beans.Prisoner;
/** /**
* Event thrown after a prisoner is released. * Event thrown after a prisoner is released.
* *
* <p /> * <br /><br />
* *
* This event is called after everything for the releasing takes place. * This event is called after everything for the releasing takes place.
* This event is called for informative purposes, see {@link PrePrisonerReleasedEvent} * This event is called for informative purposes, see {@link PrePrisonerReleasedEvent}

View File

@ -11,7 +11,7 @@ import com.graywolf336.jail.beans.Prisoner;
/** /**
* Event thrown after we transfer a prisoner, both an offline and an online prisoner. * Event thrown after we transfer a prisoner, both an offline and an online prisoner.
* *
* <p /> * <br /><br />
* *
* This event is called after we transfer the prisoner whether the prisoner is offline or online, getPlayer() will always return null if isOnline() return false. * This event is called after we transfer the prisoner whether the prisoner is offline or online, getPlayer() will always return null if isOnline() return false.
* *

View File

@ -11,22 +11,38 @@ import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.beans.SimpleLocation; import com.graywolf336.jail.beans.SimpleLocation;
public interface ICell { public interface ICell {
/** Gets the id of the cell in the database, <strong>internal usage only</strong> */ /**
* Gets the id of the cell in the database, <strong>internal usage only</strong>
*
* @return database's id, don't use for external reasons
*/
public int getDatabaseID(); public int getDatabaseID();
/** Gets the name of the cell. */ /**
* Gets the name of the cell.
*
* @return Cell's name
*/
public String getName(); public String getName();
/** Sets the prisoner in this cell. */ /** Sets the prisoner in this cell. */
public void setPrisoner(Prisoner prisoner); public void setPrisoner(Prisoner prisoner);
/** Gets the prisoner being held in this cell. */ /**
* Gets the prisoner being held in this cell.
*
* @return the {@link Prisoner} instance in this cell, null if no prisoner
*/
public Prisoner getPrisoner(); public Prisoner getPrisoner();
/** Nullifies the prisoner data. */ /** Nullifies the prisoner data. */
public void removePrisoner(); public void removePrisoner();
/** Returns true if there is currently a prisoner in this cell. */ /**
* Returns true if there is currently a prisoner in this cell.
*
* @return Whether there is a prisoner or not
*/
public boolean hasPrisoner(); public boolean hasPrisoner();
/** Adds all the given signs to the cell. */ /** Adds all the given signs to the cell. */
@ -35,19 +51,39 @@ public interface ICell {
/** Adds a sign to the cell. */ /** Adds a sign to the cell. */
public void addSign(SimpleLocation sign); public void addSign(SimpleLocation sign);
/** Returns all the signs for this cell. */ /**
* Returns all the signs for this cell.
*
* @return All the signs used by this cell
*/
public HashSet<SimpleLocation> getSigns(); public HashSet<SimpleLocation> getSigns();
/** Checks if there are any signs for this cell. */ /**
* Checks if there are any signs for this cell.
*
* @return Whether this cell has signs or not.
*/
public boolean hasSigns(); public boolean hasSigns();
/** Returns the entire list of signs in a string. */ /**
* Returns the entire list of signs in a string.
*
* @return the serialized string of sign locations
*/
public String getSignString(); public String getSignString();
/** Gets a list of all the signs which are invalid (not signs anymore). */ /**
* Gets a list of all the signs which are invalid (not signs anymore).
*
* @return Returns a list of all the invalid signs
*/
public List<String> getInvalidSigns(); public List<String> getInvalidSigns();
/** Removes all the signs which are no longer sign blocks. */ /**
* Removes all the signs which are no longer sign blocks.
*
* @return The signs cleaned up
*/
public List<String> cleanSigns(); public List<String> cleanSigns();
/** /**
@ -60,7 +96,11 @@ public interface ICell {
/** Sets the location of where the prisoner will be teleported at when jailed here. */ /** Sets the location of where the prisoner will be teleported at when jailed here. */
public void setTeleport(SimpleLocation location); public void setTeleport(SimpleLocation location);
/** Gets the teleport location where the prisoner will be teleported at when jailed here. */ /**
* Gets the teleport location where the prisoner will be teleported at when jailed here.
*
* @return the teleport in {@link Location location}
*/
public Location getTeleport(); public Location getTeleport();
/** Sets the location of the chest. */ /** Sets the location of the chest. */
@ -86,6 +126,13 @@ public interface ICell {
* @return true if there is a chest, false if there isn't. * @return true if there is a chest, false if there isn't.
*/ */
public boolean hasChest(); public boolean hasChest();
/**
* Checks to see if this cell uses a chest or not.
*
* @return Whether there is a location for chest stored.
*/
public boolean useChest();
/** /**
* Sets whether this cell has been changed or not. * Sets whether this cell has been changed or not.
@ -95,6 +142,10 @@ public interface ICell {
*/ */
public boolean setChanged(boolean changed); public boolean setChanged(boolean changed);
/** Gets whether the Cell has changed from the last save or not. */ /**
* Gets whether the Cell has changed from the last save or not.
*
* @return Whether the cell has changed or not since last save
*/
public boolean hasChanged(); public boolean hasChanged();
} }

View File

@ -9,13 +9,25 @@ import com.graywolf336.jail.beans.Prisoner;
public interface IJailPayManager { public interface IJailPayManager {
/** Checks if paying for infinite is enabled. */ /**
* Checks if paying for infinite is enabled.
*
* @return Whether infinite paying is enabled.
*/
public boolean isInfiniteEnabled(); public boolean isInfiniteEnabled();
/** Checks if paying for timed is enabled. */ /**
* Checks if paying for timed is enabled.
*
* @return Whether time paying is enabled.
*/
public boolean isTimedEnabled(); public boolean isTimedEnabled();
/** Gets how much it cost per minute in string format. */ /**
* Gets how much it cost per minute in string format.
*
* @return How much it costs per minute
*/
public String getCostPerMinute(); public String getCostPerMinute();
/** /**
@ -26,10 +38,19 @@ public interface IJailPayManager {
*/ */
public double calculateBill(Prisoner prisoner); public double calculateBill(Prisoner prisoner);
/** Gets how many minutes someone is paying for (rounds to the lowest number). */ /**
* Gets how many minutes someone is paying for (rounds to the lowest number).
*
* @param amount amount of money
* @return the amount of time they're paying for
*/
public long getMinutesPayingFor(double amount); public long getMinutesPayingFor(double amount);
/** Returns if we are using items for payment instead of economy. */ /**
* Returns if we are using items for payment instead of economy.
*
* @return Whether paying using items is enabled
*/
public boolean usingItemsForPayment(); public boolean usingItemsForPayment();
/** /**
@ -56,9 +77,17 @@ public interface IJailPayManager {
*/ */
public void pay(Player player, double amount); public void pay(Player player, double amount);
/** Gets the name of the item in nice capitals. */ /**
* Gets the name of the item in nice capitals.
*
* @return The currency name in nice capital letters.
*/
public String getCurrencyName(); public String getCurrencyName();
/** Returns the economy provider to do transaction with. */ /**
* Returns the economy provider to do transaction with.
*
* @return the {@link Economy} instance
*/
public Economy getEconomy(); public Economy getEconomy();
} }

View File

@ -19,7 +19,7 @@ import com.graywolf336.jail.events.PrisonerTransferredEvent;
/** /**
* The listen for all events which need to add/remove to the prisoner cache. * The listen for all events which need to add/remove to the prisoner cache.
* *
* <p /> * <br /><br />
* *
* These listeners add and remove prisoner cache objects to the cache, * These listeners add and remove prisoner cache objects to the cache,
* this way we gain performance for servers which have a high amount * this way we gain performance for servers which have a high amount

View File

@ -5,7 +5,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;