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

@ -24,7 +24,7 @@ public class HandCuffCommand implements Command {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLAYERNOTONLINE));
}else if(player.hasPermission("jail.cantbehandcuffed")) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.CANTBEHANDCUFFED, new String[] { player.getName() }));
}else if(jm.isPlayerJailed(player.getName())) {
}else if(jm.isPlayerJailed(player.getUniqueId())) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.CURRENTLYJAILEDHANDCUFF, new String[] { player.getName() }));
}else if(jm.getPlugin().getHandCuffManager().isHandCuffed(player.getName())) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.HANDCUFFSRELEASED, new String[] { player.getName() }));

View File

@ -24,17 +24,17 @@ public class UnJailCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) {
//Check if the player is jailed
if(jm.isPlayerJailed(args[0])) {
Jail j = jm.getJailPlayerIsIn(args[0]);
Prisoner pris = j.getPrisoner(args[0]);
Player p = jm.getPlugin().getServer().getPlayerExact(args[0]);
if(jm.isPlayerJailedByLastKnownUsername(args[0])) {
Jail j = jm.getJailPlayerIsInByLastKnownName(args[0]);
Prisoner pris = j.getPrisonerByLastKnownName(args[0]);
Player p = jm.getPlugin().getServer().getPlayer(pris.getUUID());
//Check if the player is on the server or not
if(p == null) {
//Check if the player has offline pending and their remaining time is above 0, if so then
//forceably unjail them
if(pris.isOfflinePending() && pris.getRemainingTime() != 0L) {
jm.getPlugin().getPrisonerManager().forceUnJail(j, j.getCellPrisonerIsIn(args[0]), p, pris);
jm.getPlugin().getPrisonerManager().forceUnJail(j, j.getCellPrisonerIsIn(pris.getUUID()), p, pris);
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.FORCEUNJAILED, args[0]));
}else {
//The player is not, so we'll set the remaining time to zero and do it when they login next
@ -45,7 +45,7 @@ public class UnJailCommand implements Command {
}else {
//Player is online, so let's try unjailing them
try {
jm.getPlugin().getPrisonerManager().unJail(j, j.getCellPrisonerIsIn(args[0]), p, pris);
jm.getPlugin().getPrisonerManager().unJail(j, j.getCellPrisonerIsIn(pris.getUUID()), p, pris);
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + e.getMessage());
}

View File

@ -21,8 +21,8 @@ public class UnJailForceCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) {
//Check if the player is jailed
if(jm.isPlayerJailed(args[0])) {
jm.getPlugin().getPrisonerManager().forceRelease(jm.getPrisoner(args[0]));
if(jm.isPlayerJailedByLastKnownUsername(args[0])) {
jm.getPlugin().getPrisonerManager().forceRelease(jm.getPrisonerByLastKnownName(args[0]));
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.FORCEUNJAILED, args[0]));
if(jm.getPlugin().getConfig().getBoolean(Settings.LOGJAILINGTOCONSOLE.getPath())) {