<commit_before>package com.thevoxelbox.voxelsniper.brush;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.block.Action;

import com.thevoxelbox.voxelsniper.RangeBlockHelper;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.Sniper;

/**
 * 
 * @author Piotr
 */
public class Sneak extends Brush {
	private static int timesUsed = 0;

	/**
	 * 
	 */
    public Sneak() {
        this.setName("Sneak");
    }

    /**
     * 
     */
    @Override
    public final boolean perform(final Action action, final SnipeData v, final Material heldItem, final Block clickedBlock, final BlockFace clickedFace) {
        switch (action) {
        case RIGHT_CLICK_AIR:
        case RIGHT_CLICK_BLOCK:
            switch (heldItem) {
            case ARROW:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setReplace(this.getTargetBlock().getTypeId());
                    return true;
                } else { // Changed due to an excellent member suggestion: when crouch clicking the sky or void, it should just set material or replace material
                         // to air. Just added this and the else{} for left click. -Gavjenks
                    v.owner().setReplace(0);
                    return true;
                }

            case SULPHUR:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setReplaceData(this.getTargetBlock().getData());
                    return true;
                } else {
                    v.owner().setReplaceData((byte) 0);
                    return true;
                }

            case GREEN_RECORD:
                v.owner().twoBackBrush();
                v.sendMessage(ChatColor.GOLD + "Two Back");
                return true;

            case STONE_AXE:
                v.reset();
                v.owner().info();
                return true;

            default:
                return false;
            }

        case LEFT_CLICK_AIR:
        case LEFT_CLICK_BLOCK:
            switch (heldItem) {
            case ARROW:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setVoxel(this.getTargetBlock().getTypeId());
                    return true;
                } else { // See above comment for right click -Gavjenks
                    v.owner().setVoxel(0);
                    return true;
                }

            case SULPHUR:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setData(this.getTargetBlock().getData());
                    return true;
                } else {
                    v.owner().setData((byte) 0);
                    return true;
                }

            case GREEN_RECORD:
                v.owner().previousBrush();
                v.sendMessage(ChatColor.GOLD + "One Back");
                return true;

            case STONE_AXE:
                if (this.getTarget(v, clickedBlock, clickedFace)) {
                    v.owner().setVoxel(this.getTargetBlock().getTypeId());
                    v.owner().setData(this.getTargetBlock().getData());
                    return true;
                }
                break;

            default:
                return false;
            }
            break;

        case PHYSICAL:
            return false;

        default:
            v.sendMessage(ChatColor.RED + "Something is not right. Report this to przerwap. (Perform Error)");
            return true;
        }
        return false;
    }

    protected final boolean getSilentTarget(final Sniper v, final Block clickedBlock, final BlockFace clickedFace) {
        this.setWorld(v.getPlayer().getWorld());
        if (clickedBlock != null) {<commit_msg>* Some Checkstyle fixes in Sneak.java<commit_after>package com.thevoxelbox.voxelsniper.brush;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.block.Action;

import com.thevoxelbox.voxelsniper.RangeBlockHelper;
import com.thevoxelbox.voxelsniper.SnipeData;
import com.thevoxelbox.voxelsniper.Message;
import com.thevoxelbox.voxelsniper.Sniper;

/**
 * 
 * @author Piotr
 */
public class Sneak extends Brush {
	private static int timesUsed = 0;

	/**
	 * 
	 */
    public Sneak() {
        this.setName("Sneak");
    }

    /**
     * @return
     */
    @Override
    public final boolean perform(final Action action, final SnipeData v, final Material heldItem, final Block clickedBlock, final BlockFace clickedFace) {
        switch (action) {
        case RIGHT_CLICK_AIR:
        case RIGHT_CLICK_BLOCK:
            switch (heldItem) {
            case ARROW:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setReplace(this.getTargetBlock().getTypeId());
                    return true;
                } else { // Changed due to an excellent member suggestion: when crouch clicking the sky or void, it should just set material or replace material
                         // to air. Just added this and the else{} for left click. -Gavjenks
                    v.owner().setReplace(0);
                    return true;
                }

            case SULPHUR:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setReplaceData(this.getTargetBlock().getData());
                    return true;
                } else {
                    v.owner().setReplaceData((byte) 0);
                    return true;
                }

            case GREEN_RECORD:
                v.owner().twoBackBrush();
                v.sendMessage(ChatColor.GOLD + "Two Back");
                return true;

            case STONE_AXE:
                v.reset();
                v.owner().info();
                return true;

            default:
                return false;
            }

        case LEFT_CLICK_AIR:
        case LEFT_CLICK_BLOCK:
            switch (heldItem) {
            case ARROW:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setVoxel(this.getTargetBlock().getTypeId());
                    return true;
                } else { // See above comment for right click -Gavjenks
                    v.owner().setVoxel(0);
                    return true;
                }

            case SULPHUR:
                if (this.getSilentTarget(v.owner(), clickedBlock, clickedFace)) {
                    v.owner().setData(this.getTargetBlock().getData());
                    return true;
                } else {
                    v.owner().setData((byte) 0);
                    return true;
                }

            case GREEN_RECORD:
                v.owner().previousBrush();
                v.sendMessage(ChatColor.GOLD + "One Back");
                return true;

            case STONE_AXE:
                if (this.getTarget(v, clickedBlock, clickedFace)) {
                    v.owner().setVoxel(this.getTargetBlock().getTypeId());
                    v.owner().setData(this.getTargetBlock().getData());
                    return true;
                }
                break;

            default:
                return false;
            }
            break;

        case PHYSICAL:
            return false;

        default:
            v.sendMessage(ChatColor.RED + "Something is not right. Report this to przerwap. (Perform Error)");
            return true;
        }
        return false;
    }

    /**
     * 
     * @param v
     * @param clickedBlock
     * @param clickedFace
     * @return
     */
    protected final boolean getSilentTarget(final Sniper v, final Block clickedBlock, final BlockFace clickedFace) {
        this.setWorld(v.getPlayer().getWorld());
        if (clickedBlock != null) {
{'fraction_non_alphanumeric': 0.09873355465387926, 'fraction_numerical': 0.0012295585884667404, 'mean_word_length': 1.5089450956199877, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3832175', 'n_tokens_mistral': 2290, 'n_tokens_neox': 2136, 'n_words': 491}