Package org.bukkit

Examples of org.bukkit.Chunk


      Player player = (Player)sender;
     
      if (!Utils.checkCommandSpam(player, "chunk") && Permissions.checkPerms(player, "cex.chunk.refresh")) {
        Location loc = player.getLocation();
        World w = player.getWorld();
        Chunk lastChunk = w.getChunkAt(loc);
        Chunk currentChunk = w.getChunkAt(loc);
       
        // first regenerate player's chunk
        w.refreshChunk((int) loc.getX(), (int) loc.getZ());
       
        // regenerate left
View Full Code Here


   * which this forces Bukkit to refresh the chunk the player is teleporting into"
   * @param l
   */
  public static void refreshMapChunk(Location l) {
    World world = l.getWorld();
      Chunk chunk = world.getChunkAt(l);
      int chunkx = chunk.getX();
      int chunkz = chunk.getZ();
      world.refreshChunk(chunkx, chunkz);
  }
View Full Code Here

       
        if (p1 == null || p2 == null) {
            return result;
        }
       
        Chunk c1 = world.getChunkAt(p1);
        Chunk c2 = world.getChunkAt(p2);
       
        for (int i = c1.getX(); i <= c2.getX(); i++) {
            for (int j = c1.getZ(); j <= c2.getZ(); j++) {
                result.add(world.getChunkAt(i,j));
            }
        }
       
        return result;
View Full Code Here

          TrainProperties.remove(wg.name);
          for (OfflineMember wm : wg.members) {
            containedMinecarts.remove(wm.entityUID);
            // Load the chunk this minecart is in and remove it
            // We already de-linked the group map, so no worry for replacements
            Chunk chunk = world.getChunkAt(wm.cx, wm.cz);
            Iterator<Entity> iter = WorldUtil.getEntities(chunk).iterator();
            while (iter.hasNext()) {
              Entity next = iter.next();
              if (next.getUniqueId().equals(wm.entityUID)) {
                next.remove();
View Full Code Here

  }

  public MinecartMember<?> create(World world) {
    MinecartMember<?> mm = null;
    // first try to find it in the chunk
    Chunk c = world.getChunkAt(cx, cz);
    for (Entity e : WorldUtil.getEntities(c)) {
      if (e instanceof Minecart && e.getUniqueId().equals(this.entityUID)) {
        mm = MinecartMemberStore.convert((Minecart) e);
        break;
      }
View Full Code Here

        dB.report(scriptEntry, getName(),
                action.debug()
                + chunkloc.debug()
                + length.debug());

        Chunk chunk = chunkloc.getChunk();
        String chunkString = chunk.getX()+", "+chunk.getZ();

        switch (Action.valueOf(action.asString())) {
        case ADD:
            if(length.getSeconds() != 0)
                chunkDelays.put(chunkString, System.currentTimeMillis() + length.getMillis());
            else
                chunkDelays.put(chunkString, (long) 0);
            dB.echoDebug(scriptEntry, "...added chunk "+chunk.getX() + ", "+ chunk.getZ() + " with a delay of " + length.getSeconds() + " seconds.");
            if(!chunk.isLoaded())
                chunk.load();
            break;
        case REMOVE:
            if(chunkDelays.containsKey(chunkString)) {
                chunkDelays.remove(chunkString);
                dB.echoDebug(scriptEntry, "...allowing unloading of chunk "+chunk.getX() + ", "+ chunk.getZ());
            }
            else
                dB.echoError("Chunk was not on the load list!");
            break;
        case REMOVEALL:
View Full Code Here

    @EventHandler
    public void stopDespawn(NPCDespawnEvent e) {
        if (e.getNPC() == null || !e.getNPC().isSpawned())
            return;
        Chunk chnk = e.getNPC().getEntity().getLocation().getChunk();
        String chunkString = chnk.getX()+", "+ chnk.getZ();
        if(chunkDelays.containsKey(chunkString)) {
            if(chunkDelays.get(chunkString) == 0)
                e.setCancelled(true);

            else if(System.currentTimeMillis() < chunkDelays.get(chunkString))
View Full Code Here

        // -->
        if (attribute.startsWith("list_chunks")) {
            Set<Chunk> chunks = new HashSet<Chunk>();
            for (LocationPair pair : pairs) {
                int minY = pair.low.getBlockY();
                Chunk minChunk = pair.low.getChunk();
                if (isInsideCuboid(new Location(getWorld(), minChunk.getX()*16, minY, minChunk.getZ()*16)))
                    chunks.add(minChunk);
                Chunk maxChunk = pair.high.getChunk();
                if (isInsideCuboid(new Location(getWorld(), maxChunk.getX()*16+15, minY, maxChunk.getZ()*16+15)))
                    chunks.add(maxChunk);
                dB.log("min:" + minChunk.getX() + "," + minChunk.getZ());
                dB.log("max:" + maxChunk.getX() + "," + maxChunk.getZ());
                for(int x = minChunk.getX()+1; x <= maxChunk.getX()-1; x++) {
                    for(int z = minChunk.getZ()+1; z <= maxChunk.getZ()-1; z++) {
                        chunks.add(getWorld().getChunkAt(x, z));
                    }
                }
            }
            dList list = new dList();
            for (Chunk chunk : chunks)
                list.add(new dChunk(chunk).identify());
            return list.getAttribute(attribute.fulfill(1));
        }

        // <--[tag]
        // @attribute <cu@cuboid.list_partial_chunks>
        // @returns dList(dChunk)
        // @description
        // Gets a list of all chunks partially or entirely within the dCuboid.
        // -->
        if (attribute.startsWith("list_partial_chunks")) {
            Set<Chunk> chunks = new HashSet<Chunk>();
            for (LocationPair pair : pairs) {
                Chunk minChunk = pair.low.getChunk();
                Chunk maxChunk = pair.high.getChunk();
                dB.log("min:" + minChunk.getX() + "," + minChunk.getZ());
                dB.log("max:" + maxChunk.getX() + "," + maxChunk.getZ());
                for (int x = minChunk.getX(); x <= maxChunk.getX(); x++) {
                    for (int z = minChunk.getZ(); z <= maxChunk.getZ(); z++) {
                        chunks.add(getWorld().getChunkAt(x, z));
                    }
                }
            }
            dList list = new dList();
View Full Code Here

    // attempt to preload the chunk
    int chunkx = dest.getBlockX() >> 4;
    int chunkz = dest.getBlockZ() >> 4;

    Chunk chunk = world.getChunkAt(chunkx, chunkz);
    if (!world.isChunkLoaded(chunk)) {
      world.loadChunk(chunk);
    }
   
    Block b1, b2;
View Full Code Here

        Set<Chunk> chunks = new HashSet<Chunk>();

        if(hasRegion()) {

            Chunk c1 = getWorld().getChunkAt(getRegion().getMinimumPoint().getBlockX() >> 4, getRegion().getMinimumPoint().getBlockZ() >> 4);
            Chunk c2 = getWorld().getChunkAt(getRegion().getMaximumPoint().getBlockX() >> 4, getRegion().getMaximumPoint().getBlockZ() >> 4);
            int xMin = Math.min(c1.getX(), c2.getX());
            int xMax = Math.max(c1.getX(), c2.getX());
            int zMin = Math.min(c1.getZ(), c2.getZ());
            int zMax = Math.max(c1.getZ(), c2.getZ());

            for(int x = xMin; x <= xMax; x++)
                for(int z = zMin; z <= zMax; z++)
                    chunks.add(getWorld().getChunkAt(x,z));
        } else if (hasRadiusAndCenter()) {
View Full Code Here

TOP

Related Classes of org.bukkit.Chunk

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.