/** * Proxy method to {@link #setResult(Event.Result)} for the Cancellable * interface. {@link #setResult(Event.Result)} is preferred, as it allows * you to specify the Result beyond Result.DENY and Result.ALLOW. * <p> * {@inheritDoc} * * @param toCancel result becomes DENY if true, ALLOW if false */ public void setCancelled(boolean toCancel) { setResult(toCancel ? Result.DENY : Result.ALLOW); }
/** * Gets whether or not this event is cancelled. This is based off of the * Result value returned by {@link #getResult()}. Result.ALLOW and * Result.DEFAULT will result in a returned value of false, but * Result.DENY will result in a returned value of true. * <p> * {@inheritDoc} * * @return whether the event is cancelled */ public boolean isCancelled() { return getResult() == Result.DENY; }
/** * Gets the player who performed the click. * * @return The clicking player. */ public HumanEntity getWhoClicked() { return getView().getPlayer(); }
@EventHandler public void onInteract(final InventoryInteractEvent e) { if (GuiWindow.getWindow(e.getInventory().getTitle()) != null) { if (e.getInventory().getType().equals(InventoryType.CHEST)) { e.setResult(Event.Result.DENY); e.setCancelled(true); } } } }
@Override public void setCancelled(boolean cancelled) { iie.setCancelled(cancelled); } }
@Override public boolean isCanceled() { return iie.isCancelled(); }
@Override public MCHumanEntity getWhoClicked() { return new BukkitMCHumanEntity(iie.getWhoClicked()); }
@EventHandler(priority = EventPriority.HIGH) public void onInventoryInteract(InventoryInteractEvent event) { event.setCancelled(false); }
/** * Proxy method to {@link #setResult(Event.Result)} for the Cancellable * interface. {@link #setResult(Event.Result)} is preferred, as it allows * you to specify the Result beyond Result.DENY and Result.ALLOW. * <p> * {@inheritDoc} * * @param toCancel result becomes DENY if true, ALLOW if false */ public void setCancelled(boolean toCancel) { setResult(toCancel ? Result.DENY : Result.ALLOW); }
/** * Gets whether or not this event is cancelled. This is based off of the * Result value returned by {@link #getResult()}. Result.ALLOW and * Result.DEFAULT will result in a returned value of false, but * Result.DENY will result in a returned value of true. * <p> * {@inheritDoc} * * @return whether the event is cancelled */ public boolean isCancelled() { return getResult() == Result.DENY; }
/** * Gets the player who performed the click. * * @return The clicking player. */ public HumanEntity getWhoClicked() { return getView().getPlayer(); }
@Override public void setResult(MCResult newResult) { iie.setResult(Result.valueOf(newResult.name())); }
@Override public MCResult getResult() { return BukkitMCResult.getConvertor().getAbstractedEnum(iie.getResult()); }