Finish using the UUID, we are still using blocking methods.

I want to get fully away from blocking methods and instead make the
user/player/prisoner/whatever wait to get an answer while we retrieve
the uuid information asynchronously.
This commit is contained in:
graywolf336
2014-04-29 13:20:33 -05:00
parent ad9c70cbbf
commit 4d4f609b82
23 changed files with 118 additions and 69 deletions

View File

@ -222,6 +222,45 @@ public class JailManager {
}
}
/**
* Gets the {@link Jail} the player is in from their last known username, null if not jailed.
*
* @param username Last known username to search by
* @return {@link Jail jail} player is in
*/
public Jail getJailPlayerIsInByLastKnownName(String username) {
for(Jail j : jails.values())
for(Prisoner p : j.getAllPrisoners())
if(p.getLastKnownName().equalsIgnoreCase(username))
return j;
return null;
}
/**
* Gets the {@link Prisoner}'s data from the last known username, returning null if no prisoner has that name.
*
* @param username Last known username to go by
* @return {@link Prisoner prisoner} data
*/
public Prisoner getPrisonerByLastKnownName(String username) {
for(Prisoner p : this.getAllPrisoners())
if(p.getLastKnownName().equalsIgnoreCase(username))
return p;
return null;
}
/**
* Checks if the provided username is jailed, using last known username.
*
* @param username Last known username to go by
* @return true if they are jailed, false if not
*/
public boolean isPlayerJailedByLastKnownUsername(String username) {
return this.getPrisonerByLastKnownName(username) != null;
}
/**
* Clears a {@link Jail} of all its prisoners if the jail is provided, otherwise it releases all the prisoners in all the jails.
*