All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.event.blockstate.BlockStateRepairFinishEvent Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.event.blockstate;

import cn.nukkit.api.PowerNukkitOnly;
import cn.nukkit.api.Since;
import cn.nukkit.block.Block;
import cn.nukkit.blockstate.BlockStateRepair;
import cn.nukkit.event.HandlerList;
import com.google.common.base.Preconditions;

import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author joserobjr
 */
@PowerNukkitOnly
@Since("1.4.0.0-PN")
public class BlockStateRepairFinishEvent extends BlockStateRepairEvent {
    @Nonnull
    private final List allRepairs;
    
    @Nonnull
    private Block result;

    @PowerNukkitOnly
    @Since("1.4.0.0-PN")
    public BlockStateRepairFinishEvent(@Nonnull List allRepairs, @Nonnull Block result) {
        super(allRepairs.get(allRepairs.size() - 1));
        this.allRepairs = Collections.unmodifiableList(new ArrayList<>(allRepairs));
        this.result = result;
    }

    @PowerNukkitOnly
    @Since("1.4.0.0-PN")
    @Nonnull
    public List getAllRepairs() {
        return allRepairs;
    }

    @PowerNukkitOnly
    @Nonnull
    public Block getResult() {
        return result;
    }

    @PowerNukkitOnly
    @Since("1.4.0.0-PN")
    public void setResult(@Nonnull Block result) {
        this.result = Preconditions.checkNotNull(result);
    }

    @Nonnull
    private static final HandlerList handlers = new HandlerList();

    @PowerNukkitOnly
    @Since("1.4.0.0-PN")
    @Nonnull
    public static HandlerList getHandlers() {
        return handlers;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy