[BREAKING] Change up cell selection.

In the PrisonerManager you can now provide either AnyCell or NoCell and
it'll select a cell or not based upon the provided one. This is breaking
because it changes the required types in the methods and the new cells
don't have anything implemented and throw exceptions.
This commit is contained in:
graywolf336
2015-05-22 15:41:54 -05:00
parent 1f9035646d
commit 3eedc4904f
9 changed files with 249 additions and 53 deletions

View File

@ -9,6 +9,7 @@ import com.graywolf336.jail.beans.Cell;
import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.beans.Stick;
import com.graywolf336.jail.interfaces.ICell;
/**
* Event thrown before we a player is jailed by someone hitting them with a {@link Stick jail stick}.
@ -25,7 +26,7 @@ public class PrePrisonerJailedByJailStickEvent extends Event implements Cancella
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private Jail jail;
private Cell cell;
private ICell cell;
private Prisoner prisoner;
private Player player;
private String jailer, cancelMsg;
@ -41,7 +42,7 @@ public class PrePrisonerJailedByJailStickEvent extends Event implements Cancella
* @param jailer The name of what jailed this prisoner.
* @param stick The {@link Stick jail stick} used.
*/
public PrePrisonerJailedByJailStickEvent(Jail jail, Cell cell, Prisoner prisoner, Player player, String jailer, Stick stick) {
public PrePrisonerJailedByJailStickEvent(Jail jail, ICell cell, Prisoner prisoner, Player player, String jailer, Stick stick) {
this.jail = jail;
this.cell = cell;
this.prisoner = prisoner;
@ -57,7 +58,7 @@ public class PrePrisonerJailedByJailStickEvent extends Event implements Cancella
}
/** Gets the cell we're going to be sending the prisoner to. */
public Cell getCell() {
public ICell getCell() {
return this.cell;
}

View File

@ -8,6 +8,7 @@ import org.bukkit.event.HandlerList;
import com.graywolf336.jail.beans.Cell;
import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.interfaces.ICell;
/**
* Event thrown before we are jailing a player, both offline and online players.
@ -25,7 +26,7 @@ public class PrePrisonerJailedEvent extends Event implements Cancellable {
private boolean cancelled = false;
private boolean online;
private Jail jail;
private Cell cell;
private ICell cell;
private Prisoner prisoner;
private Player player;
private String jailer, cancelMsg;
@ -34,15 +35,15 @@ public class PrePrisonerJailedEvent extends Event implements Cancellable {
* Creates a new {@link PrePrisonerJailedEvent prisoner jailed event} for the given player before they get sent to jail.
*
* @param jail The jail the prisoner will be jailed at.
* @param cell The cell we're going to be sending the prisoner to, can be null.
* @param c The cell we're going to be sending the prisoner to, can be null.
* @param prisoner The prisoner data.
* @param player The player being jailed.
* @param online Whether the player is online or not.
* @param jailer The name of what jailed this prisoner.
*/
public PrePrisonerJailedEvent(Jail jail, Cell cell, Prisoner prisoner, Player player, boolean online, String jailer) {
public PrePrisonerJailedEvent(Jail jail, ICell c, Prisoner prisoner, Player player, boolean online, String jailer) {
this.jail = jail;
this.cell = cell;
this.cell = c;
this.prisoner = prisoner;
this.player = player;
this.online = online;
@ -56,7 +57,7 @@ public class PrePrisonerJailedEvent extends Event implements Cancellable {
}
/** Gets the cell we're going to be sending the prisoner to. */
public Cell getCell() {
public ICell getCell() {
return this.cell;
}

View File

@ -4,9 +4,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.graywolf336.jail.beans.Cell;
import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.interfaces.ICell;
/**
* Event thrown after a prisoner is released.
@ -24,7 +24,7 @@ import com.graywolf336.jail.beans.Prisoner;
public class PrePrisonerReleasedEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private Jail jail;
private Cell cell;
private ICell cell;
private Prisoner prisoner;
private Player player;
@ -36,7 +36,7 @@ public class PrePrisonerReleasedEvent extends Event {
* @param prisoner The prisoner data.
* @param player The player being jailed.
*/
public PrePrisonerReleasedEvent(Jail jail, Cell cell, Prisoner prisoner, Player player) {
public PrePrisonerReleasedEvent(Jail jail, ICell cell, Prisoner prisoner, Player player) {
this.jail = jail;
this.cell = cell;
this.prisoner = prisoner;
@ -49,7 +49,7 @@ public class PrePrisonerReleasedEvent extends Event {
}
/** Gets the cell where the prisoner was jailed in, null if they weren't in one. */
public Cell getCell() {
public ICell getCell() {
return this.cell;
}