Package com.sk89q.worldedit.world

Examples of com.sk89q.worldedit.world.World


        assertEquals(TEST_VALUE, location.getBlockY());
    }

    @Test
    public void testSetY() throws Exception {
        World world = mock(World.class);
        Location location1 = new Location(world, new Vector());
        Location location2 = location1.setY(TEST_VALUE);
        assertEquals(0, location1.getY(), EPSILON);
        assertEquals(0, location2.getX(), EPSILON);
        assertEquals(TEST_VALUE, location2.getY(), EPSILON);
View Full Code Here


        assertEquals(0, location2.getZ(), EPSILON);
    }

    @Test
    public void testGetZ() throws Exception {
        World world = mock(World.class);
        Location location = new Location(world, new Vector(0, 0, TEST_VALUE));
        assertEquals(TEST_VALUE, location.getZ(), EPSILON);
    }
View Full Code Here

        assertEquals(TEST_VALUE, location.getZ(), EPSILON);
    }

    @Test
    public void testGetBlockZ() throws Exception {
        World world = mock(World.class);
        Location location = new Location(world, new Vector(0, 0, TEST_VALUE));
        assertEquals(TEST_VALUE, location.getBlockZ());
    }
View Full Code Here

        return player.hasPermission("worldedit.tool.flood-fill");
    }

    @Override
    public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
        World world = (World) clicked.getExtent();

        int initialType = world.getBlockType(clicked.toVector());

        if (initialType == BlockID.AIR) {
            return true;
        }
View Full Code Here

        return player.hasPermission("worldedit.superpickaxe");
    }

    @Override
    public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
        World world = (World) clicked.getExtent();
        final int blockType = world.getBlockType(clicked.toVector());
        if (blockType == BlockID.BEDROCK
                && !player.canDestroyBedrock()) {
            return true;
        }

        EditSession editSession = session.createEditSession(player);
        editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);

        try {
            editSession.setBlock(clicked.toVector(), new BaseBlock(BlockID.AIR));
        } catch (MaxChangedBlocksException e) {
            player.printError("Max blocks change limit reached.");
        } finally {
            editSession.flushQueue();
        }

        world.playEffect(clicked.toVector(), 2001, blockType);

        return true;
    }
View Full Code Here

    }

    @Override
    public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {

        World world = (World) clicked.getExtent();
        EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, 0, player);
        BaseBlock block = (editSession).rawGetBlock(clicked.toVector());
        BlockType type = BlockType.fromID(block.getType());

        player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e"
                + "#" + block.getType() + "\u00A77" + " ("
                + (type == null ? "Unknown" : type.getName()) + ") "
                + "\u00A7f"
                + "[" + block.getData() + "]" + " (" + world.getBlockLightLevel(clicked.toVector()) + "/" + world.getBlockLightLevel(clicked.toVector().add(0, 1, 0)) + ")");

        if (block instanceof MobSpawnerBlock) {
            player.printRaw("\u00A7e" + "Mob Type: "
                    + ((MobSpawnerBlock) block).getMobType());
        } else if (block instanceof NoteBlock) {
View Full Code Here

    }

    private boolean handleCycle(Platform server, LocalConfiguration config,
            Player player, LocalSession session, Location clicked, boolean forward) {

        World world = (World) clicked.getExtent();

        int type = world.getBlockType(clicked.toVector());
        int data = world.getBlockData(clicked.toVector());

        if (!config.allowedDataCycleBlocks.isEmpty()
                && !player.hasPermission("worldedit.override.data-cycler")
                && !config.allowedDataCycleBlocks.contains(type)) {
            player.printError("You are not permitted to cycle the data value of that block.");
            return true;
        }

        int increment = forward ? 1 : -1;
        data = (new BaseBlock(type, data)).cycleData(increment);

        if (data < 0) {
            player.printError("That block's data cannot be cycled!");
        } else {
            world.setBlockData(clicked.toVector(), data);
        }

        return true;
    }
View Full Code Here

        return player.hasPermission("worldedit.superpickaxe.recursive");
    }

    @Override
    public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
        World world = (World) clicked.getExtent();

        int initialType = world.getBlockType(clicked.toVector());

        if (initialType == BlockID.AIR) {
            return true;
        }
View Full Code Here

    @Override
    public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
BlockBag bag = session.getBlockBag(player);

        World world = (World) clicked.getExtent();
        EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, bag, player);

        try {
            editSession.setBlock(clicked.toVector(), targetBlock);
        } catch (MaxChangedBlocksException ignored) {
View Full Code Here

    }


    @Override
    public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
        World world = (World) clicked.getExtent();
        EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, player);
        targetBlock = (editSession).getBlock(clicked.toVector());
        BlockType type = BlockType.fromID(targetBlock.getType());

        if (type != null) {
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.world.World

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.