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

org.bukkit.event.entity.EntityCreatePortalEvent Maven / Gradle / Ivy

package org.bukkit.event.entity;

import org.bukkit.PortalType;
import org.bukkit.block.BlockState;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

import java.util.List;

/**
 * Thrown when a Living Entity creates a portal in a world.
 */
public class EntityCreatePortalEvent extends EntityEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private final List blocks;
  private boolean cancelled = false;
  private PortalType type = PortalType.CUSTOM;

  public EntityCreatePortalEvent(final LivingEntity what, final List blocks, final PortalType type) {
    super(what);

    this.blocks = blocks;
    this.type = type;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  @Override
  public LivingEntity getEntity() {
    return (LivingEntity) entity;
  }

  /**
   * Gets a list of all blocks associated with the portal.
   *
   * @return List of blocks that will be changed.
   */
  public List getBlocks() {
    return blocks;
  }

  public boolean isCancelled() {
    return cancelled;
  }

  public void setCancelled(boolean cancel) {
    this.cancelled = cancel;
  }

  /**
   * Gets the type of portal that is trying to be created.
   *
   * @return Type of portal.
   */
  public PortalType getPortalType() {
    return type;
  }

  @Override
  public HandlerList getHandlers() {
    return handlers;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy