001    /**
002     * Used so we don't have class collisions with Runecraft
003     *  - Patch by Zeerix
004     * @author James
005     */
006    public class Digging extends md {
007        /**
008         * Creates a digging class
009         * @param world
010         */
011        public Digging(fv world) {
012            super(world);
013        }
014    
015        /**
016         * Bloop.
017         * @param world
018         * @param player
019         */
020        public Digging(fv world, fy player) {
021            this(world);
022            a = player;
023        }
024    
025        /**
026         * Called when a block is destroyed. We intercept it.
027         * @param x
028         * @param y
029         * @param z
030         * @return
031         */
032        @Override
033        public boolean c(int x, int y, int z) {
034            Block block = etc.getServer().getBlockAt(x, y, z);
035            if ((Boolean) etc.getLoader().callHook(PluginLoader.Hook.BLOCK_BROKEN, ((fy) a).getPlayer(), block)) {
036                return true;
037            }
038            return super.c(x, y, z);
039        }
040    
041        /**
042         * Called when a player right-click air with an item in hand. We intercept it.
043         * @param player
044         * @param world
045         * @param item
046         * @return
047         */
048        public boolean a(hl player, fv world, jl item, Block blockToPlace, Block blockClicked) {
049            // hMod: only call this hook if we're not using buckets/signs
050            if (item != null) {
051                if (item.a > 0 && item.c != Item.Type.Sign.getId() && item.c != Item.Type.Bucket.getId() && item.c != Item.Type.WaterBucket.getId() && item.c != Item.Type.LavaBucket.getId()) {
052                    if (player instanceof fy && (Boolean) etc.getLoader().callHook(PluginLoader.Hook.ITEM_USE, ((fy) player).getPlayer(), blockToPlace, blockClicked, new Item(item))) {
053                        return false;
054                    }
055                }
056            }
057            return super.a(player, world, item);
058        }
059    }