Add the confirmation to the clearforce command, continued work on #3.

This commit is contained in:
graywolf336
2014-02-14 18:02:08 -06:00
parent 54bea41d05
commit 82a40c5d8e
3 changed files with 48 additions and 20 deletions

View File

@ -263,6 +263,39 @@ public class JailManager {
}
}
/**
* Forcefully clears all the jails if name provided is null.
*
* <p />
*
* This method just clears them from the storage, doesn't release them.
*
* @param name of the jail to clear, null if all of them.
* @return The resulting message to be sent to the caller of this method.
*/
public String forcefullyClearJailOrJails(String name) {
if(name == null) {
if(getJails().size() == 0) {
return getPlugin().getJailIO().getLanguageString(LangString.NOJAILS);
}else {
for(Jail j : getJails()) {
j.clearPrisoners();
}
return getPlugin().getJailIO().getLanguageString(LangString.PRISONERSCLEARED, getPlugin().getJailIO().getLanguageString(LangString.ALLJAILS));
}
}else {
Jail j = getJail(name);
if(j != null) {
j.clearPrisoners();
return getPlugin().getJailIO().getLanguageString(LangString.PRISONERSCLEARED, j.getName());
}else {
return getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, name);
}
}
}
/**
* Returns whether or not the player is creating a jail or a cell.
*