Getting blocks in a radius

Discussion in 'Plugin Development' started by dmulloy2, Mar 15, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    dmulloy2

    For my plugin, I would like to check for mob spawners in a radius, so people cannot farm mob spawners for insane amounts of plugin xp.
    Code:
                int startx, starty, startz;
                int endx, endy, endz;
                for (int x = startx; x < endx; x++) {
                    for (int y = starty; y < endy; y++) {
                        for (int z = startz; z < endz; z++) {
                            Block block = world.getBlockAt(x, y, z);
                            if (block.getTypeId() == 52)
                                return;
                        }
                    }
                }
    It's throwing an error at "world.getBlockAt()" (world cannot be resolved)

    Any suggestions? :3
     
  2. Offline

    Tirelessly

    If you have a player use player.getWorld, if you have an event use event.get(Entity, Player, Block)().getWorld().
    If you have none of those you can use getServer().getWorlds().get(0)
     
  3. Offline

    Barinade

    You haven't defined "world"

    Show more code.
     
Thread Status:
Not open for further replies.

Share This Page