Examples of TargetBlock


Examples of com.sk89q.worldedit.util.TargetBlock

                pos.getY() - 1, pos.getZ());
    }

    @Override
    public WorldVector getBlockTrace(int range, boolean useLastBlock) {
        TargetBlock tb = new TargetBlock(this, range, 0.2);
        return (useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock());
    }
View Full Code Here

Examples of com.sk89q.worldedit.util.TargetBlock

        return (useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock());
    }

    @Override
    public WorldVectorFace getBlockTraceFace(int range, boolean useLastBlock) {
        TargetBlock tb = new TargetBlock(this, range, 0.2);
        return (useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace());
    }
View Full Code Here

Examples of com.sk89q.worldedit.util.TargetBlock

        return getBlockTrace(range, false);
    }

    @Override
    public WorldVector getSolidBlockTrace(int range) {
        TargetBlock tb = new TargetBlock(this, range, 0.2);
        return tb.getSolidTargetBlock();
    }
View Full Code Here

Examples of com.sk89q.worldedit.util.TargetBlock

     */

    @Override
    public boolean passThroughForwardWall(int range) {
        int searchDist = 0;
        TargetBlock hitBlox = new TargetBlock(this, range, 0.2);
        World world = getPosition().getWorld();
        BlockWorldVector block;
        boolean firstBlock = true;
        int freeToFind = 2;
        boolean inFree = false;

        while ((block = hitBlox.getNextBlock()) != null) {
            boolean free = BlockType.canPassThrough(world.getBlock(block));

            if (firstBlock) {
                firstBlock = false;

View Full Code Here

Examples of net.sacredlabyrinth.Phaed.TelePlusPlus.TargetBlock

                   
                    return true;
                }
            } else if (split[0].equalsIgnoreCase("jump") && plugin.permissionsManager.hasPermission(player, plugin.permissionsManager.jump) && !plugin.settingsManager.disableJump) {
                if (split.length == 1) {
                    TargetBlock aiming = new TargetBlock(player, 1000, 0.2, plugin.itemManager.getThoughBlocks());
                    Block block = aiming.getTargetBlock();

                    if (block == null) {
                        player.sendMessage(ChatColor.RED + "Not pointing to valid block");
                    } else {
                        double x = block.getX() + 0.5D;
View Full Code Here

Examples of net.sacredlabyrinth.Phaed.TelePlusPlus.TargetBlock

        if (event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
            ItemStack item = event.getItem();

            if (item != null) {
                if (item.getType().equals(Material.getMaterial(plugin.settingsManager.moverItem)) && plugin.permissionsManager.hasPermission(player, plugin.permissionsManager.mover) && !plugin.settingsManager.disableMover) {
                    TargetBlock aiming = new TargetBlock(player, 3000, 0.2, plugin.itemManager.getThoughBlocks());
                    Block block = aiming.getTargetBlock();

                    if (block == null || block.getY() <= 1) {
                        player.sendMessage(ChatColor.RED + "Not pointing to valid block");
                    } else {
                        if (!plugin.moverManager.addMovedBlock(player, block)) {
                            ChatBlock.sendMessage(player, ChatColor.RED + "Cannot add block, you have tagged entities");
                            return;
                        }
                       
                        if (plugin.settingsManager.sayMover) {
                            player.sendMessage(ChatColor.DARK_PURPLE + "Block tagged");
                        }
                       
                        return;
                    }
                }

                if (item.getType().equals(Material.getMaterial(plugin.settingsManager.toolItem)) && plugin.permissionsManager.hasPermission(player, plugin.permissionsManager.tool) && !plugin.settingsManager.disableTool) {
                    TargetBlock aiming = new TargetBlock(player, 3000, 0.2, plugin.itemManager.getThoughBlocks());
                    Block block = aiming.getTargetBlock();

                    if (block == null || block.getY() <= 1) {
                        player.sendMessage(ChatColor.RED + "Not pointing to valid block");
                    } else {
                        Location loc = new Location(block.getWorld(), block.getX(), block.getY() + 1, block.getZ(), player.getLocation().getYaw(), player.getLocation().getPitch());

                        if (!plugin.teleportManager.teleport(player, loc)) {
                            player.sendMessage(ChatColor.RED + "No free space available for teleport");
                            return;
                        }

                        String msg = player.getName() + " tool jumped to " + "[" + plugin.commandManager.printWorld(loc.getWorld().getName()) + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ() + "]";
                        if (plugin.settingsManager.logTool) {
                            plugin.commandManager.logTp(player, msg);
                        }
                       
                        if (plugin.settingsManager.notifyTool) {
                            plugin.commandManager.notifyTp(player, msg);
                        }
                       
                        if (plugin.settingsManager.sayTool) {
                            player.sendMessage(ChatColor.DARK_PURPLE + "Jumped");
                        }

                        event.setCancelled(true);
                        return;
                    }
                }
            }

            Block clicked = event.getClickedBlock();

            if (clicked != null) {
                if (clicked.getType().equals(Material.GLASS)) {
                    if (plugin.glassedManager.isGlassedBlock(player, clicked)) {
                        Block fallblock = player.getWorld().getBlockAt(clicked.getX(), clicked.getY() - plugin.settingsManager.settingsFallBlockDistance, clicked.getZ());

                        if (!plugin.glassedManager.addGlassed(player, fallblock)) {
                            plugin.glassedManager.removeGlassed(player);
                        }
                    }
                }
            }
        } else if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
            ItemStack item = event.getItem();

            if (item != null) {
                if (item.getType().equals(Material.getMaterial(plugin.settingsManager.toolItem)) && plugin.permissionsManager.hasPermission(player, plugin.permissionsManager.tool) && !plugin.settingsManager.disableTool) {
                    TargetBlock aiming = new TargetBlock(player, 3000, 0.2, plugin.itemManager.getThoughBlocks());
                    Block block = aiming.getTargetBlock();

                    if (block == null || block.getY() <= 1) {
                        player.sendMessage(ChatColor.RED + "Not pointing to valid block");
                    } else {
                        boolean passed = false;
                        Location from = block.getLocation();

                        while ((block = aiming.getNextBlock()) != null) {
                            if (block.getY() <= 1) {
                                player.sendMessage(ChatColor.RED + "No free space available for teleport");
                                return;
                            }

                            if (plugin.teleportManager.blockIsSafe(block)) {
                                Location to = new Location(block.getWorld(), block.getX(), block.getY() + 1, block.getZ(), player.getLocation().getYaw(), player.getLocation().getPitch());

                                to.setX(to.getX() + .5D);
                                to.setZ(to.getZ() + .5D);

                                if (!block.getWorld().isChunkLoaded(to.getBlockX() >> 4, to.getBlockZ() >> 4)) {
                                    block.getWorld().loadChunk(to.getBlockX() >> 4, to.getBlockZ() >> 4);
                                }

                                player.teleport(to);

                                String msg = player.getName() + " passed through " + Math.round(Helper.distance(from, to)) + " blocks to " + "[" + plugin.commandManager.printWorld(to.getWorld().getName()) + to.getBlockX() + " " + to.getBlockY() + " " + to.getBlockZ() + "]";

                                if (plugin.settingsManager.logTool) {
                                    plugin.commandManager.logTp(player, msg);
                                }
                               
                                if (plugin.settingsManager.notifyTool) {
                                    plugin.commandManager.notifyTp(player, msg);
                                }
                               
                                if (plugin.settingsManager.sayTool) {
                                    player.sendMessage(ChatColor.DARK_PURPLE + "Passed through " + Math.round(Helper.distance(from, to)) + " blocks");
                                }

                                passed = true;
                                break;
                            }
                        }

                        if (!passed) {
                            player.sendMessage(ChatColor.RED + "No free space available for teleport");
                        }

                        return;
                    }
                }

                if (item.getType().equals(Material.getMaterial(plugin.settingsManager.moverItem)) && plugin.permissionsManager.hasPermission(player, plugin.permissionsManager.mover) && !plugin.settingsManager.disableMover) {
                    HashSet<Entity> entities = plugin.moverManager.getMovedEntities(player);

                    if (entities.size() > 0) {
                        TargetBlock aiming = new TargetBlock(player, 3000, 0.2, plugin.itemManager.getThoughBlocks());
                        Block block = aiming.getTargetBlock();

                        if (block == null) {
                            player.sendMessage(ChatColor.RED + "Not pointing to valid block");
                        } else {
                            Location loc = new Location(block.getWorld(), block.getX(), block.getY() + 1, block.getZ(), player.getLocation().getYaw(), player.getLocation().getPitch());

                            ArrayList<Entity> tps = new ArrayList<Entity>();

                            for (Entity entity : entities) {
                                tps.add(entity);
                            }

                            if (!plugin.teleportManager.teleport(tps, loc)) {
                                player.sendMessage(ChatColor.RED + "No free space available for teleport");
                                return;
                            }

                            plugin.moverManager.setEntitiesDirty();
                           
                            String msg = player.getName() + " moved " + Helper.entityArrayString(tps) + " to [" + plugin.commandManager.printWorld(loc.getWorld().getName()) + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ() + "]";

                            if (plugin.settingsManager.logMover) {
                                plugin.commandManager.logTp(player, msg);
                            }
                           
                            if (plugin.settingsManager.notifyMover) {
                                plugin.commandManager.notifyTp(player, msg);
                            }
                           
                            if (plugin.settingsManager.sayMover) {
                                player.sendMessage(ChatColor.DARK_PURPLE + "Moved");
                            }

                            event.setCancelled(true);
                        }
                    }

                    Block block = plugin.moverManager.getMovedBlock(player);

                    if (block != null) {
                        Material mat = block.getType();
                        byte data = block.getData();

                        TargetBlock aiming = new TargetBlock(player, 3000, 0.2, plugin.itemManager.getThoughBlocks());
                        Block target = aiming.getFaceBlock();

                        if (target != null) {
                            if (plugin.itemManager.isThroughBlock(target.getTypeId())) {
                                block.setType(Material.AIR);
                                target.setType(mat);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.