Java Code Examples for org.bukkit.event.player.PlayerInteractEvent#setCancelled()

The following examples show how to use org.bukkit.event.player.PlayerInteractEvent#setCancelled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemListener.java    From HubBasics with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onRightClick(PlayerInteractEvent event) {
    if (!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
        return;
    }
    ItemStack itemStack = ReflectionUtils.invokeMethod(event.getPlayer(), this.getItemInHandMethod);
    if (itemStack != null && itemStack.getType() != Material.AIR) {
        NBTItem nbtItem = new NBTItem(itemStack);
        if (!nbtItem.hasKey("HubBasics")) return;
        event.setCancelled(true);
        CustomItem item = HubBasics.getInstance().getItemManager().get(nbtItem.getString("HubBasics"));
        if (item == null) {
            itemStack.setType(Material.AIR); // Destroy old item
            return;
        }
        if (!item.getRunOnRightClick()) return;
        item.onCommand(event.getPlayer());
    }
}
 
Example 2
Source File: PlayerListener.java    From Carbon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
   public void onPlayerInteractMobSpawner(PlayerInteractEvent evt) {
       if (plugin.getConfig().getBoolean("features.monsterEggMobSpawner", true)) {
           if (evt.getAction() == Action.RIGHT_CLICK_BLOCK) {
               if (evt.getPlayer().getItemInHand().getType() == Material.MONSTER_EGG && evt.getClickedBlock().getType() == Material.MOB_SPAWNER) {
                   ItemStack egg = evt.getPlayer().getItemInHand();
                   CreatureSpawner cs = (CreatureSpawner) evt.getClickedBlock().getState();
                   cs.setSpawnedType(EntityType.fromId(egg.getData().getData()));
                   cs.update(true);
                   evt.setUseItemInHand(Event.Result.DENY);
                   evt.setCancelled(true);
               }
           }
       }
   }
 
Example 3
Source File: TrackerListener.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onTrackerUse(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    if (!Main.isPlayerInGame(player)) {
        return;
    }

    GamePlayer gamePlayer = Main.getPlayerGameProfile(player);
    Game game = gamePlayer.getGame();
    if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        if (game.getStatus() == GameStatus.RUNNING && !gamePlayer.isSpectator) {
            if (event.getItem() != null) {
                ItemStack stack = event.getItem();
                String unhidden = APIUtils.unhashFromInvisibleStringStartsWith(stack, TRACKER_PREFIX);
                if (unhidden != null) {
                    event.setCancelled(true);

                    Tracker tracker = new Tracker(game, player, game.getTeamOfPlayer(player));
                    tracker.runTask();
                }
            }
        }
    }
}
 
Example 4
Source File: SpecialItemKit.java    From AnnihilationPro with MIT License 6 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void specialItemActionCheck(final PlayerInteractEvent event)
{
	if(useDefaultChecking())
	{
		if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
		{
			if(event.getItem() != null && event.getItem().getType() == specialItem.getType())
			{
				AnniPlayer p = AnniPlayer.getPlayer(event.getPlayer().getUniqueId());
				if(p != null && p.getKit().equals(this) && isSpecialItem(event.getItem()))
				{
					event.setCancelled(true);
					if(!delays.hasActiveDelay(event.getPlayer(), getInternalName()))
					{
						//Do firestorm
						if(performSpecialAction(event.getPlayer(),p) && getDelayLength() > 0)
							delays.addDelay(event.getPlayer(), System.currentTimeMillis()+getDelayLength(), getInternalName());
					}
				}
			}
		}
	}
}
 
Example 5
Source File: SignEvents.java    From uSkyBlock with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockHit(PlayerInteractEvent e) {
    Player player = e.getPlayer();
    if (e.getPlayer() == null
            || e.getClickedBlock() == null
            || e.getAction() != Action.RIGHT_CLICK_BLOCK
            || e.getPlayer().getGameMode() != GameMode.SURVIVAL
            || !isSign(e.getClickedBlock().getType())
            || !player.hasPermission("usb.island.signs.use")
            || !plugin.getWorldManager().isSkyAssociatedWorld(player.getWorld())) {
        return;
    }

    if (e.getClickedBlock().getState() instanceof Sign) {
        Sign sign = (Sign) e.getClickedBlock().getState();
        String firstLine = FormatUtil.stripFormatting(sign.getLine(0)).trim();
        if (firstLine.startsWith("/")) {
            e.setCancelled(true);
            player.performCommand(firstLine.substring(1));
        }
    }
}
 
Example 6
Source File: GeneralEventHandler.java    From SuperVanish with Mozilla Public License 2.0 5 votes vote down vote up
@EventHandler
public void onPlayerCropTrample(PlayerInteractEvent e) {
    try {
        if (!plugin.getVanishStateMgr().isVanished(e.getPlayer().getUniqueId())) return;
        if (e.getAction() != Action.PHYSICAL) return;
        if (e.getClickedBlock() != null && e.getClickedBlock().getType().toString().matches("SOIL|FARMLAND"))
            e.setCancelled(true);
    } catch (Exception er) {
        plugin.logException(er);
    }
}
 
Example 7
Source File: ArrowBlockerListener.java    From BedwarsRel with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onInteract(PlayerInteractEvent ev) {
  if (ev.getAction().equals(Action.LEFT_CLICK_AIR)
      || ev.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
    return;
  }

  Player player = ev.getPlayer();
  Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);

  if (game == null) {
    return;
  }

  if (game.getState() != GameState.RUNNING) {
    return;
  }

  ArrowBlocker blocker = new ArrowBlocker();
  if (!ev.getMaterial().equals(blocker.getItemMaterial())) {
    return;
  }

  blocker.create(player, game);
  ev.setCancelled(true);
  player.updateInventory();
}
 
Example 8
Source File: DebugFishListener.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onDebug(PlayerInteractEvent e) {
    if (e.getAction() == Action.PHYSICAL || e.getHand() != EquipmentSlot.HAND) {
        return;
    }

    Player p = e.getPlayer();

    if (p.isOp() && SlimefunUtils.isItemSimilar(e.getItem(), SlimefunItems.DEBUG_FISH, true)) {
        e.setCancelled(true);

        if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
            if (p.isSneaking()) {
                if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
                    BlockStorage.clearBlockInfo(e.getClickedBlock());
                }
            }
            else {
                e.setCancelled(false);
            }
        }
        else if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (p.isSneaking()) {
                Block b = e.getClickedBlock().getRelative(e.getBlockFace());
                b.setType(Material.PLAYER_HEAD);
                SkullBlock.setFromHash(b, HeadTexture.MISSING_TEXTURE.getTexture());
            }
            else if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
                sendInfo(p, e.getClickedBlock());
            }
        }
    }
}
 
Example 9
Source File: BlockListener.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
private void OnPlayerUseItem(PlayerInteractEvent event) {
	Location loc = (event.getClickedBlock() == null) ? 
			event.getPlayer().getLocation() : 
			event.getClickedBlock().getLocation();

	ItemStack stack = event.getItem();

	coord.setFromLocation(event.getPlayer().getLocation());
	Camp camp = CivGlobal.getCampFromChunk(coord);
	if (camp != null) {
		if (!camp.hasMember(event.getPlayer().getName())) {
			CivMessage.sendError(event.getPlayer(), "You cannot use "+stack.getType().toString()+" in a camp you do not belong to.");
			event.setCancelled(true);
			return;
		}
	}

	TownChunk tc = CivGlobal.getTownChunk(loc);
	if (tc == null) {
		return;
	}

	Resident resident = CivGlobal.getResident(event.getPlayer().getName());

	if (resident == null) {
		event.setCancelled(true);
	}

	if(!tc.perms.hasPermission(PlotPermissions.Type.ITEMUSE, resident)) {
		event.setCancelled(true);
		CivMessage.sendErrorNoRepeat(event.getPlayer(), "You do not have permission to use "+stack.getType().toString()+" here.");
	}

	return;
}
 
Example 10
Source File: KitLoading.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority=EventPriority.HIGHEST)
public void openKitMenuCheck(PlayerInteractEvent event)
{
	if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR)
	{
		final Player player = event.getPlayer();
		if(KitUtils.itemHasName(player.getItemInHand(), CustomItem.KITMAP.getName()))
		{
			openKitMap(player);
			event.setCancelled(true);
		}
	}
}
 
Example 11
Source File: Signs.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void signClickCheck(PlayerInteractEvent event)
{
	if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
	{
		Block b = event.getClickedBlock();
		if(b != null)
		{
			if(b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN_POST)
			{
				final Location loc = b.getLocation();
				final Player p = event.getPlayer();
				AnniSign sign = this.signs.get(MapKey.getKey(loc));
				if(sign != null)
				{
					event.setCancelled(true);
					if(sign.getType().equals(SignType.Team))
					{
						AnniTeam team = sign.getType().getTeam();
						if(team != null)
						{
							p.performCommand("team "+team.getName());
						}
					}
					else if(sign.getType().equals(SignType.Brewing))
					{
						ShopMenu.openBrewingShop(p);
					}
					else if(sign.getType().equals(SignType.Weapon))
					{
						ShopMenu.openWeaponShop(p);
					}
				}
			}
		}
	}
}
 
Example 12
Source File: LockListener.java    From QuickShop-Reremake with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onClick(PlayerInteractEvent e) {

    final Block b = e.getClickedBlock();

    if (b == null) {
        return;
    }

    if (!Util.canBeShop(b)) {
        return;
    }

    final Player p = e.getPlayer();

    if (e.getAction() != Action.RIGHT_CLICK_BLOCK) {
        return; // Didn't right click it, we dont care.
    }

    final Shop shop = getShopPlayer(b.getLocation(), true);
    // Make sure they're not using the non-shop half of a double chest.
    if (shop == null) {
        return;
    }

    if (!shop.getModerator().isModerator(p.getUniqueId())) {
        if (QuickShop.getPermissionManager().hasPermission(p, "quickshop.other.open")) {
            MsgUtil.sendMessage(p, MsgUtil.getMessage("bypassing-lock", p));
            return;
        }
        MsgUtil.sendMessage(p, MsgUtil.getMessage("that-is-locked", p));
        e.setCancelled(true);
    }
}
 
Example 13
Source File: PGMListener.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void protect36(final PlayerInteractEvent event) {
  if (event.getClickedBlock() != null) {
    if (event.getClickedBlock().getType() == Material.PISTON_MOVING_PIECE) {
      event.setCancelled(true);
    }
  }
}
 
Example 14
Source File: TeamPicker.java    From CardinalPGM with MIT License 5 votes vote down vote up
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    Match match = GameHandler.getGameHandler().getMatch();
    if (!match.hasEnded() && !(Blitz.matchIsBlitz() && match.isRunning()) && ObserverModule.testObserverOrDead(event.getPlayer())
            && (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK))
            && event.getItem() != null && event.getItem().equals(getTeamPicker(event.getPlayer().getLocale()))) {
        event.setCancelled(true);
        event.getPlayer().openInventory(getTeamPicker(event.getPlayer()));
    }
}
 
Example 15
Source File: IslandGuard.java    From askyblock with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Pressure plates
 * @param e - event
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlateStep(PlayerInteractEvent e) {
    if (DEBUG) {
        plugin.getLogger().info("pressure plate = " + e.getEventName());
        plugin.getLogger().info("action = " + e.getAction());
    }
    if (!inWorld(e.getPlayer()) || !e.getAction().equals(Action.PHYSICAL)
            || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
            || plugin.getGrid().playerIsOnIsland(e.getPlayer())) {
        //plugin.getLogger().info("DEBUG: Not in world");
        return;
    }
    // Check island
    Island island = plugin.getGrid().getProtectedIslandAt(e.getPlayer().getLocation());
    if ((island == null && Settings.defaultWorldSettings.get(SettingsFlag.PRESSURE_PLATE))) {
        return;
    }
    if (island != null && island.getIgsFlag(SettingsFlag.PRESSURE_PLATE)) {
        return;
    }
    // Block action
    UUID playerUUID = e.getPlayer().getUniqueId();
    if (!onPlate.containsKey(playerUUID)) {
        Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(playerUUID).islandProtected);
        Vector v = e.getPlayer().getLocation().toVector();
        onPlate.put(playerUUID, new Vector(v.getBlockX(), v.getBlockY(), v.getBlockZ()));
    }
    e.setCancelled(true);
    return;
}
 
Example 16
Source File: InteractEvent.java    From MCAuthenticator with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    User u = instance.getCache().get(player.getUniqueId());

    if (u != null && u.authenticated()) return;

    event.setCancelled(true);
}
 
Example 17
Source File: MenuConvIO.java    From BetonQuest with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void playerInteractEvent(PlayerInteractEvent event) {
    if (event.getPlayer() != player) {
        return;
    }

    event.setCancelled(true);

    if (debounce) {
        return;
    }

    switch (event.getAction()) {
        case LEFT_CLICK_AIR:
        case LEFT_CLICK_BLOCK:

            if (controls.containsKey(CONTROL.LEFT_CLICK)) {

                switch (controls.get(CONTROL.LEFT_CLICK)) {
                    case CANCEL:
                        if (!conv.isMovementBlock()) {
                            conv.endConversation();
                        }
                        debounce = true;
                        break;
                    case SELECT:
                        conv.passPlayerAnswer(selectedOption + 1);
                        debounce = true;
                        break;
                case MOVE:
                    break;
                default:
                    break;
                }
            }
    case PHYSICAL:
        break;
    case RIGHT_CLICK_AIR:
        break;
    case RIGHT_CLICK_BLOCK:
        break;
    default:
        break;
    }

}
 
Example 18
Source File: EggChangeListener.java    From MineableSpawners with MIT License 4 votes vote down vote up
@EventHandler
public void onEggChange(PlayerInteractEvent e) {
    if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
        return;
    }

    Player player = e.getPlayer();
    ItemStack itemInHand = e.getItem();

    if (itemInHand == null || itemInHand.getType().equals(Material.AIR)) {
        return;
    }

    String itemName = itemInHand.getType().name();
    Material targetBlock = e.getClickedBlock().getType();

    if (targetBlock != XMaterial.SPAWNER.parseMaterial() || !itemName.contains("SPAWN_EGG")) {
        return;
    }

    if (plugin.getConfigurationHandler().getList("eggs", "blacklisted-worlds").contains(player.getWorld().getName())) {
        e.setCancelled(true);
        player.sendMessage(plugin.getConfigurationHandler().getMessage("eggs", "blacklisted"));
        return;
    }

    if (plugin.getConfigurationHandler().getBoolean("eggs", "require-permission")) {
        if (!player.hasPermission("mineablespawners.eggchange")) {
            e.setCancelled(true);
            player.sendMessage(plugin.getConfigurationHandler().getMessage("eggs", "no-permission"));
            return;
        }
    }

    String to = itemName.split("_SPAWN_EGG")[0].replace("_", " ").toLowerCase();

    if (plugin.getConfigurationHandler().getBoolean("eggs", "require-individual-permission")) {
        if (!player.hasPermission("mineablespawners.eggchange." + to.replace(" ", "_"))) {
            e.setCancelled(true);
            player.sendMessage(plugin.getConfigurationHandler().getMessage("eggs", "no-individual-permission"));
            return;
        }
    }

    CreatureSpawner spawner = (CreatureSpawner) e.getClickedBlock().getState();
    String from = spawner.getSpawnedType().toString().replace("_", " ").toLowerCase();

    if (from.equals(to)) {
        e.setCancelled(true);
        player.sendMessage(plugin.getConfigurationHandler().getMessage("eggs", "already-type"));
        return;
    }

    player.sendMessage(plugin.getConfigurationHandler().getMessage("eggs", "success").replace("%from%", from).replace("%to%", to));
}
 
Example 19
Source File: PlayerEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
public void onPlayerInteractBlockPrimary(PlayerInteractEvent event, Player player) {
    GDCauseStackManager.getInstance().pushCause(player);
    if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK) {
        return;
    }
    if (!GDFlags.INTERACT_BLOCK_PRIMARY || !GriefDefenderPlugin.getInstance().claimsEnabledForWorld(player.getWorld().getUID())) {
        return;
    }
    if (GriefDefenderPlugin.isTargetIdBlacklisted(Flags.INTERACT_BLOCK_PRIMARY.getName(), event.getClickedBlock(), player.getWorld().getUID())) {
        return;
    }

    final Block clickedBlock = event.getClickedBlock();
    final ItemStack itemInHand = event.getItem();
    final Location location = clickedBlock == null ? null : clickedBlock.getLocation();
    final GDPlayerData playerData = this.dataStore.getOrCreateGlobalPlayerData(player.getUniqueId());
    final Object source = itemInHand != null && !event.isBlockInHand() ? itemInHand : player;
    if (playerData.claimMode) {
        return;
    }
    // check give pet
    if (playerData.petRecipientUniqueId != null) {
        playerData.petRecipientUniqueId = null;
        GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_PET_TRANSFER_CANCEL);
        event.setCancelled(true);
        return;
    }

    if (location == null) {
        return;
    }

    GDTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.startTiming();
    final GDClaim claim = this.dataStore.getClaimAt(location);
    final GriefDefenderConfig<?> activeConfig = GriefDefenderPlugin.getActiveConfig(location.getWorld().getUID());
    if (activeConfig.getConfig().economy.isSellSignEnabled() ||  activeConfig.getConfig().economy.isRentSignEnabled()) {
        final Sign sign = SignUtil.getSign(location);
        if (sign != null) {
            if (activeConfig.getConfig().economy.isSellSignEnabled() && SignUtil.isSellSign(sign)) {
                if (claim.getEconomyData() != null && claim.getEconomyData().isForSale()) {
                    event.setCancelled(true);
                    EconomyUtil.getInstance().sellCancelConfirmation(event.getPlayer(), claim, sign);
                    GDTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTiming();
                    return;
                }
            } else if (GriefDefenderPlugin.getGlobalConfig().getConfig().economy.rentSystem  && activeConfig.getConfig().economy.isRentSignEnabled() && SignUtil.isRentSign(claim, sign)) {
                if ((claim.getEconomyData() != null && claim.getEconomyData().isForRent()) || claim.getEconomyData().isRented() ) {
                    event.setCancelled(true);
                    EconomyUtil.getInstance().rentCancelConfirmation(event.getPlayer(), claim, sign);
                    GDTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTiming();
                    return;
                }
            }
        }
    }

    final Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, claim, Flags.INTERACT_BLOCK_PRIMARY, source, clickedBlock.getState(), player, TrustTypes.BUILDER, true);
    if (result == Tristate.FALSE) {
        if (GriefDefenderPlugin.isTargetIdBlacklisted(Flags.BLOCK_BREAK.toString(), clickedBlock.getState(), player.getWorld().getUID())) {
            GDTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTiming();
            return;
        }
        if (GDPermissionManager.getInstance().getFinalPermission(event, location, claim, Flags.BLOCK_BREAK, player, clickedBlock.getState(), player, TrustTypes.BUILDER, true) == Tristate.TRUE) {
            GDTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTiming();
            return;
        }

        // Don't send a deny message if the player is in claim mode or is holding an investigation tool
        if (!playerData.claimMode && (GriefDefenderPlugin.getInstance().investigationTool == null || !NMSUtil.getInstance().hasItemInOneHand(player, GriefDefenderPlugin.getInstance().investigationTool))) {
            this.sendInteractBlockDenyMessage(itemInHand, clickedBlock, claim, player, playerData);
        }
        event.setCancelled(true);
        GDTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTiming();
        return;
    }
    GDTimings.PLAYER_INTERACT_BLOCK_PRIMARY_EVENT.stopTiming();
}
 
Example 20
Source File: Flamethrower.java    From ce with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
   @Override
public boolean effect(Event event, final Player player) {
	PlayerInteractEvent e = (PlayerInteractEvent) event;
		e.setCancelled(true);

		if(player.getItemInHand().getDurability() >= 64) {
			if(IsReloadable) {
			addLock(player);
			player.getWorld().playEffect(player.getLocation(), Effect.CLICK1, 2);
			player.sendMessage(ChatColor.RED + "Reloading...");
			new BukkitRunnable() {
				@Override
				public void run() {
					if(player.getItemInHand().getDurability() == 0) {
						removeLock(player);
						player.getWorld().playEffect(player.getLocation(), Effect.CLICK2, 2);
						this.cancel();
					} else {
						player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() - 1));
					}
				}
			}.runTaskTimer(main, 0l, 2l);
		} else { 
			player.getItemInHand().setType(Material.AIR);
		}
		} else {
			final List<Location> list = getLinePlayer(player, FireBlocksPerBurst);
			for(final Location l: list) {
				if(l.getBlock().getType().equals(Material.AIR))
					l.getBlock().setType(Material.FIRE);
				l.getWorld().playEffect(l, Effect.SMOKE, 20);
				final FallingBlock fire = l.getWorld().spawnFallingBlock(l, Material.FIRE.getId(), (byte) 0);
				fire.setDropItem(false);
				fire.setVelocity(player.getLocation().getDirection());
				new BukkitRunnable() {
					@Override
					public void run() {
					if(fire.isDead()) {
						list.add(fire.getLocation());
						this.cancel();
					} else {
						if(!Tools.checkWorldGuard(fire.getLocation(), player, "BUILD", true) || fire.getLocation().getBlock().getType().equals(Material.WATER) || fire.getLocation().getBlock().getType().equals(Material.STATIONARY_WATER)) {
							fire.getWorld().playEffect(fire.getLocation(), Effect.EXTINGUISH, 60);
							fire.remove();
							this.cancel();
						}
						for(Entity ent:fire.getNearbyEntities(0, 0, 0)) {
							if(ent != player) {
								ent.setFireTicks(BurnDuration);
							}
						}
					}
					}
				}.runTaskTimer(main, 0l, 1l);
			}
			new BukkitRunnable() {
				@Override
				public void run() {
					for(Location ls:list) {
						if(ls.getBlock().getType().equals(Material.FIRE)) {
						ls.getWorld().playEffect(ls, Effect.EXTINGUISH, 60);
						ls.getBlock().setType(Material.AIR);
						}
					}
				}
			}.runTaskLater(main, 200l);
			player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 30);
			if(!player.getGameMode().equals(GameMode.CREATIVE)) {
			player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + 1));
			}
		}
	
	return true;
}