Do some work on the JavaDoc

This commit is contained in:
graywolf336 2013-12-28 19:50:55 -06:00
parent ce457fc7bf
commit 4ab48b3659
6 changed files with 59 additions and 14 deletions

View File

@ -18,8 +18,8 @@ import com.graywolf336.jail.enums.LangString;
* Handles all the saving and loading of the plugin's data.
*
* @author graywolf336
* @since 3.0.0
* @version 1.0.0
* @since 2.x.x
* @version 3.0.0
*
*/
public class JailIO {

View File

@ -12,6 +12,13 @@ import com.graywolf336.jail.listeners.BlockListener;
import com.graywolf336.jail.listeners.EntityListener;
import com.graywolf336.jail.listeners.PlayerListener;
/**
* The main class for this Jail plugin, holds instances of vital classes.
*
* @author graywolf336
* @since 1.x.x
* @version 3.0.0
*/
public class JailMain extends JavaPlugin {
private CommandHandler cmdHand;
private JailIO io;

View File

@ -14,6 +14,13 @@ import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.enums.LangString;
import com.graywolf336.jail.enums.Settings;
/**
* Provides methods, non-statically, that do the preparing of jails and handle all the good stuff like that.
*
* @author graywolf336
* @since 2.x.x
* @version 3.0.0
*/
public class PrisonerManager {
private JailMain pl;
@ -22,7 +29,7 @@ public class PrisonerManager {
}
/**
* Prepare the jailing of this player.
* Does everything preparing for the jailing of the provided prisoner, if they are online it forwards it to {@link #jailPrisoner(Jail, Cell, Player, Prisoner)}.
*
* <p />
*
@ -39,10 +46,10 @@ public class PrisonerManager {
* <li>If we log the jailing to console <em>and</em> we haven't broadcasted it, then we log it to the console.</li>
* </ol>
*
* @param jail The jail instance we are sending this prisoner to
* @param cell The name of the cell we are sending this prisoner to
* @param player The player we are preparing the jail for.
* @param prisoner The prisoner file.
* @param jail The {@link Jail jail instance} we are sending this prisoner to
* @param cell The name of the {@link Cell cell} we are sending this prisoner to
* @param player The {@link Player player} we are preparing the jail for.
* @param prisoner The {@link Prisoner prisoner} file.
* @throws Exception if the jail or prisoner are null.
*/
public void prepareJail(Jail jail, Cell cell, Player player, Prisoner prisoner) throws Exception {
@ -259,12 +266,14 @@ public class PrisonerManager {
/**
* Unjails a prisoner from jail, removing all their data.
*
* TODO: Finish this documentation
* <p />
*
* @param jail
* @param cell
* @param player
* @param prisoner
* Throws an exception if either the jail is null or the prisoner is null.
*
* @param jail where the prisoner is located at
* @param cell which the prisoner is in, can be null
* @param player instance for the prisoner we're unjailing
* @param prisoner data where everything resides
* @throws Exception
*/
public void unJail(Jail jail, Cell cell, Player player, Prisoner prisoner) throws Exception {

View File

@ -20,6 +20,13 @@ import org.bukkit.util.io.BukkitObjectInputStream;
import org.bukkit.util.io.BukkitObjectOutputStream;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
/**
* Provides a variety of methods, static, that are used throughout the plugin.
*
* @author graywolf336
* @since 2.x.x
* @version 3.0.0
*/
public class Util {
private final static Pattern DURATION_PATTERN = Pattern.compile("^(\\d+)\\s*(m(?:inute)?s?|h(?:ours?)?|d(?:ays?)?|s(?:econd)?s?)?$", Pattern.CASE_INSENSITIVE);
@ -34,12 +41,13 @@ public class Util {
/**
* Checks if two numbers are inside a point, or something.
*
* <p />
*
* @param loc The location.
* @param first The first point
* @param second The second point
* @return True if they are inside, false if not.
* @return true if they are inside, false if not.
*/
private static boolean isInside(int loc, int first, int second) {
int point1 = 0;
@ -60,6 +68,7 @@ public class Util {
return message.replaceAll("(?i)&([0-9abcdefklmnor])", "\u00A7$1");
}
/** Returns the wand used throughout the different creation steps. */
public static ItemStack getWand() {
ItemStack wand = new ItemStack(Material.WOOD_SWORD);
ItemMeta meta = wand.getItemMeta();

View File

@ -16,6 +16,16 @@ public class SimpleLocation {
private double x, y, z;
private float yaw, pitch;
/**
* Creates a new SimpleLocation with each detail provided separately.
*
* @param world as a string
* @param x coordinate as a double
* @param y coordinate as a double
* @param z coordinate as a double
* @param yaw as a float
* @param pitch as a float
*/
public SimpleLocation(String world, double x, double y, double z, float yaw, float pitch) {
this.world = world;
this.x = x;
@ -25,6 +35,11 @@ public class SimpleLocation {
this.pitch = pitch;
}
/**
* Creates a new SimpleLocation with all the detail provided from {@link Location}.
*
* @param location to convert to a SimpleLocation
*/
public SimpleLocation(Location location) {
this.world = location.getWorld().getName();
this.x = location.getX();
@ -34,14 +49,17 @@ public class SimpleLocation {
this.pitch = location.getPitch();
}
/** Returns the instance from Bukkit of the world this location is in. */
public World getWorld() {
return Bukkit.getWorld(world);
}
/** Returns the name of the world this location is in. */
public String getWorldName() {
return this.world;
}
/** Returns a new {@link Location} from this SimpleLocation. */
public Location getLocation() {
return new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch);
}

View File

@ -10,7 +10,9 @@ import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.beans.Prisoner;
/**
* Event thrown when a player is fixing to be jailed, both offline and online players.
* Event thrown before we are jailing a player, both offline and online players.
*
* <p />
*
* 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.
*