Add the missing files, Github for windows missed it

This commit is contained in:
graywolf336 2015-06-05 18:02:02 -05:00
parent 384fa3601b
commit 806176ca1c
2 changed files with 98 additions and 12 deletions

View File

@ -18,6 +18,7 @@ import com.graywolf336.jail.beans.NoCell;
import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.enums.Lang;
import com.graywolf336.jail.enums.Settings;
import com.graywolf336.jail.events.OfflinePrisonerJailedEvent;
import com.graywolf336.jail.events.PrePrisonerReleasedEvent;
import com.graywolf336.jail.events.PrisonerJailedEvent;
import com.graywolf336.jail.events.PrisonerReleasedEvent;
@ -125,8 +126,10 @@ public class PrisonerManager {
cell.setPrisoner(prisoner);
}
//If they are NOT offline, jail them
if(!prisoner.isOfflinePending()) {
//If they are are offline then throw the event otherwise jail them
if(prisoner.isOfflinePending()) {
pl.getServer().getPluginManager().callEvent(new OfflinePrisonerJailedEvent(jail, cell, prisoner));
}else {
jailPrisoner(jail, cell, player, prisoner);
}
@ -627,6 +630,10 @@ public class PrisonerManager {
cell.removePrisoner();
}
//Call the prisoner released event as we have released them.
PrisonerReleasedEvent event = new PrisonerReleasedEvent(jail, cell, prisoner, player);
pl.getServer().getPluginManager().callEvent(event);
if(sender != null) sender.sendMessage(Lang.FORCEUNJAILED.get(prisoner.getLastKnownName()));
}else {
try {

View File

@ -0,0 +1,79 @@
package com.graywolf336.jail.events;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.beans.Prisoner;
import com.graywolf336.jail.interfaces.ICell;
/**
* Event thrown when a prisoner is offline put will be put into jail next time they come online.
*
* <p />
*
* This event is called before everything for the jailing takes place, as the player is offline.
* This event is called for informative purposes, see {@link PrePrisonerJailedEvent}
* for the event called before they teleported in and all that fancy stuff.
*
* @author graywolf336
* @since 3.0.0
* @version 1.0.0
*/
public class OfflinePrisonerJailedEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private Jail jail;
private ICell cell;
private Prisoner prisoner;
/**
* Creates a new {@link OfflinePrisonerJailedEvent prisoner jailed event} for the given prisoner.
*
* @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 prisoner The prisoner data.
*/
public OfflinePrisonerJailedEvent(Jail jail, ICell cell, Prisoner prisoner) {
this.jail = jail;
this.cell = cell;
this.prisoner = prisoner;
}
/** Gets the {@link Jail} this prisoner is being sent to. */
public Jail getJail() {
return this.jail;
}
/** Gets the cell we're going to be sending the prisoner to, can be null. */
public ICell getCell() {
return this.cell;
}
/** Checks if there was a cell involved. */
public boolean hasCell() {
return this.cell != null;
}
/** Gets the {@link Prisoner} data for this prisoner. */
public Prisoner getPrisoner() {
return this.prisoner;
}
/** Gets the jailer who jailed this prisoner. */
public String getJailer() {
return this.prisoner.getJailer();
}
/** Gets the reason the prisoner was jailed. */
public String getReason() {
return this.prisoner.getReason();
}
public static HandlerList getHandlerList() {
return handlers;
}
public HandlerList getHandlers() {
return handlers;
}
}