/** * Gets whether or not the ClickType for this event represents a right * click. * * @return true if the ClickType uses the right mouse button. * @see ClickType#isRightClick() */ public boolean isRightClick() { return click.isRightClick(); }
/** * 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 the ClickType for this event represents a left * click. * * @return true if the ClickType uses the left mouse button. * @see ClickType#isLeftClick() */ public boolean isLeftClick() { return click.isLeftClick(); }
@Override public CraftingInventory getInventory() { return (CraftingInventory) super.getInventory(); } }
/** * Gets the current ItemStack on the cursor. * * @return the cursor ItemStack */ public ItemStack getCursor() { return getView().getCursor(); }
/** * Gets the block for the furnace involved in this event * * @return the block of the furnace * @deprecated In favour of {@link #getBlock()}. */ @Deprecated public Block getFurnace() { return getBlock(); }
/** * Gets the block for the furnace involved in this event * * @return the block of the furnace * @deprecated In favour of {@link #getBlock()}. */ @Deprecated public Block getFurnace() { return getBlock(); }
/** * Gets whether the ClickType for this event indicates that the key was * pressed down when the click was made. * * @return true if the ClickType uses Shift or Ctrl. * @see ClickType#isShiftClick() */ public boolean isShiftClick() { return click.isShiftClick(); }
/** * 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; }
public GlowInventory(InventoryHolder holder, InventoryType type) { this(holder, type, type.getDefaultSize(), type.getDefaultTitle()); }
/** * Creates a minecart with a chest. * * @param location the location. */ public Storage(Location location) { super(location, MinecartType.CHEST); inventory = new GlowInventory(this, InventoryType.CHEST, InventoryType.CHEST.getDefaultSize(), "Minecart with Chest"); }
/** * Gets the player who performed the click. * * @return The clicking player. */ public HumanEntity getWhoClicked() { return getView().getPlayer(); }
/** * Set the custom title of this inventory or reset it to the default. * * @param title The new title, or null to reset. */ public void setTitle(String title) { if (title == null) { this.title = type.getDefaultTitle(); } else { this.title = title; } }
/** * Gets the ItemStack currently in the clicked slot. * * @return the item in the clicked */ public ItemStack getCurrentItem() { if (slot_type == SlotType.OUTSIDE) { return current; } return getView().getItem(rawSlot); }
/** * Creates a minecart with a hopper. * * @param location the location */ public Hopper(Location location) { super(location, MinecartType.HOPPER); inventory = new GlowInventory(this, InventoryType.HOPPER, InventoryType.HOPPER.getDefaultSize(), "Minecart with Hopper"); }
public GlowInventory(InventoryHolder holder, InventoryType type, int size) { this(holder, type, size, type.getDefaultTitle()); }
/** * Sets the ItemStack currently in the clicked slot. * * @param stack the item to be placed in the current slot */ public void setCurrentItem(ItemStack stack) { if (slot_type == SlotType.OUTSIDE) { current = stack; } else { getView().setItem(rawSlot, stack); } }
@Override public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { return new GlowInventory(owner, type, type.getDefaultSize(), title); }
protected void initialize(List<GlowInventory> parents, InventoryHolder owner, InventoryType type) { initialize(parents, owner, type, type.getDefaultTitle()); }
/** * Sets the item on the cursor. * * @param stack the new cursor item * @deprecated This changes the ItemStack in their hand before any * calculations are applied to the Inventory, which has a tendency to * create inconsistencies between the Player and the server, and to * make unexpected changes in the behavior of the clicked Inventory. */ @Deprecated public void setCursor(ItemStack stack) { getView().setCursor(stack); }