Removed RedisguisedEvent

This commit is contained in:
Andrew 2013-07-31 19:39:16 +12:00
parent 38a26ecb44
commit 47d84ed794
2 changed files with 5 additions and 65 deletions

View File

@ -15,7 +15,6 @@ import me.libraryaddict.disguise.DisguiseTypes.DisguiseSound.SoundType;
import me.libraryaddict.disguise.DisguiseTypes.DisguiseType; import me.libraryaddict.disguise.DisguiseTypes.DisguiseType;
import me.libraryaddict.disguise.DisguiseTypes.MobDisguise; import me.libraryaddict.disguise.DisguiseTypes.MobDisguise;
import me.libraryaddict.disguise.Events.DisguisedEvent; import me.libraryaddict.disguise.Events.DisguisedEvent;
import me.libraryaddict.disguise.Events.RedisguisedEvent;
import me.libraryaddict.disguise.Events.UndisguisedEvent; import me.libraryaddict.disguise.Events.UndisguisedEvent;
import net.minecraft.server.v1_6_R2.AttributeMapServer; import net.minecraft.server.v1_6_R2.AttributeMapServer;
import net.minecraft.server.v1_6_R2.Block; import net.minecraft.server.v1_6_R2.Block;
@ -94,17 +93,12 @@ public class DisguiseAPI {
if (disguise == null) if (disguise == null)
return; return;
Disguise oldDisguise = getDisguise(entity); Disguise oldDisguise = getDisguise(entity);
if (oldDisguise != null) { DisguisedEvent event = new DisguisedEvent(entity, disguise);
RedisguisedEvent event = new RedisguisedEvent(entity, oldDisguise, disguise); Bukkit.getPluginManager().callEvent(event);
Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) {
if (event.isCancelled()) return;
return; } else if (oldDisguise != null) {
oldDisguise.getScheduler().cancel(); oldDisguise.getScheduler().cancel();
} else {
DisguisedEvent event = new DisguisedEvent(entity, disguise);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
return;
} }
if (disguise.getEntity() != entity) { if (disguise.getEntity() != entity) {

View File

@ -1,54 +0,0 @@
package me.libraryaddict.disguise.Events;
import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class RedisguisedEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList() {
return handlers;
}
private Entity disguised;
private boolean isCancelled;
private Disguise newDisguise;
private Disguise oldDisguise;
public RedisguisedEvent(Entity entity, Disguise oldDisguise, Disguise newDisguise) {
this.disguised = entity;
this.oldDisguise = oldDisguise;
this.newDisguise = newDisguise;
}
public Entity getDisguised() {
return disguised;
}
public HandlerList getHandlers() {
return handlers;
}
public Disguise getNewDisguise() {
return newDisguise;
}
public Disguise getOldDisguise() {
return oldDisguise;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancelled) {
isCancelled = cancelled;
}
}