Package org.bukkit.event.block

Examples of org.bukkit.event.block.Action


 
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerInteract(PlayerInteractEvent event){
    if(!event.hasBlock()) return;
   
    Action    action = event.getAction();
    Player    player = event.getPlayer();
    Block    block = event.getClickedBlock();
    int      type = block.getTypeId();
    BlockFace  face = event.getBlockFace();
   
View Full Code Here


        boolean blockBroken = false;
        boolean revert = false;
        if (message.getState() == DiggingMessage.START_DIGGING) {
            // call interact event
            Action action = Action.LEFT_CLICK_BLOCK;
            Block eventBlock = block;
            if (player.getLocation().distanceSquared(block.getLocation()) > 36 || block.getTypeId() == 0) {
                action = Action.LEFT_CLICK_AIR;
                eventBlock = null;
            }
View Full Code Here

         * packet case must be handled here. Care must also be taken that a
         * right-click air of an expected-place item immediately after is
         * not considered part of the same action.
         */

        Action action = Action.RIGHT_CLICK_BLOCK;
        GlowBlock clicked = player.getWorld().getBlockAt(message.getX(), message.getY(), message.getZ());

        /**
         * Check if the message is a -1. If we *just* got a message with the
         * values filled, discard it, otherwise perform right-click-air.
View Full Code Here

    // Abort if action does not fit - saves power :)
    if (!pie.getAction().equals(Action.RIGHT_CLICK_BLOCK) && !pie.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
      return;
    }
   
    Action      action    = pie.getAction();
    Player      player    = pie.getPlayer();
    Block      block     = pie.getClickedBlock();

    Todo      todo    = scs.removeTodo(player);
    Shop       shopEvent  = scs.getShopHandler().getShop(pie.getClickedBlock());
View Full Code Here

        if (block == null) {
            return;
        }

        Action action = event.getAction();
        Player player = event.getPlayer();

        if (Properties.USE_BUILT_IN_PROTECTION && isChest(block)) {
            if (Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
                return;
View Full Code Here

            return null;
        }

        OfflinePlayer owner = Bukkit.getOfflinePlayer(uuid);

        Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
        double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));

        Chest chest = uBlock.findConnectedChest(sign);
        Inventory ownerInventory = (ChestShopSign.isAdminShop(sign) ? new AdminInventory() : chest != null ? chest.getInventory() : null);
View Full Code Here

        return allowed.equalsIgnoreCase(buyTransaction ? "BUY" : "SELL");
    }

    private static int getStackAmount(ItemStack item, Inventory inventory, Player player, Action action) {
        Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
        Inventory checkedInventory = (action == buy ? inventory : player.getInventory());

        if (checkedInventory.containsAtLeast(item, item.getMaxStackSize())) {
            return item.getMaxStackSize();
        } else {
View Full Code Here

        return false;
      player = ((PlayerInteractEntityEvent) e).getPlayer();
      entity = ((PlayerInteractEntityEvent) e).getRightClicked();
      block = null;
    } else if (e instanceof PlayerInteractEvent) {
      final Action a = ((PlayerInteractEvent) e).getAction();
      final int click;
      switch (a) {
        case LEFT_CLICK_AIR:
        case LEFT_CLICK_BLOCK:
          click = LEFT;
View Full Code Here

TOP

Related Classes of org.bukkit.event.block.Action

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.