Fix #83, transfers failing due to various errors
The transfers were failing due to errors. Also fixed an api issue where the method wasn't very descriptive.
This commit is contained in:
parent
93d8b88bb1
commit
2373338770
@ -732,9 +732,9 @@ public class PrisonerManager {
|
||||
//If the targetCell has a chest
|
||||
if(targetCell.hasChest()) {
|
||||
//Loop through the origin's chest inventory and add it to the target cell's chest
|
||||
for(ItemStack i : originCell.getChest().getInventory().getContents()) {
|
||||
targetCell.getChest().getInventory().addItem(i);
|
||||
}
|
||||
for(ItemStack i : originCell.getChest().getInventory().getContents())
|
||||
if(i != null)
|
||||
targetCell.getChest().getInventory().addItem(i);
|
||||
|
||||
//Clear the origin cell's chest as it is clear now
|
||||
originCell.getChest().getInventory().clear();
|
||||
|
@ -65,12 +65,10 @@ public class JailTransferCommand implements Command {
|
||||
if(params.getJail() == null) {
|
||||
sender.sendMessage(Lang.PROVIDEAJAIL.get(Lang.TRANSFERRING));
|
||||
return true;
|
||||
}else {
|
||||
}else if(!jm.isValidJail(params.getJail())) {
|
||||
//Check if the jail they did provided is not a valid jail
|
||||
if(!jm.isValidJail(params.getJail())) {
|
||||
sender.sendMessage(Lang.NOJAIL.get(params.getJail()));
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(Lang.NOJAIL.get(params.getJail()));
|
||||
return true;
|
||||
}
|
||||
|
||||
jm.getPlugin().debug("They provided a valid jail, so let's check the target cell.");
|
||||
|
@ -18,7 +18,7 @@ import com.graywolf336.jail.beans.Prisoner;
|
||||
*
|
||||
* @author graywolf336
|
||||
* @since 3.0.0
|
||||
* @version 1.0.0
|
||||
* @version 1.0.1
|
||||
*/
|
||||
public class PrePrisonerTransferredEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@ -114,8 +114,8 @@ public class PrePrisonerTransferredEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/** Gets whether the prisoner being transferred is online or not. */
|
||||
public boolean isOnline() {
|
||||
return player == null;
|
||||
public boolean isPlayerOnline() {
|
||||
return player != null;
|
||||
}
|
||||
|
||||
/** Gets the name of what is transferring this prisoner. */
|
||||
|
@ -75,8 +75,10 @@ public class CacheListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void beforeTransferringListener(PrePrisonerTransferredEvent event) {
|
||||
if(pl.getJailManager().inCache(event.getPlayer().getUniqueId())) {
|
||||
pl.getJailManager().removeCacheObject(event.getPlayer().getUniqueId());
|
||||
if(event.isPlayerOnline()) {
|
||||
if(pl.getJailManager().inCache(event.getPlayer().getUniqueId())) {
|
||||
pl.getJailManager().removeCacheObject(event.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user