Package org.bukkit.event.block

Examples of org.bukkit.event.block.Action


    public void onPlayerInteract(PlayerInteractEvent event) {
        Player p = event.getPlayer();
        if (!arena.inLobby(p)) return;

        // Player is in the lobby, so disallow using items.
        Action a = event.getAction();
        if (a == Action.RIGHT_CLICK_AIR || a == Action.RIGHT_CLICK_BLOCK) {
            event.setUseItemInHand(Result.DENY);
            event.setCancelled(true);
        }
View Full Code Here


    @EventHandler
    public void playerInteract(PlayerInteractEvent event) {
        if (event.hasItem()) {
            ItemStack item = event.getItem();
            Action action = event.getAction();
            Block clicked = event.getClickedBlock();
            if ((action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK)
                    || !isArmor(item) || (clicked != null && isInteractive(clicked.getType())))
                return;
            ItemStack currentItem = event.getPlayer().getInventory().getArmorContents()[getArmorTypeNumber(item)];
View Full Code Here

        final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
        final World world = player.getWorld();
        final WorldEdit we = plugin.getWorldEdit();

        Action action = event.getAction();
        if (action == Action.LEFT_CLICK_BLOCK) {
            final Block clickedBlock = event.getClickedBlock();
            final WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());

            if (we.handleBlockLeftClick(player, pos)) {
View Full Code Here

        counters.addPrimaryThread(idCancelDead, 1);
        return;
      }
     
      // TODO: Re-arrange for interact spam, possibly move ender pearl stuff to a method.
      final Action action = event.getAction();
      final Block block = event.getClickedBlock();
       
        if (block == null){
          return;
        }
View Full Code Here

    super(plugin);
  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void button(PlayerInteractEvent event) {
    Action action = event.getAction();
    if (action == Action.LEFT_CLICK_BLOCK
        || action == Action.RIGHT_CLICK_BLOCK) {
      if (event.getClickedBlock().getType() == Material.STONE_BUTTON) {
        prevent(event, event.getPlayer(), "button,interact");
      }
View Full Code Here

    super(plugin);
  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void door(PlayerInteractEvent event) {
    Action action = event.getAction();
    if (action == Action.LEFT_CLICK_BLOCK
        || action == Action.RIGHT_CLICK_BLOCK) {
      Material material = event.getClickedBlock().getType();
      if (material == Material.WOODEN_DOOR
          || material == Material.IRON_DOOR
View Full Code Here

    super(plugin);
  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void lever(PlayerInteractEvent event) {
    Action action = event.getAction();
    if (action == Action.LEFT_CLICK_BLOCK
        || action == Action.RIGHT_CLICK_BLOCK) {
      if (event.getClickedBlock().getType() == Material.LEVER) {
        prevent(event, event.getPlayer(), "lever,interact");
      }
View Full Code Here

    super(plugin);
  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void noteblock(PlayerInteractEvent event) {
    Action action = event.getAction();
    if (action == Action.LEFT_CLICK_BLOCK
        || action == Action.RIGHT_CLICK_BLOCK) {
      if (event.getClickedBlock().getType() == Material.NOTE_BLOCK) {
        prevent(event, event.getPlayer(), "noteblock,interact");
      }
View Full Code Here

        if (!EventUtil.passesFilter(event))
            return;

        Block block = null;
        Action action = null;
        if(event.getAction() == Action.RIGHT_CLICK_AIR) {
            try {
                block = event.getPlayer().getTargetBlock(null, 5);
                if(block != null && block.getType() != Material.AIR)
                    action = Action.RIGHT_CLICK_BLOCK;
View Full Code Here

  // -------------------------------------------- //
 
  // Note that this one is unstable and invalid. It cannot catch all cases.
  public static Material getEatenMaterial(PlayerInteractEvent event)
  {
    Action action = event.getAction();
    if (action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return null;
   
    Material ret = null;
   
    if (action == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.CAKE_BLOCK)
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.