Fix javadoc build errors and fix #90
Attempt one at trying to fix the javadoc errors.
This commit is contained in:
parent
65635fe761
commit
63b43d1191
@ -8,7 +8,7 @@ import org.bukkit.Location;
|
||||
/**
|
||||
* Manages the handcuffing of players.
|
||||
*
|
||||
* <p />
|
||||
* <p> </p>
|
||||
*
|
||||
* Provides easy to use methods for adding,
|
||||
* removing, and checking if someone has
|
||||
|
@ -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) {
|
||||
int inital = storage == -1 ? -1 : storage;
|
||||
|
||||
@ -1008,7 +1013,7 @@ public class JailIO {
|
||||
cPS.setDouble(6, c.getTeleport().getYaw());
|
||||
cPS.setDouble(7, c.getTeleport().getPitch());
|
||||
|
||||
if(c.hasChest()) {
|
||||
if(c.useChest()) {
|
||||
cPS.setInt(8, c.getChestLocation().getBlockX());
|
||||
cPS.setInt(9, c.getChestLocation().getBlockY());
|
||||
cPS.setInt(10, c.getChestLocation().getBlockZ());
|
||||
|
@ -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() {
|
||||
return this.hcm;
|
||||
}
|
||||
|
||||
/** Gets the {@link JailIO} instance. */
|
||||
/**
|
||||
* Gets the {@link JailIO} instance.
|
||||
*
|
||||
* @return {@link JailIO} instance
|
||||
*/
|
||||
public JailIO getJailIO() {
|
||||
return this.io;
|
||||
}
|
||||
|
||||
/** Gets the {@link JailManager} instance. */
|
||||
/**
|
||||
* Gets the {@link JailManager} instance.
|
||||
*
|
||||
* @return {@link JailManager} instance
|
||||
*/
|
||||
public JailManager getJailManager() {
|
||||
return this.jm;
|
||||
}
|
||||
|
||||
/** Gets an instance of the {@link IJailPayManager}. */
|
||||
/**
|
||||
* Gets an instance of the {@link IJailPayManager}.
|
||||
*
|
||||
* @return {@link IJailPayManager}
|
||||
*/
|
||||
public IJailPayManager getJailPayManager() {
|
||||
return this.jpm;
|
||||
}
|
||||
|
||||
/** Gets the {@link PrisonerManager} instance. */
|
||||
/**
|
||||
* Gets the {@link PrisonerManager} instance.
|
||||
*
|
||||
* @return {@link PrisonerManager} instance
|
||||
*/
|
||||
public PrisonerManager getPrisonerManager() {
|
||||
return this.pm;
|
||||
}
|
||||
|
||||
/** Gets an instance of the {@link JailStickManager}. */
|
||||
/**
|
||||
* Gets an instance of the {@link JailStickManager}.
|
||||
*
|
||||
* @return {@link JailStickManager}
|
||||
*/
|
||||
public IJailStickManager getJailStickManager() {
|
||||
return this.jsm;
|
||||
}
|
||||
|
||||
/** Gets the {@link ScoreBoardManager} instance. */
|
||||
/**
|
||||
* Gets the {@link ScoreBoardManager} instance.
|
||||
*
|
||||
* @return {@link ScoreBoardManager} instance
|
||||
*/
|
||||
public ScoreBoardManager getScoreBoardManager() {
|
||||
return this.sbm;
|
||||
}
|
||||
|
||||
/** Gets the {@link JailVoteManager} instance. */
|
||||
/**
|
||||
* Gets the {@link JailVoteManager} instance.
|
||||
*
|
||||
* @return {@link JailVoteManager} instance
|
||||
*/
|
||||
public JailVoteManager getJailVoteManager() {
|
||||
return this.jvm;
|
||||
}
|
||||
|
||||
/** Gets the {@link Update} instance. */
|
||||
/**
|
||||
* Gets the {@link Update} instance.
|
||||
*
|
||||
* @return {@link Update} instance
|
||||
*/
|
||||
public Update getUpdate() {
|
||||
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) {
|
||||
this.debug = debug;
|
||||
|
||||
@ -397,7 +438,11 @@ public class JailMain extends JavaPlugin {
|
||||
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() {
|
||||
return this.debug;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.graywolf336.jail.steps.JailCreationSteps;
|
||||
/**
|
||||
* Handles all things related to jails.
|
||||
*
|
||||
* <p>
|
||||
* <p> </p>
|
||||
*
|
||||
* Stores the following:
|
||||
* <ul>
|
||||
@ -62,17 +62,29 @@ public class JailManager {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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.
|
||||
*
|
||||
* <p>
|
||||
* <br /><br />
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* 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());
|
||||
}
|
||||
|
||||
/** 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) {
|
||||
String message = "";
|
||||
|
||||
@ -592,7 +609,12 @@ public class JailManager {
|
||||
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) {
|
||||
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) {
|
||||
return this.jailCreators.get(name.toLowerCase());
|
||||
}
|
||||
@ -623,7 +650,12 @@ public class JailManager {
|
||||
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) {
|
||||
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) {
|
||||
return this.cellCreators.get(name.toLowerCase());
|
||||
}
|
||||
@ -655,12 +692,20 @@ public class JailManager {
|
||||
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() {
|
||||
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() {
|
||||
return this.ccs;
|
||||
}
|
||||
@ -676,23 +721,43 @@ public class JailManager {
|
||||
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) {
|
||||
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) {
|
||||
//If the expiry time is LESS than the current time, it has expired
|
||||
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) {
|
||||
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) {
|
||||
return this.confirms.get(name).getConfirming();
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import com.graywolf336.jail.events.PrisonerTimeChangeEvent;
|
||||
* @author graywolf336
|
||||
* @since 2.x.x
|
||||
* @version 3.0.0
|
||||
*
|
||||
*/
|
||||
public class JailTimer {
|
||||
private JailMain pl;
|
||||
@ -60,12 +59,16 @@ public class JailTimer {
|
||||
}, 1200L, 1200L);
|
||||
}
|
||||
|
||||
/** Returns the instance of this timer. */
|
||||
/**
|
||||
* Returns the instance of this timer.
|
||||
*
|
||||
* @return the {@link Timer} instance
|
||||
*/
|
||||
public Timer getTimer() {
|
||||
return this.timer;
|
||||
}
|
||||
|
||||
class TimeEvent implements Runnable {
|
||||
private class TimeEvent implements Runnable {
|
||||
public void run() {
|
||||
long timePassed = System.currentTimeMillis() - lastTime;
|
||||
lastTime = System.currentTimeMillis();
|
||||
|
@ -29,7 +29,8 @@ public class JailVoteManager {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
protected JailVoteManager(JailMain plugin) throws Exception {
|
||||
@ -45,7 +46,11 @@ public class JailVoteManager {
|
||||
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() {
|
||||
return this.votes;
|
||||
}
|
||||
@ -121,17 +126,29 @@ public class JailVoteManager {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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.
|
||||
*
|
||||
* @param v the {@link JailVote} to do the calculation of.
|
||||
* @return the {@link JailVoteResult} of the vote.
|
||||
*/
|
||||
public JailVoteResult doTheVoteCalculation(JailVote v) {
|
||||
JailVoteResult result;
|
||||
|
@ -5,7 +5,7 @@ import com.graywolf336.jail.interfaces.IJailStickManager;
|
||||
/**
|
||||
* The static api interface for Jail plugin.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* If you're looking for non-static methods, please see the
|
||||
* {@link JailMain} interface.
|
||||
|
@ -32,7 +32,7 @@ import com.graywolf336.jail.interfaces.ICell;
|
||||
/**
|
||||
* Provides methods, non-statically, that do the preparing of jails, jailing, etc.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* <ul>
|
||||
* <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)}.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* In this we do the following:
|
||||
* <ol>
|
||||
@ -88,7 +88,6 @@ public class PrisonerManager {
|
||||
* @throws JailRequiredException if the jail provided is null.
|
||||
* @throws PrisonerAlreadyJailedException if the prisoner is already jailed.
|
||||
* @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 {
|
||||
//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>.
|
||||
*
|
||||
*
|
||||
* <br /><br />
|
||||
*
|
||||
* If you're wanting to unjail a prisoner, see the {@link #unJail(Jail, ICell, Player, Prisoner, CommandSender)} method.
|
||||
*
|
||||
* @param prisoner to be released.
|
||||
@ -419,7 +420,7 @@ public class PrisonerManager {
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -564,7 +565,7 @@ public class PrisonerManager {
|
||||
/**
|
||||
* Forcefully unjails a {@link Prisoner prisoner} from {@link Jail}.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* This method forcefully removes all the references to this prisoner,
|
||||
* 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.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* @param prisoner to release
|
||||
* @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}.
|
||||
*
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* This method forcefully removes all the references to this prisoner,
|
||||
* 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.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* @param jail the prisoner is in
|
||||
* @param cell the prisoner is in, <em>can be null</em>
|
||||
|
@ -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() {
|
||||
return this.needed;
|
||||
}
|
||||
@ -165,7 +169,11 @@ public class Update {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
/** Returns the new file url. */
|
||||
/**
|
||||
* Returns the new file url.
|
||||
*
|
||||
* @return New file's url
|
||||
*/
|
||||
public String getFileUrl() {
|
||||
return this.fileUrl;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class Util {
|
||||
/**
|
||||
* Checks if two numbers are inside a point, or something.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* @param loc The location.
|
||||
* @param first The first point
|
||||
@ -148,12 +148,23 @@ public class Util {
|
||||
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) {
|
||||
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) {
|
||||
msg = msg.replace("%player%", p.getLastKnownName())
|
||||
.replace("%uuid%", p.getUUID().toString())
|
||||
@ -172,7 +183,13 @@ public class Util {
|
||||
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) {
|
||||
String[] results = new String[msgs.length];
|
||||
|
||||
@ -182,7 +199,11 @@ public class Util {
|
||||
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() {
|
||||
ItemStack wand = new ItemStack(Material.WOOD_SWORD);
|
||||
ItemMeta meta = wand.getItemMeta();
|
||||
@ -197,7 +218,6 @@ public class Util {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts a string like '20minutes' into the appropriate amount of the given unit.
|
||||
*
|
||||
* @param time in a string to convert.
|
||||
@ -298,7 +318,11 @@ public class Util {
|
||||
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() {
|
||||
return signLines;
|
||||
}
|
||||
@ -325,7 +349,7 @@ public class Util {
|
||||
*
|
||||
* @param playerInventory to turn into an array of strings.
|
||||
* @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 {
|
||||
//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.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* Based off of {@link #toBase64(Inventory)}.
|
||||
*
|
||||
* @param items to turn into a Base64 String.
|
||||
* @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 {
|
||||
try {
|
||||
@ -371,16 +395,14 @@ public class Util {
|
||||
/**
|
||||
* A method to serialize an inventory to Base64 string.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* Special thanks to Comphenix in the Bukkit forums or also known
|
||||
* as aadnk on GitHub.
|
||||
*
|
||||
* <a href="https://gist.github.com/aadnk/8138186">Original Source</a>
|
||||
* as aadnk on GitHub. <a href="https://gist.github.com/aadnk/8138186">Original Source</a>
|
||||
*
|
||||
* @param inventory to serialize
|
||||
* @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 {
|
||||
try {
|
||||
@ -407,7 +429,7 @@ public class Util {
|
||||
*
|
||||
* 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
|
||||
* as aadnk on GitHub.
|
||||
@ -416,7 +438,7 @@ public class Util {
|
||||
*
|
||||
* @param data Base64 string of data containing an inventory.
|
||||
* @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 {
|
||||
if(data.isEmpty()) return Bukkit.getServer().createInventory(null, 0);
|
||||
@ -441,13 +463,13 @@ public class Util {
|
||||
/**
|
||||
* Gets an array of ItemStacks from Base64 string.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* Base off of {@link #fromBase64(String)}.
|
||||
*
|
||||
* @param data Base64 string to convert to ItemStack array.
|
||||
* @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 {
|
||||
if(data.isEmpty()) return new ItemStack[] {};
|
||||
|
@ -97,6 +97,10 @@ public class AnyCell implements ICell {
|
||||
public boolean hasChest() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean useChest() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean setChanged(boolean changed) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -16,12 +16,20 @@ public class CachePrisoner {
|
||||
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() {
|
||||
return this.jail;
|
||||
}
|
||||
|
||||
/** Gets the Prisoner in this cache. */
|
||||
/**
|
||||
* Gets the {@link Prisoner} in this cache.
|
||||
*
|
||||
* @return the {@link Prisoner} instance
|
||||
*/
|
||||
public Prisoner getPrisoner() {
|
||||
return this.p;
|
||||
}
|
||||
|
@ -220,6 +220,10 @@ public class Cell implements ICell {
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean useChest() {
|
||||
return this.chest != null;
|
||||
}
|
||||
|
||||
public boolean setChanged(boolean changed) {
|
||||
return this.changed = changed;
|
||||
|
@ -22,22 +22,38 @@ public class ConfirmPlayer {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
return this.expires;
|
||||
}
|
||||
|
@ -97,6 +97,10 @@ public class NoCell implements ICell {
|
||||
public boolean hasChest() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean useChest() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public boolean setChanged(boolean changed) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -6,7 +6,6 @@ package com.graywolf336.jail.beans;
|
||||
* @author graywolf336
|
||||
* @version 1.0.1
|
||||
* @since 3.0.0
|
||||
*
|
||||
*/
|
||||
public class Stick {
|
||||
private String jail, reason;
|
||||
@ -28,24 +27,36 @@ public class Stick {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
/** 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/
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@ import com.graywolf336.jail.JailMain;
|
||||
/**
|
||||
* 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.
|
||||
* We listen to this event for updating various items in classes which are only
|
||||
|
@ -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.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* 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}
|
||||
|
@ -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}.
|
||||
*
|
||||
* <p />
|
||||
* <br /><br />
|
||||
*
|
||||
* This event is called right before we actually jail a player, and is cancellable.
|
||||
*
|
||||
|
@ -13,7 +13,7 @@ import com.graywolf336.jail.interfaces.ICell;
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
@ -11,7 +11,7 @@ import com.graywolf336.jail.interfaces.ICell;
|
||||
/**
|
||||
* 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 for informative purposes, see {@link PrisonerReleasedEvent}
|
||||
|
@ -12,7 +12,7 @@ import com.graywolf336.jail.beans.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.
|
||||
*
|
||||
@ -103,22 +103,38 @@ public class PrePrisonerTransferredEvent extends Event implements Cancellable {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
return this.transferor;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import com.graywolf336.jail.beans.Prisoner;
|
||||
/**
|
||||
* 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 for informative purposes, see {@link PrePrisonerJailedEvent}
|
||||
|
@ -11,7 +11,7 @@ import com.graywolf336.jail.beans.Prisoner;
|
||||
/**
|
||||
* 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 for informative purposes, see {@link PrePrisonerReleasedEvent}
|
||||
|
@ -11,7 +11,7 @@ import com.graywolf336.jail.beans.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.
|
||||
*
|
||||
|
@ -11,22 +11,38 @@ import com.graywolf336.jail.beans.Prisoner;
|
||||
import com.graywolf336.jail.beans.SimpleLocation;
|
||||
|
||||
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();
|
||||
|
||||
/** Gets the name of the cell. */
|
||||
/**
|
||||
* Gets the name of the cell.
|
||||
*
|
||||
* @return Cell's name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/** Sets the prisoner in this cell. */
|
||||
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();
|
||||
|
||||
/** Nullifies the prisoner data. */
|
||||
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();
|
||||
|
||||
/** Adds all the given signs to the cell. */
|
||||
@ -35,19 +51,39 @@ public interface ICell {
|
||||
/** Adds a sign to the cell. */
|
||||
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();
|
||||
|
||||
/** 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();
|
||||
|
||||
/** 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();
|
||||
|
||||
/** 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();
|
||||
|
||||
/** 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();
|
||||
|
||||
/**
|
||||
@ -60,7 +96,11 @@ public interface ICell {
|
||||
/** Sets the location of where the prisoner will be teleported at when jailed here. */
|
||||
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();
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
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.
|
||||
@ -95,6 +142,10 @@ public interface ICell {
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
@ -9,13 +9,25 @@ import com.graywolf336.jail.beans.Prisoner;
|
||||
|
||||
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();
|
||||
|
||||
/** Checks if paying for timed is enabled. */
|
||||
/**
|
||||
* Checks if paying for timed is enabled.
|
||||
*
|
||||
* @return Whether time paying is enabled.
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
@ -26,10 +38,19 @@ public interface IJailPayManager {
|
||||
*/
|
||||
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);
|
||||
|
||||
/** 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();
|
||||
|
||||
/**
|
||||
@ -56,9 +77,17 @@ public interface IJailPayManager {
|
||||
*/
|
||||
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();
|
||||
|
||||
/** Returns the economy provider to do transaction with. */
|
||||
/**
|
||||
* Returns the economy provider to do transaction with.
|
||||
*
|
||||
* @return the {@link Economy} instance
|
||||
*/
|
||||
public Economy getEconomy();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import com.graywolf336.jail.events.PrisonerTransferredEvent;
|
||||
/**
|
||||
* 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,
|
||||
* this way we gain performance for servers which have a high amount
|
||||
|
@ -5,7 +5,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user