AuthMe/AuthMeReloaded

View on GitHub
src/main/java/fr/xephi/authme/events/RestoreInventoryEvent.java

Summary

Maintainability
A
0 mins
Test Coverage
package fr.xephi.authme.events;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

/**
 * This event is fired when the inventory of a player is restored
 * (the inventory data is no longer hidden from the user).
 */
public class RestoreInventoryEvent extends CustomEvent implements Cancellable {

    private static final HandlerList handlers = new HandlerList();
    private final Player player;
    private boolean isCancelled;

    /**
     * Constructor.
     *
     * @param player The player
     */
    public RestoreInventoryEvent(Player player) {
        this.player = player;
    }

    /**
     * Return the player whose inventory will be restored.
     *
     * @return Player
     */
    public Player getPlayer() {
        return player;
    }

    @Override
    public boolean isCancelled() {
        return isCancelled;
    }

    @Override
    public void setCancelled(boolean isCancelled) {
        this.isCancelled = isCancelled;
    }

    /**
     * Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
     *
     * @return The list of handlers
     */
    public static HandlerList getHandlerList() {
        return handlers;
    }

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

}