Find an empty cell when jailing via sticks, fix #68

Updates the jailing logic of the sticks to match that of jailing via the
commands, tries to find an empty cell to jail someone in.
This commit is contained in:
graywolf336 2015-05-21 14:06:34 -05:00
parent 5273a973a1
commit e2ad5c00e5

View File

@ -239,8 +239,10 @@ public class PlayerListener implements Listener {
pl.getConfig().getBoolean(Settings.AUTOMATICMUTE.getPath()), pl.getConfig().getBoolean(Settings.AUTOMATICMUTE.getPath()),
s.getTime(), attacker.getName(), s.getReason()); s.getTime(), attacker.getName(), s.getReason());
Jail j = pl.getJailManager().getJail(s.getJail());
Cell c = j.getFirstEmptyCell();
PrePrisonerJailedByJailStickEvent jEvent = new PrePrisonerJailedByJailStickEvent( PrePrisonerJailedByJailStickEvent jEvent = new PrePrisonerJailedByJailStickEvent(
pl.getJailManager().getJail(s.getJail()), null, p, player, attacker.getName(), s); j, c, p, player, attacker.getName(), s);
pl.getServer().getPluginManager().callEvent(jEvent); pl.getServer().getPluginManager().callEvent(jEvent);
@ -251,8 +253,8 @@ public class PlayerListener implements Listener {
attacker.sendMessage(jEvent.getCancelledMessage()); attacker.sendMessage(jEvent.getCancelledMessage());
}else { }else {
//recall data from the event //recall data from the event
Jail j = jEvent.getJail(); j = jEvent.getJail();
Cell c = jEvent.getCell(); c = jEvent.getCell();
p = jEvent.getPrisoner(); p = jEvent.getPrisoner();
player = jEvent.getPlayer(); player = jEvent.getPlayer();