2015-02-19 04:24:05 +01:00
|
|
|
package com.intellectualcrafters.plot.util;
|
|
|
|
|
2015-02-22 07:30:58 +01:00
|
|
|
import com.intellectualcrafters.plot.object.Location;
|
2015-02-19 04:24:05 +01:00
|
|
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
2015-02-26 05:16:52 +01:00
|
|
|
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
2015-02-19 04:24:05 +01:00
|
|
|
|
|
|
|
public abstract class BlockManager {
|
2015-02-22 14:20:41 +01:00
|
|
|
public static BlockManager manager;
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 13:24:48 +01:00
|
|
|
public abstract String[] getBiomeList();
|
2015-02-26 05:16:52 +01:00
|
|
|
|
|
|
|
public abstract boolean addItems(String world, PlotItem items);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 13:24:48 +01:00
|
|
|
public abstract int getBiomeFromString(String biome);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 13:24:48 +01:00
|
|
|
public abstract int getBlockIdFromString(String block);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 12:30:46 +01:00
|
|
|
public abstract int getHeighestBlock(Location loc);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 08:13:27 +01:00
|
|
|
public abstract String getBiome(Location loc);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 07:56:46 +01:00
|
|
|
public abstract Location getSpawn(String world);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 07:30:58 +01:00
|
|
|
public abstract String[] getSign(Location loc);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-22 07:30:58 +01:00
|
|
|
public abstract boolean isWorld(String world);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-19 11:12:26 +01:00
|
|
|
public abstract void functionSetBlocks(String worldname, int[] x, int[] y, int[] z, int[] id, byte[] data);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-19 11:12:26 +01:00
|
|
|
public abstract void functionSetSign(String worldname, int x, int y, int z, String[] lines);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-21 03:49:25 +01:00
|
|
|
public abstract void functionSetBlock(String worldname, int x, int y, int z, int id, byte data);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-20 17:17:34 +01:00
|
|
|
public abstract void functionSetBiomes(final String worldname, final int[] x, final int z[], final int[] biome);
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-20 17:17:34 +01:00
|
|
|
public static void setBiomes(final String worldname, final int[] x, final int z[], final int[] biome) {
|
|
|
|
manager.functionSetBiomes(worldname, x, z, biome);
|
|
|
|
}
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-20 07:34:19 +01:00
|
|
|
public static void setBlocks(final String worldname, final int[] x, final int y[], final int z[], final PlotBlock[][] blocks) {
|
|
|
|
final int[] id = new int[blocks.length];
|
|
|
|
final byte[] data = new byte[blocks.length];
|
2015-02-19 04:24:05 +01:00
|
|
|
for (int i = 0; i < blocks.length; i++) {
|
2015-02-20 07:34:19 +01:00
|
|
|
final PlotBlock[] current = blocks[i];
|
2015-03-27 08:36:28 +01:00
|
|
|
final int n = MainUtil.random.random(current.length);
|
2015-02-19 04:24:05 +01:00
|
|
|
id[i] = current[n].id;
|
|
|
|
data[i] = current[n].data;
|
|
|
|
}
|
|
|
|
setBlocks(worldname, x, y, z, id, data);
|
|
|
|
}
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-20 07:34:19 +01:00
|
|
|
public static void setBlocks(final String worldname, final int[] x, final int y[], final int z[], final PlotBlock[] blocks) {
|
|
|
|
final int[] id = new int[blocks.length];
|
|
|
|
final byte[] data = new byte[blocks.length];
|
2015-02-19 04:24:05 +01:00
|
|
|
for (int i = 0; i < blocks.length; i++) {
|
2015-02-20 07:34:19 +01:00
|
|
|
final PlotBlock current = blocks[i];
|
2015-02-19 04:24:05 +01:00
|
|
|
id[i] = current.id;
|
|
|
|
data[i] = current.data;
|
|
|
|
}
|
|
|
|
setBlocks(worldname, x, y, z, id, data);
|
|
|
|
}
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-20 07:34:19 +01:00
|
|
|
public static void setSign(final String worldname, final int x, final int y, final int z, final String[] lines) {
|
2015-02-19 11:12:26 +01:00
|
|
|
manager.functionSetSign(worldname, x, y, z, lines);
|
|
|
|
}
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-02-20 07:34:19 +01:00
|
|
|
public static void setBlocks(final String worldname, final int[] x, final int[] y, final int[] z, final int[] id, final byte[] data) {
|
2015-02-19 11:12:26 +01:00
|
|
|
manager.functionSetBlocks(worldname, x, y, z, id, data);
|
2015-02-19 04:24:05 +01:00
|
|
|
}
|
|
|
|
}
|