2012-03-27 23:09:23 +02:00
|
|
|
package com.gmail.nossr50.events.party;
|
|
|
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.Cancellable;
|
|
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
import org.bukkit.event.player.PlayerEvent;
|
|
|
|
|
|
|
|
public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable{
|
|
|
|
|
|
|
|
protected String oldParty;
|
|
|
|
protected String newParty;
|
|
|
|
protected EventReason reason;
|
|
|
|
protected boolean cancelled;
|
|
|
|
|
|
|
|
public McMMOPartyChangeEvent(Player player, String oldParty, String newParty, EventReason reason) {
|
|
|
|
super(player);
|
2012-03-28 01:47:20 +02:00
|
|
|
|
|
|
|
if (newParty != null) {
|
|
|
|
newParty = newParty.replace(":", ".");
|
|
|
|
}
|
|
|
|
|
2012-03-27 23:09:23 +02:00
|
|
|
this.oldParty = oldParty;
|
|
|
|
this.newParty = newParty;
|
|
|
|
this.reason = reason;
|
|
|
|
this.cancelled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getOldParty() {
|
|
|
|
return oldParty;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getNewParty() {
|
|
|
|
return newParty;
|
|
|
|
}
|
|
|
|
|
|
|
|
public EventReason getReason() {
|
|
|
|
return reason;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Rest of file is required boilerplate for custom events **/
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public HandlerList getHandlers() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static HandlerList getHandlerList() {
|
|
|
|
return handlers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Following are required for Cancellable **/
|
|
|
|
@Override
|
|
|
|
public boolean isCancelled() {
|
|
|
|
return cancelled;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setCancelled(boolean cancelled) {
|
|
|
|
this.cancelled = cancelled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum EventReason{
|
|
|
|
JOINED_PARTY,
|
|
|
|
LEFT_PARTY,
|
|
|
|
KICKED_FROM_PARTY,
|
|
|
|
CHANGED_PARTIES;
|
|
|
|
}
|
|
|
|
}
|