// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.core.universe.world.events;

import com.hypixel.hytale.server.core.universe.world.World;
import javax.annotation.Nonnull;
import com.hypixel.hytale.event.ICancellable;

public class RemoveWorldEvent extends WorldEvent implements ICancellable
{
    private boolean cancelled;
    @Nonnull
    private final RemovalReason removalReason;
    
    public RemoveWorldEvent(@Nonnull final World world, @Nonnull final RemovalReason removalReason) {
        super(world);
        this.removalReason = removalReason;
    }
    
    @Nonnull
    public RemovalReason getRemovalReason() {
        return this.removalReason;
    }
    
    @Override
    public boolean isCancelled() {
        return this.removalReason != RemovalReason.EXCEPTIONAL && this.cancelled;
    }
    
    @Override
    public void setCancelled(final boolean cancelled) {
        this.cancelled = cancelled;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "RemoveWorldEvent{cancelled=" + this.cancelled + "} " + super.toString();
    }
    
    public enum RemovalReason
    {
        GENERAL, 
        EXCEPTIONAL;
    }
}
