PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java

67 lines
2.5 KiB
Java
Raw Normal View History

2015-02-23 06:29:45 +01:00
package com.intellectualcrafters.plot.util;
import java.util.HashMap;
import java.util.List;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock;
2015-02-23 06:29:45 +01:00
import com.intellectualcrafters.plot.object.PlotId;
2015-02-26 05:43:01 +01:00
import com.intellectualcrafters.plot.object.PlotLoc;
2015-02-23 06:29:45 +01:00
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
2015-02-23 06:29:45 +01:00
public abstract class ChunkManager {
2015-02-23 06:29:45 +01:00
public static ChunkManager manager = null;
public static RegionWrapper CURRENT_PLOT_CLEAR = null;
public static boolean FORCE_PASTE = false;
2015-02-26 05:43:01 +01:00
public static HashMap<PlotLoc, HashMap<Short, Short>> GENERATE_BLOCKS = new HashMap<>();
public static HashMap<PlotLoc, HashMap<Short, Byte>> GENERATE_DATA = new HashMap<>();
2015-02-23 06:29:45 +01:00
public static ChunkLoc getChunkChunk(final Location loc) {
final int x = loc.getX() >> 9;
final int z = loc.getZ() >> 9;
return new ChunkLoc(x, z);
}
public abstract void setChunk(ChunkWrapper loc, PlotBlock[][] result);
2015-03-20 14:09:51 +01:00
public abstract int[] countEntities(Plot plot);
2015-02-23 06:29:45 +01:00
public abstract boolean loadChunk(String world, ChunkLoc loc);
2015-02-26 12:00:46 +01:00
public abstract boolean unloadChunk(String world, ChunkLoc loc);
2015-02-23 06:29:45 +01:00
public abstract List<ChunkLoc> getChunkChunks(String world);
public abstract void regenerateChunk(String world, ChunkLoc loc);
2015-02-23 06:29:45 +01:00
public abstract void deleteRegionFile(final String world, final ChunkLoc loc);
public abstract void deleteRegionFiles(final String world, final List<ChunkLoc> chunks);
2015-02-23 06:29:45 +01:00
public abstract Plot hasPlot(String world, ChunkLoc chunk);
public abstract boolean copyRegion(final Location pos1, final Location pos2, final Location newPos, final Runnable whenDone);
/**
* Assumptions:<br>
* - pos1 and pos2 are in the same plot<br>
* It can be harmful to the world if parameters outside this scope are provided
* @param pos1
* @param pos2
* @param whenDone
* @return
*/
2015-02-23 06:29:45 +01:00
public abstract boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone);
public abstract void clearAllEntities(final Plot plot);
public abstract void swap(String world, PlotId id, PlotId plotid);
2015-03-22 14:48:02 +01:00
public abstract void swap(String worldname, Location bot1, Location top1, Location bot2, Location top2);
2015-02-23 06:29:45 +01:00
}