Package org.bukkit

Examples of org.bukkit.World


        }

        Map<MACreature, Integer> monsters = w.getMonstersToSpawn(wave, playerCount, arena);
        List<Location> spawnpoints = w.getSpawnpoints(arena);

        World world = arena.getWorld();
        int totalSpawnpoints = spawnpoints.size();
        int index = 0;
        double mul = w.getHealthMultiplier();

        for (Map.Entry<MACreature, Integer> entry : monsters.entrySet()) {
View Full Code Here


       
        // Grab the Configuration and ArenaMaster
        ArenaMaster am = plugin.getArenaMaster();
               
        // Create the arena node in the config-file.
        World world = loc.getWorld();
        Arena arena = am.createArenaNode(name, world);
       
        // Get the hippie bounds.
        int x1 = (int)loc.getX() - radius;
        int x2 = (int)loc.getX() + radius;
        int y1 = (int)loc.getY() - 9;
        int y2 = (int)loc.getY() - 1;
        int z1 = (int)loc.getZ() - radius;
        int z2 = (int)loc.getZ() + radius;
       
        int lx1 = x1;
        int lx2 = x1 + am.getClasses().size() + 3;
        int ly1 = y1-6;
        int ly2 = y1-2;
        int lz1 = z1;
        int lz2 = z1 + 6;
       
        // Save the precious patch
        HashMap<EntityPosition,Integer> preciousPatch = new HashMap<EntityPosition,Integer>();
        Location lo;
        int id;
        for (int i = x1; i <= x2; i++)
        {
            for (int j = ly1; j <= y2; j++)
            {
                for (int k = z1; k <= z2; k++)
                {
                    lo = world.getBlockAt(i,j,k).getLocation();
                    id = world.getBlockAt(i,j,k).getTypeId();
                    preciousPatch.put(new EntityPosition(lo),id);
                }
            }
        }
        try
        {
            new File("plugins" + sep + "MobArena" + sep + "agbackup").mkdir();
            FileOutputStream fos = new FileOutputStream("plugins" + sep + "MobArena" + sep + "agbackup" + sep + name + ".tmp");
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(preciousPatch);
            oos.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
            Messenger.warning("Couldn't create backup file. Aborting auto-generate...");
            return false;
        }
       
        // Build some monster walls.
        for (int i = x1; i <= x2; i++)
        {
            for (int j = y1; j <= y2; j++)
            {
                world.getBlockAt(i,j,z1).setTypeId(24);
                world.getBlockAt(i,j,z2).setTypeId(24);
            }
        }
        for (int k = z1; k <= z2; k++)
        {
            for (int j = y1; j <= y2; j++)
            {
                world.getBlockAt(x1,j,k).setTypeId(24);
                world.getBlockAt(x2,j,k).setTypeId(24);
            }
        }
       
        // Add some hippie light.
        for (int i = x1; i <= x2; i++)
        {
            world.getBlockAt(i,y1+2,z1).setTypeId(89);
            world.getBlockAt(i,y1+2,z2).setTypeId(89);
        }
        for (int k = z1; k <= z2; k++)
        {
            world.getBlockAt(x1,y1+2,k).setTypeId(89);
            world.getBlockAt(x2,y1+2,k).setTypeId(89);
        }
       
        // Build a monster floor, and some Obsidian foundation.
        for (int i = x1; i <= x2; i++)
        {
            for (int k = z1; k <= z2; k++)
            {
                world.getBlockAt(i,y1,k).setTypeId(24);
                world.getBlockAt(i,y1-1,k).setTypeId(49);
            }
        }
       
        // Make a hippie roof.
        for (int i = x1; i <= x2; i++)
        {
            for (int k = z1; k <= z2; k++)
                world.getBlockAt(i,y2,k).setTypeId(20);
        }
       
        // Monster bulldoze
        for (int i = x1+1; i < x2; i++)
            for (int j = y1+1; j < y2; j++)
                for (int k = z1+1; k < z2; k++)
                    world.getBlockAt(i,j,k).setTypeId(0);
       
        // Build a hippie lobby
        for (int i = lx1; i <= lx2; i++) // Walls
        {
            for (int j = ly1; j <= ly2; j++)
            {
                world.getBlockAt(i,j,lz1).setTypeId(24);
                world.getBlockAt(i,j,lz2).setTypeId(24);
            }
        }
        for (int k = lz1; k <= lz2; k++) // Walls
        {
            for (int j = ly1; j <= ly2; j++)
            {
                world.getBlockAt(lx1,j,k).setTypeId(24);
                world.getBlockAt(lx2,j,k).setTypeId(24);
            }
        }
        for (int k = lz1; k <= lz2; k++) // Lights
        {
            world.getBlockAt(lx1,ly1+2,k).setTypeId(89);
            world.getBlockAt(lx2,ly1+2,k).setTypeId(89);
            world.getBlockAt(lx1,ly1+3,k).setTypeId(89);
            world.getBlockAt(lx2,ly1+3,k).setTypeId(89);
        }
        for (int i = lx1; i <= lx2; i++) // Floor
        {
            for (int k = lz1; k <= lz2; k++)
                world.getBlockAt(i,ly1,k).setTypeId(24);
        }
        for (int i = x1+1; i < lx2; i++) // Bulldoze
            for (int j = ly1+1; j <= ly2; j++)
                for (int k = lz1+1; k < lz2; k++)
                    world.getBlockAt(i,j,k).setTypeId(0);
       
        // Place the hippie signs
        //Iterator<String> iterator = am.getClasses().iterator();
        Iterator<String> iterator = am.getClasses().keySet().iterator();
        for (int i = lx1+2; i <= lx2-2; i++) // Signs
        {
            world.getBlockAt(i,ly1+1,lz2-1).setTypeIdAndData(63, (byte)0x8, false);
            Sign sign = (Sign) world.getBlockAt(i,ly1+1,lz2-1).getState();
            sign.setLine(0, TextUtils.camelCase((String)iterator.next()));
            sign.update();
        }
        world.getBlockAt(lx2-2,ly1+1,lz1+2).setType(Material.IRON_BLOCK);
       
        // Set up the monster points.
        ArenaRegion region = arena.getRegion();
        region.set("p1", new Location(world, x1, ly1, z1));
        region.set("p2", new Location(world, x2, y2+1, z2));
View Full Code Here

        {
            if (error) Messenger.warning("Couldn't find backup file for arena '" + name + "'");
            return false;
        }
       
        World world = plugin.getServer().getWorld(preciousPatch.keySet().iterator().next().getWorld());
       
        for (Map.Entry<EntityPosition,Integer> entry : preciousPatch.entrySet())
        {
            world.getBlockAt(entry.getKey().getLocation(world)).setTypeId(entry.getValue());
        }

        plugin.getConfig().set("arenas." + name, null);
        plugin.saveConfig();
       
View Full Code Here

    @Override
    public void execute(final Arena arena, MABoss boss) {
        // Grab the target, or a random player.
        LivingEntity target = AbilityUtils.getTarget(arena, boss.getEntity(), true);
       
        final World world = arena.getWorld();
        final Location loc;

        Block b = world.getBlockAt(target.getLocation());
        for (int i = 0; i < 3; i++) {
            if (b.getType() == Material.AIR) {
                break;
            }
            b = b.getRelative(BlockFace.UP);
        }
        loc = b.getLocation();

        if (b.getType() != Material.AIR) {
            Messenger.warning("Failed to place Obsidian Bomb at: " + target.getLocation());
            return;
        }

        b.setType(Material.OBSIDIAN);
        arena.addBlock(b);

        arena.scheduleTask(new Runnable() {
            public void run() {
                if (!arena.isRunning())
                    return;
               
                world.getBlockAt(loc).breakNaturally();
                world.createExplosion(loc, 3F);
            }
        }, FUSE);
    }
View Full Code Here

            if (s.equals("spec")) s = "spectator";

            // World change stuff for the arena warp
            if (s.equals("arena") && !arena.getRegion().contains(loc)) {
                if (!arena.getWorld().getName().equals(loc.getWorld().getName())) {
                    World tmp = arena.getWorld();
                    arena.setWorld(loc.getWorld());
                    if (arena.getRegion().contains(loc)) {
                        String msg = String.format(
                                "Changed world of arena %s from %s to %s.",
                                ChatColor.GREEN + arena.configName() + ChatColor.RESET,
                                ChatColor.YELLOW + tmp.getName() + ChatColor.RESET,
                                ChatColor.YELLOW + loc.getWorld().getName() + ChatColor.RESET
                        );
                        tell(player, msg);
                    } else {
                        arena.setWorld(tmp);
View Full Code Here

      for (MinecartMember<?> mm : this) {
        mm.updateChunks(previousChunksBuffer, newChunksBuffer);
      }
      int cx, cz;
      IntVector2 chunk;
      final World world = getWorld();
      Iterator<IntVector2> iter;
      if (this.canUnload()) {
        // Check whether the new chunks are unloaded
        iter = newChunksBuffer.iterator();
        while (iter.hasNext()) {
          chunk = iter.next();
          cx = chunk.x;
          cz = chunk.z;
          if (!world.isChunkLoaded(cx, cz)) {
            this.unload();
            throw new GroupUnloadedException();
          }
        }
      } else {
        // Mark previous chunks for unload
        iter = previousChunksBuffer.iterator();
        while (iter.hasNext()) {
          chunk = iter.next();
          if (!newChunksBuffer.contains(chunk)) {
            cx = chunk.x;
            cz = chunk.z;
            world.unloadChunkRequest(cx, cz);
          }
        }
        // Load the new chunks
        iter = newChunksBuffer.iterator();
        while (iter.hasNext()) {
          chunk = iter.next();
          if (!previousChunksBuffer.contains(chunk)) {
            cx = chunk.x;
            cz = chunk.z;
            world.getChunkAt(cx, cz);
          }
        }
      }
      return true;
    } catch (MemberMissingException ex) {
View Full Code Here

    this.lastRailType = this.railType;
    this.lastRailLogic = this.railLogic;

    // Obtain the current, live block information
    final CommonMinecart<?> entity = owner.getEntity();
    final World world = entity.getWorld();
    this.blockPos = entity.loc.block();

    // Gather rail information
    owner.vertToSlope = false;
View Full Code Here

  public void updateUnloaded() {
    unloaded = OfflineGroupManager.containsMinecart(entity.getUniqueId());
    if (!unloaded) {
      // Check a 5x5 chunk area around this Minecart to see if it is loaded
      World world = entity.getWorld();
      int midX = entity.loc.x.chunk();
      int midZ = entity.loc.z.chunk();
      int cx, cz;
      for (cx = -2; cx <= 2; cx++) {
        for (cz = -2; cz <= 2; cz++) {
View Full Code Here

      OfflineMember omember = OfflineGroupManager.findMember(this.getTrainProperties().getTrainName(), this.getUUID());
      if (omember == null) {
        return null;
      } else {
        // Find world
        World world = Bukkit.getWorld(omember.group.worldUUID);
        if (world == null) {
          return new BlockLocation("Unknown", omember.cx << 4, 0, omember.cz << 4);
        } else {
          return new BlockLocation(world, omember.cx << 4, 0, omember.cz << 4);
        }
View Full Code Here

   */
  public static void storeGroup(MinecartGroup group) {
    if (group == null || !group.isValid()) {
      return;
    }
    final World world = group.getWorld();
    if (world == null) {
      return;
    }
    synchronized (managers) {
      for (MinecartMember<?> mm : group) {
View Full Code Here

TOP

Related Classes of org.bukkit.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.