Do some work on the JavaDoc
This commit is contained in:
parent
ce457fc7bf
commit
4ab48b3659
@ -18,8 +18,8 @@ import com.graywolf336.jail.enums.LangString;
|
|||||||
* Handles all the saving and loading of the plugin's data.
|
* Handles all the saving and loading of the plugin's data.
|
||||||
*
|
*
|
||||||
* @author graywolf336
|
* @author graywolf336
|
||||||
* @since 3.0.0
|
* @since 2.x.x
|
||||||
* @version 1.0.0
|
* @version 3.0.0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JailIO {
|
public class JailIO {
|
||||||
|
@ -12,6 +12,13 @@ import com.graywolf336.jail.listeners.BlockListener;
|
|||||||
import com.graywolf336.jail.listeners.EntityListener;
|
import com.graywolf336.jail.listeners.EntityListener;
|
||||||
import com.graywolf336.jail.listeners.PlayerListener;
|
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 {
|
public class JailMain extends JavaPlugin {
|
||||||
private CommandHandler cmdHand;
|
private CommandHandler cmdHand;
|
||||||
private JailIO io;
|
private JailIO io;
|
||||||
|
@ -14,6 +14,13 @@ import com.graywolf336.jail.beans.Prisoner;
|
|||||||
import com.graywolf336.jail.enums.LangString;
|
import com.graywolf336.jail.enums.LangString;
|
||||||
import com.graywolf336.jail.enums.Settings;
|
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 {
|
public class PrisonerManager {
|
||||||
private JailMain pl;
|
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 />
|
* <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>
|
* <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>
|
* </ol>
|
||||||
*
|
*
|
||||||
* @param jail The jail instance we are sending this prisoner to
|
* @param jail The {@link Jail jail instance} we are sending this prisoner to
|
||||||
* @param cell The name of the cell we are sending this prisoner to
|
* @param cell The name of the {@link Cell cell} we are sending this prisoner to
|
||||||
* @param player The player we are preparing the jail for.
|
* @param player The {@link Player player} we are preparing the jail for.
|
||||||
* @param prisoner The prisoner file.
|
* @param prisoner The {@link Prisoner prisoner} file.
|
||||||
* @throws Exception if the jail or prisoner are null.
|
* @throws Exception if the jail or prisoner are null.
|
||||||
*/
|
*/
|
||||||
public void prepareJail(Jail jail, Cell cell, Player player, Prisoner prisoner) throws Exception {
|
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.
|
* Unjails a prisoner from jail, removing all their data.
|
||||||
*
|
*
|
||||||
* TODO: Finish this documentation
|
* <p />
|
||||||
*
|
*
|
||||||
* @param jail
|
* Throws an exception if either the jail is null or the prisoner is null.
|
||||||
* @param cell
|
*
|
||||||
* @param player
|
* @param jail where the prisoner is located at
|
||||||
* @param prisoner
|
* @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
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void unJail(Jail jail, Cell cell, Player player, Prisoner prisoner) throws Exception {
|
public void unJail(Jail jail, Cell cell, Player player, Prisoner prisoner) throws Exception {
|
||||||
|
@ -20,6 +20,13 @@ import org.bukkit.util.io.BukkitObjectInputStream;
|
|||||||
import org.bukkit.util.io.BukkitObjectOutputStream;
|
import org.bukkit.util.io.BukkitObjectOutputStream;
|
||||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
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 {
|
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);
|
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.
|
* Checks if two numbers are inside a point, or something.
|
||||||
|
*
|
||||||
* <p />
|
* <p />
|
||||||
*
|
*
|
||||||
* @param loc The location.
|
* @param loc The location.
|
||||||
* @param first The first point
|
* @param first The first point
|
||||||
* @param second The second 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) {
|
private static boolean isInside(int loc, int first, int second) {
|
||||||
int point1 = 0;
|
int point1 = 0;
|
||||||
@ -60,6 +68,7 @@ public class Util {
|
|||||||
return message.replaceAll("(?i)&([0-9abcdefklmnor])", "\u00A7$1");
|
return message.replaceAll("(?i)&([0-9abcdefklmnor])", "\u00A7$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the wand used throughout the different creation steps. */
|
||||||
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();
|
||||||
|
@ -16,6 +16,16 @@ public class SimpleLocation {
|
|||||||
private double x, y, z;
|
private double x, y, z;
|
||||||
private float yaw, pitch;
|
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) {
|
public SimpleLocation(String world, double x, double y, double z, float yaw, float pitch) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@ -25,6 +35,11 @@ public class SimpleLocation {
|
|||||||
this.pitch = pitch;
|
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) {
|
public SimpleLocation(Location location) {
|
||||||
this.world = location.getWorld().getName();
|
this.world = location.getWorld().getName();
|
||||||
this.x = location.getX();
|
this.x = location.getX();
|
||||||
@ -34,14 +49,17 @@ public class SimpleLocation {
|
|||||||
this.pitch = location.getPitch();
|
this.pitch = location.getPitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the instance from Bukkit of the world this location is in. */
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return Bukkit.getWorld(world);
|
return Bukkit.getWorld(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the name of the world this location is in. */
|
||||||
public String getWorldName() {
|
public String getWorldName() {
|
||||||
return this.world;
|
return this.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns a new {@link Location} from this SimpleLocation. */
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch);
|
return new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,9 @@ import com.graywolf336.jail.beans.Jail;
|
|||||||
import com.graywolf336.jail.beans.Prisoner;
|
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.
|
* 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.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user