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()) {
|
||||
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,13 +65,11 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
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,10 +75,12 @@ public class CacheListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void beforeTransferringListener(PrePrisonerTransferredEvent event) {
|
||||
if(event.isPlayerOnline()) {
|
||||
if(pl.getJailManager().inCache(event.getPlayer().getUniqueId())) {
|
||||
pl.getJailManager().removeCacheObject(event.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void transferListener(PrisonerTransferredEvent event) {
|
||||
|
Loading…
Reference in New Issue
Block a user