Package cc.co.evenprime.bukkit.nocheat

Examples of cc.co.evenprime.bukkit.nocheat.NoCheatPlayer


        }
    }

    public Map<String, Object> getPlayerData(String playerName) {

        NoCheatPlayer player = this.players.get(playerName.toLowerCase());

        if(player != null) {
            return player.getDataStore().collectData();
        }

        return new HashMap<String, Object>();
    }
View Full Code Here


        if(event.isCancelled())
            return;

        boolean cancelled = false;

        final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
        final ChatConfig cc = ChatCheck.getConfig(player);
        final ChatData data = ChatCheck.getData(player);

        // Remember the original message
        data.message = event.getMessage();

        // Now do the actual checks

        // First the spam check
        if(cc.spamCheck && !player.hasPermission(Permissions.CHAT_SPAM)) {
            cancelled = spamCheck.check(player, data, cc);
        }

        // Second the color check
        if(!cancelled && cc.colorCheck && !player.hasPermission(Permissions.CHAT_COLOR)) {
            cancelled = colorCheck.check(player, data, cc);
        }

        // If one of the checks requested the event to be cancelled, do it
        if(cancelled) {
View Full Code Here

        if(event.isCancelled())
            return;

        boolean cancelled = false;

        final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
        final BlockBreakConfig cc = BlockBreakCheck.getConfig(player);
        final BlockBreakData data = BlockBreakCheck.getData(player);

        // Remember the location of the block that will be broken
        data.brokenBlockLocation.set(event.getBlock());

        // Only if the block got damaged directly before, do the check(s)
        if(!data.brokenBlockLocation.equals(data.lastDamagedBlock)) {
            // Something caused a blockbreak event that's not from the player
            // Don't check it at all
            data.lastDamagedBlock.reset();
            return;
        }

        // Now do the actual checks, if still needed. It's a good idea to make
        // computationally cheap checks first, because it may save us from
        // doing the computationally expensive checks.

        // First NoSwing: Did the arm of the player move before breaking this
        // block?
        if(cc.noswingCheck && !player.hasPermission(Permissions.BLOCKBREAK_NOSWING)) {
            cancelled = noswingCheck.check(player, data, cc);
        }

        // Second Reach: Is the block really in reach distance
        if(!cancelled && cc.reachCheck && !player.hasPermission(Permissions.BLOCKBREAK_REACH)) {
            cancelled = reachCheck.check(player, data, cc);
        }

        // Third Direction: Did the player look at the block at all
        if(!cancelled && cc.directionCheck && !player.hasPermission(Permissions.BLOCKBREAK_DIRECTION)) {
            cancelled = directionCheck.check(player, data, cc);
        }

        // At least one check failed and demanded to cancel the event
        if(cancelled)
View Full Code Here

    public void blockHit(final BlockDamageEvent event) {

        if(event.isCancelled())
            return;

        NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
        BlockBreakData data = BlockBreakCheck.getData(player);

        // Only interested in insta-break events here
        if(event.getInstaBreak()) {
            // Remember this location. We handle insta-breaks slightly
View Full Code Here

    public void blockInteract(final PlayerInteractEvent event) {

        if(event.getClickedBlock() == null)
            return;

        NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
        BlockBreakData data = BlockBreakCheck.getData(player);
        // Remember this location. Only blockbreakevents for this specific
        // block will be handled at all
        data.lastDamagedBlock.set(event.getClickedBlock());
    }
View Full Code Here

        if(event.isCancelled() || event.getPlayer().isDead())
            return;

        boolean cancelled = false;

        final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
        final InventoryConfig cc = InventoryCheck.getConfig(player);
        final InventoryData data = InventoryCheck.getData(player);

        // If it should be executed, do it
        if(cc.dropCheck && !player.hasPermission(Permissions.INVENTORY_DROP)) {
            cancelled = dropCheck.check(player, data, cc);
        }

        if(cancelled) {
            // Cancelling drop events is not save (in certain circumstances
View Full Code Here

        // Only interested in right-clicks while holding an item
        if(!event.hasItem() || !(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK))
            return;

        NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
        final InventoryData data = InventoryCheck.getData(player);

        if(event.getItem().getType() == Material.BOW) {
            // It was a bow, the player starts to pull the string
            // Remember this time
View Full Code Here

     */
    @EventHandler(priority = EventPriority.LOWEST)
    public void foodchanged(final FoodLevelChangeEvent event) {
        // Only if a player ate food
        if(!event.isCancelled() && event.getEntity() instanceof Player) {
            final NoCheatPlayer player = plugin.getPlayer((Player) event.getEntity());
            final InventoryConfig cc = InventoryCheck.getConfig(player);
            final InventoryData data = InventoryCheck.getData(player);

            // Only if he should get checked
            if(cc.eatCheck && !player.hasPermission(Permissions.INVENTORY_INSTANTEAT)) {

                boolean cancelled = instantEatCheck.check(player, event, data, cc);

                // The check requested the foodlevelchange to get cancelled
                event.setCancelled(cancelled);
View Full Code Here

     */
    @EventHandler(priority = EventPriority.LOWEST)
    public void bowfired(final EntityShootBowEvent event) {
        // Only if a player shot the arrow
        if(!event.isCancelled() && event.getEntity() instanceof Player) {
            final NoCheatPlayer player = plugin.getPlayer((Player) event.getEntity());
            final InventoryConfig cc = InventoryCheck.getConfig(player);

            // Only if he should get checked
            if(cc.bowCheck && !player.hasPermission(Permissions.INVENTORY_INSTANTBOW)) {
                final InventoryData data = InventoryCheck.getData(player);
                boolean cancelled = instantBowCheck.check(player, event, data, cc);

                // The check requested the bowshooting to get cancelled
                event.setCancelled(cancelled);
View Full Code Here

        // Block wasn't placed, so we don't care
        if(event.isCancelled())
            return;

        final NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
        final MovingConfig config = MovingCheck.getConfig(player);

        // If the player is allowed to fly anyway, the workaround is not needed
        // It's kind of expensive (looking up block types) therefore it makes
        // sense to avoid it
        if(config.allowFlying || !config.runflyCheck || player.hasPermission(Permissions.MOVING_FLYING) || player.hasPermission(Permissions.MOVING_RUNFLY)) {
            return;
        }

        // Get the player-specific stored data that applies here
        final MovingData data = MovingCheck.getData(player);

        final Block block = event.getBlockPlaced();

        if(block == null || !data.runflySetBackPoint.isSet()) {
            return;
        }

        // Keep some results of "expensive calls
        final Location l = player.getPlayer().getLocation();
        final int playerX = l.getBlockX();
        final int playerY = l.getBlockY();
        final int playerZ = l.getBlockZ();
        final int blockY = block.getY();
View Full Code Here

TOP

Related Classes of cc.co.evenprime.bukkit.nocheat.NoCheatPlayer

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.