mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Breaking things...
...
This commit is contained in:
parent
a89c062dbc
commit
3656ec5297
@ -17,6 +17,7 @@ public class ConfigurationNode {
|
|||||||
this.constant = constant;
|
this.constant = constant;
|
||||||
this.default_value = default_value;
|
this.default_value = default_value;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
this.value = default_value;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,45 +93,28 @@ public class PlayerFunctions {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static PlotId getPlotAbs(Location loc) {
|
public static PlotId getPlotAbs(Location loc) {
|
||||||
int x = loc.getBlockX();
|
|
||||||
int z = loc.getBlockZ();
|
|
||||||
|
|
||||||
String world = loc.getWorld().getName();
|
String world = loc.getWorld().getName();
|
||||||
|
PlotManager manager = PlotMain.getPlotManager(world);
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
int size = plotworld.PLOT_WIDTH + plotworld.ROAD_WIDTH;
|
PlotId id = manager.getPlotIdAbs(plotworld, loc);
|
||||||
int pathWidthLower;
|
|
||||||
if ((plotworld.ROAD_WIDTH % 2) == 0) {
|
if (id.x == null || id.y == null) {
|
||||||
pathWidthLower = (int) (Math.floor(plotworld.ROAD_WIDTH / 2) - 1);
|
|
||||||
} else {
|
|
||||||
pathWidthLower = (int) Math.floor(plotworld.ROAD_WIDTH / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int dx = x / size;
|
|
||||||
int dz = z / size;
|
|
||||||
|
|
||||||
if (x < 0) {
|
|
||||||
dx--;
|
|
||||||
x += ((-dx) * size);
|
|
||||||
}
|
|
||||||
if (z < 0) {
|
|
||||||
dz--;
|
|
||||||
z += ((-dz) * size);
|
|
||||||
}
|
|
||||||
|
|
||||||
int rx = (x) % size;
|
|
||||||
int rz = (z) % size;
|
|
||||||
|
|
||||||
int end = pathWidthLower + plotworld.PLOT_WIDTH;
|
|
||||||
boolean northSouth = (rz <= pathWidthLower) || (rz > end);
|
|
||||||
boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
|
||||||
|
|
||||||
if (northSouth || eastWest) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new PlotId(dx + 1, dz + 1);
|
|
||||||
|
return id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlotId getPlot(Location loc) {
|
public static PlotId getPlot(Location loc) {
|
||||||
|
|
||||||
|
PlotId plotid = getPlotAbs(loc);
|
||||||
|
|
||||||
|
if (plotid == null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return plotid;
|
||||||
|
|
||||||
int x = loc.getBlockX();
|
int x = loc.getBlockX();
|
||||||
int z = loc.getBlockZ();
|
int z = loc.getBlockZ();
|
||||||
|
|
||||||
|
@ -935,17 +935,16 @@ public class PlotHelper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCuboid(World world, Location pos1, Location pos2, short[] id_l, short[] d_l) {
|
public static void setCuboid(World world, Location pos1, Location pos2, PlotBlock[] blocks) {
|
||||||
if (!canSetFast) {
|
if (!canSetFast) {
|
||||||
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
||||||
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
||||||
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
||||||
int i = random(id_l.length);
|
int i = random(blocks.length);
|
||||||
short id = id_l[i];
|
PlotBlock newblock = blocks[i];
|
||||||
byte d = (byte) d_l[i];
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
if (!((block.getTypeId() == id) && (block.getData() == d))) {
|
if (!((block.getTypeId() == newblock.id) && (block.getData() == newblock.data))) {
|
||||||
block.setTypeIdAndData(id, d, false);
|
block.setTypeIdAndData(newblock.id, newblock.data, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -955,12 +954,11 @@ public class PlotHelper {
|
|||||||
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
||||||
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
||||||
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
||||||
int i = random(id_l.length);
|
int i = random(blocks.length);
|
||||||
short id = id_l[i];
|
PlotBlock newblock = blocks[i];
|
||||||
byte d = (byte) d_l[i];
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
if (!((block.getTypeId() == id) && (block.getData() == d))) {
|
if (!((block.getTypeId() == newblock.id) && (block.getData() == newblock.data))) {
|
||||||
SetBlockFast.set(world, x, y, z, id, d);
|
SetBlockFast.set(world, x, y, z, newblock.id, newblock.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -970,14 +968,14 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSimpleCuboid(World world, Location pos1, Location pos2, short id) {
|
public static void setSimpleCuboid(World world, Location pos1, Location pos2, PlotBlock newblock) {
|
||||||
if (!canSetFast) {
|
if (!canSetFast) {
|
||||||
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
|
||||||
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
||||||
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
if (!((block.getTypeId() == id))) {
|
if (!((block.getTypeId() == newblock.id))) {
|
||||||
block.setTypeId(id, false);
|
block.setTypeId(newblock.id, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -988,8 +986,8 @@ public class PlotHelper {
|
|||||||
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
|
||||||
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
|
||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
if (!((block.getTypeId() == id))) {
|
if (!((block.getTypeId() == newblock.id))) {
|
||||||
SetBlockFast.set(world, x, y, z, id, (byte) 0);
|
SetBlockFast.set(world, x, y, z, newblock.id, (byte) 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1162,29 +1160,4 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), loc.getWorld().getName());
|
return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), loc.getWorld().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "deprecation" })
|
|
||||||
private static void setWall(Block block, String currentBlockId) {
|
|
||||||
int blockId;
|
|
||||||
byte blockData = 0;
|
|
||||||
if (currentBlockId.contains(":")) {
|
|
||||||
try {
|
|
||||||
blockId = Integer.parseInt(currentBlockId.substring(0, currentBlockId.indexOf(":")));
|
|
||||||
blockData = Byte.parseByte(currentBlockId.substring(currentBlockId.indexOf(":") + 1));
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
blockId = 1;
|
|
||||||
blockData = (byte) 0;
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
blockId = Integer.parseInt(currentBlockId);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
blockId = 1;
|
|
||||||
blockData = (byte) 0;
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
block.setTypeIdAndData(blockId, blockData, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ public class PlotId {
|
|||||||
/**
|
/**
|
||||||
* x value
|
* x value
|
||||||
*/
|
*/
|
||||||
public int x;
|
public Integer x;
|
||||||
/**
|
/**
|
||||||
* y value
|
* y value
|
||||||
*/
|
*/
|
||||||
public int y;
|
public Integer y;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotId class (PlotId x,y values do not correspond to Block locations)
|
* PlotId class (PlotId x,y values do not correspond to Block locations)
|
||||||
|
@ -141,6 +141,7 @@ import com.intellectualcrafters.plot.database.PlotMeConverter;
|
|||||||
import com.intellectualcrafters.plot.database.SQLite;
|
import com.intellectualcrafters.plot.database.SQLite;
|
||||||
import com.intellectualcrafters.plot.events.PlayerTeleportToPlotEvent;
|
import com.intellectualcrafters.plot.events.PlayerTeleportToPlotEvent;
|
||||||
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
||||||
|
import com.intellectualcrafters.plot.generator.WorldGenerator;
|
||||||
import com.intellectualcrafters.plot.listeners.PlayerEvents;
|
import com.intellectualcrafters.plot.listeners.PlayerEvents;
|
||||||
import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
import com.intellectualcrafters.plot.listeners.WorldEditListener;
|
||||||
import com.intellectualcrafters.plot.listeners.WorldGuardListener;
|
import com.intellectualcrafters.plot.listeners.WorldGuardListener;
|
||||||
@ -202,7 +203,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ChunkGenerator getDefaultWorldGenerator(String worldname, String id) {
|
public ChunkGenerator getDefaultWorldGenerator(String worldname, String id) {
|
||||||
return new PlotSquaredGen(worldname);
|
return new WorldGenerator(worldname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -312,6 +313,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* All loaded plot worlds
|
* All loaded plot worlds
|
||||||
*/
|
*/
|
||||||
private static HashMap<String, PlotWorld> worlds = new HashMap<String, PlotWorld>();
|
private static HashMap<String, PlotWorld> worlds = new HashMap<String, PlotWorld>();
|
||||||
|
private static HashMap<String, PlotManager> managers = new HashMap<String, PlotManager>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all plots
|
* Get all plots
|
||||||
@ -402,6 +404,30 @@ public class PlotMain extends JavaPlugin {
|
|||||||
return (worlds.containsKey(world.getName()));
|
return (worlds.containsKey(world.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PlotManager getPlotManager(World world) {
|
||||||
|
if (managers.containsKey(world.getName())) {
|
||||||
|
return managers.get(world.getName());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param world
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PlotManager getPlotManager(String world) {
|
||||||
|
if (managers.containsKey(world)) {
|
||||||
|
return managers.get(world);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
@ -586,8 +612,6 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotWorld.BLOCKS = new ArrayList<>(Arrays.asList(new Material[] { ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND, SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK,
|
|
||||||
SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126) }));
|
|
||||||
if (Settings.KILL_ROAD_MOBS) {
|
if (Settings.KILL_ROAD_MOBS) {
|
||||||
killAllEntities();
|
killAllEntities();
|
||||||
}
|
}
|
||||||
@ -992,7 +1016,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
int x = this.location.getBlockX();
|
int x = this.location.getBlockX();
|
||||||
int y = this.location.getBlockY();
|
int y = this.location.getBlockY();
|
||||||
int z = this.location.getBlockZ();
|
int z = this.location.getBlockZ();
|
||||||
while (!found || (radius > plotworld.ROAD_WIDTH)) {
|
while (!found && (radius < 4)) {
|
||||||
Location pos;
|
Location pos;
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -1083,6 +1107,28 @@ public class PlotMain extends JavaPlugin {
|
|||||||
Settings.MAX_PLOTS = config.getInt("max_plots");
|
Settings.MAX_PLOTS = config.getInt("max_plots");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void createConfiguration(PlotWorld plotworld) {
|
||||||
|
String w = plotworld.worldname;
|
||||||
|
Map<String, Object> options = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
for (ConfigurationNode setting:plotworld.getSettingNodes()) {
|
||||||
|
setting.getConstant();
|
||||||
|
setting.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entry<String, Object> node : options.entrySet()) {
|
||||||
|
if (!config.contains(node.getKey())) {
|
||||||
|
config.set(node.getKey(), node.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
config.save(PlotMain.configFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an external world as a recognized PlotSquared world
|
* Adds an external world as a recognized PlotSquared world
|
||||||
* - The PlotWorld class created is based off the configuration in the settings.yml
|
* - The PlotWorld class created is based off the configuration in the settings.yml
|
||||||
@ -1101,43 +1147,28 @@ public class PlotMain extends JavaPlugin {
|
|||||||
else {
|
else {
|
||||||
worlds = new HashSet<String>();
|
worlds = new HashSet<String>();
|
||||||
}
|
}
|
||||||
if (worlds.contains(world.getName())) {
|
ChunkGenerator generator = world.getGenerator();
|
||||||
ChunkGenerator gen = world.getGenerator();
|
if (generator instanceof PlotGenerator) {
|
||||||
if ((gen == null) || !gen.getClass().getSimpleName().equals("PlotSquaredGen")) {
|
sendConsoleSenderMessage(C.PREFIX.s()+"&aDetected world load for '"+world.getName()+"'.");
|
||||||
|
PlotGenerator plotgen = (PlotGenerator) generator;
|
||||||
|
|
||||||
|
PlotWorld plotworld = plotgen.getPlotWorld();
|
||||||
|
|
||||||
|
PlotManager manager = plotgen.getPlotManager();
|
||||||
|
|
||||||
|
config.createSection("worlds."+world.getName());
|
||||||
|
|
||||||
|
plotworld.saveConfiguration(config.getConfigurationSection("worlds."+world.getName()));
|
||||||
|
|
||||||
|
plotworld.loadConfiguration(config.getConfigurationSection("worlds."+world.getName()));
|
||||||
|
|
||||||
|
addPlotWorld(world.getName(), plotworld, manager);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (worlds.contains(world.getName())) {
|
||||||
sendConsoleSenderMessage("&cWorld '" + world.getName() + "' in settings.yml is not using PlotSquared generator!");
|
sendConsoleSenderMessage("&cWorld '" + world.getName() + "' in settings.yml is not using PlotSquared generator!");
|
||||||
|
|
||||||
PlotWorld plotworld = new PlotWorld();
|
|
||||||
|
|
||||||
try {
|
|
||||||
plotworld.AUTO_MERGE = config.getBoolean("worlds." + world + ".plot.auto_merge");
|
|
||||||
plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot.height");
|
|
||||||
plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot.size");
|
|
||||||
plotworld.PLOT_BIOME = config.getString("worlds." + world + ".plot.biome");
|
|
||||||
plotworld.MAIN_BLOCK = config.getStringList("worlds." + world + ".plot.filling").toArray(new String[0]);
|
|
||||||
plotworld.TOP_BLOCK = config.getStringList("worlds." + world + ".plot.floor").toArray(new String[0]);
|
|
||||||
plotworld.WALL_BLOCK = config.getString("worlds." + world + ".wall.block");
|
|
||||||
plotworld.ROAD_WIDTH = config.getInt("worlds." + world + ".road.width");
|
|
||||||
plotworld.ROAD_HEIGHT = config.getInt("worlds." + world + ".road.height");
|
|
||||||
plotworld.ROAD_STRIPES_ENABLED = config.getBoolean("worlds." + world + ".road.enable_stripes");
|
|
||||||
plotworld.ROAD_BLOCK = config.getString("worlds." + world + ".road.block");
|
|
||||||
plotworld.ROAD_STRIPES = config.getString("worlds." + world + ".road.stripes");
|
|
||||||
plotworld.WALL_FILLING = config.getString("worlds." + world + ".wall.filling");
|
|
||||||
plotworld.WALL_HEIGHT = config.getInt("worlds." + world + ".wall.height");
|
|
||||||
plotworld.PLOT_CHAT = config.getBoolean("worlds." + world + ".plot_chat");
|
|
||||||
plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds." + world + ".schematic.on_claim");
|
|
||||||
plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file");
|
|
||||||
plotworld.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("worlds." + world + ".schematic.specify_on_claim");
|
|
||||||
plotworld.SCHEMATICS = config.getStringList("worlds." + world + ".schematic.schematics");
|
|
||||||
plotworld.USE_ECONOMY = config.getBoolean("worlds." + world + ".economy.use");
|
|
||||||
plotworld.PLOT_PRICE = config.getDouble("worlds." + world + ".economy.prices.claim");
|
|
||||||
plotworld.MERGE_PRICE = config.getDouble("worlds." + world + ".economy.prices.merge");
|
|
||||||
plotworld.PLOT_CHAT = config.getBoolean("worlds." + world + ".chat.enabled");
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
sendConsoleSenderMessage("&cThe configuration for '"+world.getName()+"' is not configured incorrectly. Please see the below stacktrace for more information:");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
addPlotWorld(world.getName(), plotworld);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1201,8 +1232,9 @@ public class PlotMain extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPlotWorld(String world, PlotWorld plotworld) {
|
public static void addPlotWorld(String world, PlotWorld plotworld, PlotManager manager) {
|
||||||
PlotMain.worlds.put(world, plotworld);
|
worlds.put(world, plotworld);
|
||||||
|
managers.put(world, manager);
|
||||||
if (!plots.containsKey(world)) {
|
if (!plots.containsKey(world)) {
|
||||||
plots.put(world, new HashMap<PlotId, Plot>());
|
plots.put(world, new HashMap<PlotId, Plot>());
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,14 @@ public abstract class PlotManager {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract PlotId getPlotIdAbs(PlotWorld plotworld, Location loc);
|
public abstract PlotId getPlotIdAbs(PlotWorld plotworld, Location loc);
|
||||||
|
|
||||||
|
public abstract PlotId getPlotId(PlotWorld plotworld, Location loc);
|
||||||
|
|
||||||
public abstract boolean isInPlotAbs(PlotWorld plotworld, Location loc, Plot plot);
|
public abstract boolean isInPlotAbs(PlotWorld plotworld, Location loc, PlotId plotid);
|
||||||
// If you have a circular plot, just return the corner if it were a square
|
// If you have a circular plot, just return the corner if it were a square
|
||||||
public abstract Location getPlotBottomLocAbs(PlotWorld plotworld, Plot plot);
|
public abstract Location getPlotBottomLocAbs(PlotWorld plotworld, PlotId plotid);
|
||||||
// the same applies here
|
// the same applies here
|
||||||
public abstract Location getPlotTopLocAbs(PlotWorld plotworld, Plot plot);
|
public abstract Location getPlotTopLocAbs(PlotWorld plotworld, PlotId plotid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Plot clearing (return false if you do not support some method)
|
* Plot clearing (return false if you do not support some method)
|
||||||
|
@ -1,591 +0,0 @@
|
|||||||
package com.intellectualcrafters.plot;
|
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.AUTO_MERGE_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.DEFAULT_FLAGS_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.MAIN_BLOCK_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.PLOT_BIOME_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.PLOT_CHAT_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.PLOT_HEIGHT_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.PLOT_WIDTH_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_BLOCK_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_HEIGHT_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_ENABLED_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.ROAD_WIDTH_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_FILE_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_ON_CLAIM_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.TOP_BLOCK_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.WALL_BLOCK_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.WALL_FILLING_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.WALL_HEIGHT_DEFAULT;
|
|
||||||
import static com.intellectualcrafters.plot.PlotWorld.MOB_SPAWNING_DEFAULT;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.generator.BlockPopulator;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @auther Empire92
|
|
||||||
* @author Citymonstret
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class PlotSquaredGen extends ChunkGenerator {
|
|
||||||
private long state;
|
|
||||||
|
|
||||||
public final long nextLong() {
|
|
||||||
long a = this.state;
|
|
||||||
this.state = xorShift64(a);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final long xorShift64(long a) {
|
|
||||||
a ^= (a << 21);
|
|
||||||
a ^= (a >>> 35);
|
|
||||||
a ^= (a << 4);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int random(int n) {
|
|
||||||
long r = ((nextLong() >>> 32) * n) >> 32;
|
|
||||||
return (int) r;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlotWorld plotworld;
|
|
||||||
short[][] result;
|
|
||||||
int plotsize;
|
|
||||||
int pathsize;
|
|
||||||
short bottom;
|
|
||||||
short wall;
|
|
||||||
short wallfilling;
|
|
||||||
short floor1;
|
|
||||||
short floor2;
|
|
||||||
int size;
|
|
||||||
Biome biome;
|
|
||||||
int roadheight;
|
|
||||||
int wallheight;
|
|
||||||
int plotheight;
|
|
||||||
|
|
||||||
short[] plotfloors;
|
|
||||||
short[] filling;
|
|
||||||
|
|
||||||
public Short getBlock(String block) {
|
|
||||||
if (block.contains(":")) {
|
|
||||||
String[] split = block.split(":");
|
|
||||||
return Short.parseShort(split[0]);
|
|
||||||
}
|
|
||||||
return Short.parseShort(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlotSquaredGen(String world) {
|
|
||||||
YamlConfiguration config = PlotMain.config;
|
|
||||||
this.plotworld = new PlotWorld();
|
|
||||||
Map<String, Object> options = new HashMap<String, Object>();
|
|
||||||
options.put("worlds." + world + ".natural_mob_spawning", MOB_SPAWNING_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".plot.auto_merge", AUTO_MERGE_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".plot.height", PLOT_HEIGHT_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".plot.size", PLOT_WIDTH_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".plot.biome", PLOT_BIOME_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".plot.filling", Arrays.asList(MAIN_BLOCK_DEFAULT));
|
|
||||||
options.put("worlds." + world + ".plot.floor", Arrays.asList(TOP_BLOCK_DEFAULT));
|
|
||||||
options.put("worlds." + world + ".wall.block", WALL_BLOCK_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".road.width", ROAD_WIDTH_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".road.height", ROAD_HEIGHT_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".road.block", ROAD_BLOCK_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".road.stripes", ROAD_STRIPES_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".road.enable_stripes", ROAD_STRIPES_ENABLED_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".wall.filling", WALL_FILLING_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".wall.height", WALL_HEIGHT_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".schematic.file", SCHEMATIC_FILE_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
|
|
||||||
options.put("worlds." + world + ".schematic.schematics", this.plotworld.SCHEMATICS);
|
|
||||||
options.put("worlds." + world + ".schematic.specify_on_claim", this.plotworld.SCHEMATIC_CLAIM_SPECIFY);
|
|
||||||
options.put("worlds." + world + ".economy.use", this.plotworld.USE_ECONOMY); // Access
|
|
||||||
// should
|
|
||||||
// be
|
|
||||||
// static
|
|
||||||
options.put("worlds." + world + ".economy.prices.claim", this.plotworld.PLOT_PRICE); // Access
|
|
||||||
// should
|
|
||||||
// be
|
|
||||||
// static
|
|
||||||
options.put("worlds." + world + ".economy.prices.merge", this.plotworld.MERGE_PRICE); // Access
|
|
||||||
// should
|
|
||||||
// be
|
|
||||||
// static
|
|
||||||
options.put("worlds." + world + ".chat.enabled", PLOT_CHAT_DEFAULT);
|
|
||||||
for (Entry<String, Object> node : options.entrySet()) {
|
|
||||||
if (!config.contains(node.getKey())) {
|
|
||||||
config.set(node.getKey(), node.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
config.save(PlotMain.configFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
|
|
||||||
}
|
|
||||||
this.plotworld.MOB_SPAWNING = config.getBoolean("worlds." + world + ".natural_mob_spawning");
|
|
||||||
this.plotworld.AUTO_MERGE = config.getBoolean("worlds." + world + ".plot.auto_merge");
|
|
||||||
this.plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot.height");
|
|
||||||
this.plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot.size");
|
|
||||||
this.plotworld.PLOT_BIOME = config.getString("worlds." + world + ".plot.biome");
|
|
||||||
this.plotworld.MAIN_BLOCK = config.getStringList("worlds." + world + ".plot.filling").toArray(new String[0]);
|
|
||||||
this.plotworld.TOP_BLOCK = config.getStringList("worlds." + world + ".plot.floor").toArray(new String[0]);
|
|
||||||
this.plotworld.WALL_BLOCK = config.getString("worlds." + world + ".wall.block");
|
|
||||||
this.plotworld.ROAD_WIDTH = config.getInt("worlds." + world + ".road.width");
|
|
||||||
this.plotworld.ROAD_HEIGHT = config.getInt("worlds." + world + ".road.height");
|
|
||||||
this.plotworld.ROAD_STRIPES_ENABLED = config.getBoolean("worlds." + world + ".road.enable_stripes");
|
|
||||||
this.plotworld.ROAD_BLOCK = config.getString("worlds." + world + ".road.block");
|
|
||||||
this.plotworld.ROAD_STRIPES = config.getString("worlds." + world + ".road.stripes");
|
|
||||||
this.plotworld.WALL_FILLING = config.getString("worlds." + world + ".wall.filling");
|
|
||||||
this.plotworld.WALL_HEIGHT = config.getInt("worlds." + world + ".wall.height");
|
|
||||||
this.plotworld.PLOT_CHAT = config.getBoolean("worlds." + world + ".plot_chat");
|
|
||||||
this.plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds." + world + ".schematic.on_claim");
|
|
||||||
this.plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file");
|
|
||||||
this.plotworld.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("worlds." + world + ".schematic.specify_on_claim");
|
|
||||||
this.plotworld.SCHEMATICS = config.getStringList("worlds." + world + ".schematic.schematics");
|
|
||||||
this.plotworld.USE_ECONOMY = config.getBoolean("worlds." + world + ".economy.use");
|
|
||||||
this.plotworld.PLOT_PRICE = config.getDouble("worlds." + world + ".economy.prices.claim");
|
|
||||||
this.plotworld.MERGE_PRICE = config.getDouble("worlds." + world + ".economy.prices.merge");
|
|
||||||
this.plotworld.PLOT_CHAT = config.getBoolean("worlds." + world + ".chat.enabled");
|
|
||||||
|
|
||||||
String[] default_flags_string = config.getStringList("worlds." + world + ".flags.default").toArray(new String[0]);
|
|
||||||
Flag[] default_flags = new Flag[default_flags_string.length];
|
|
||||||
for (int i = 0; i < default_flags.length; i++) {
|
|
||||||
String current = default_flags_string[i];
|
|
||||||
if (current.contains(",")) {
|
|
||||||
default_flags[i] = new Flag(FlagManager.getFlag(current.split(",")[0], true), current.split(",")[1]);
|
|
||||||
} else {
|
|
||||||
default_flags[i] = new Flag(FlagManager.getFlag(current, true), "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.plotworld.DEFAULT_FLAGS = default_flags;
|
|
||||||
|
|
||||||
PlotMain.addPlotWorld(world, this.plotworld);
|
|
||||||
|
|
||||||
this.plotsize = this.plotworld.PLOT_WIDTH;
|
|
||||||
this.pathsize = this.plotworld.ROAD_WIDTH;
|
|
||||||
this.bottom = (short) Material.BEDROCK.getId();
|
|
||||||
|
|
||||||
this.floor1 = getBlock(this.plotworld.ROAD_BLOCK);
|
|
||||||
this.floor2 = getBlock(this.plotworld.ROAD_STRIPES);
|
|
||||||
this.wallfilling = getBlock(this.plotworld.WALL_FILLING);
|
|
||||||
this.size = this.pathsize + this.plotsize;
|
|
||||||
this.wall = getBlock(this.plotworld.WALL_BLOCK);
|
|
||||||
|
|
||||||
this.plotfloors = new short[this.plotworld.TOP_BLOCK.length];
|
|
||||||
this.filling = new short[this.plotworld.MAIN_BLOCK.length];
|
|
||||||
|
|
||||||
for (int i = 0; i < this.plotworld.TOP_BLOCK.length; i++) {
|
|
||||||
this.plotfloors[i] = getBlock(this.plotworld.TOP_BLOCK[i]);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < this.plotworld.MAIN_BLOCK.length; i++) {
|
|
||||||
this.filling[i] = getBlock(this.plotworld.MAIN_BLOCK[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.wallheight = this.plotworld.WALL_HEIGHT;
|
|
||||||
this.roadheight = this.plotworld.ROAD_HEIGHT;
|
|
||||||
this.plotheight = this.plotworld.PLOT_HEIGHT;
|
|
||||||
|
|
||||||
this.biome = Biome.FOREST;
|
|
||||||
for (Biome myBiome : Biome.values()) {
|
|
||||||
if (myBiome.name().equalsIgnoreCase(this.plotworld.PLOT_BIOME)) {
|
|
||||||
this.biome = myBiome;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BlockPopulator> getDefaultPopulators(World world) {
|
|
||||||
if (!this.plotworld.MOB_SPAWNING) {
|
|
||||||
world.setSpawnFlags(false, false);
|
|
||||||
world.setAmbientSpawnLimit(0);
|
|
||||||
world.setAnimalSpawnLimit(0);
|
|
||||||
world.setMonsterSpawnLimit(0);
|
|
||||||
world.setWaterAnimalSpawnLimit(0);
|
|
||||||
}
|
|
||||||
return Arrays.asList((BlockPopulator) new XPopulator(PlotMain.getWorldSettings(world)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getFixedSpawnLocation(World world, Random random) {
|
|
||||||
return new Location(world, 0, PlotMain.getWorldSettings(world).ROAD_HEIGHT + 2, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, short id) {
|
|
||||||
for (int x = x1; x < x2; x++) {
|
|
||||||
for (int z = z1; z < z2; z++) {
|
|
||||||
for (int y = y1; y < y2; y++) {
|
|
||||||
setBlock(this.result, x, y, z, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCuboidRegion(int x1, int x2, int y1, int y2, int z1, int z2, short[] id) {
|
|
||||||
if (id.length == 1) {
|
|
||||||
setCuboidRegion(x1, x2, y1, y2, z1, z2, id[0]);
|
|
||||||
} else {
|
|
||||||
for (int x = x1; x < x2; x++) {
|
|
||||||
for (int z = z1; z < z2; z++) {
|
|
||||||
for (int y = y1; y < y2; y++) {
|
|
||||||
int i = random(id.length);
|
|
||||||
setBlock(this.result, x, y, z, id[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public short[][] generateExtBlockSections(World world, Random random, int cx, int cz, BiomeGrid biomes) {
|
|
||||||
int maxY = world.getMaxHeight();
|
|
||||||
|
|
||||||
this.result = new short[maxY / 16][];
|
|
||||||
double pathWidthLower;
|
|
||||||
if ((this.pathsize % 2) == 0) {
|
|
||||||
pathWidthLower = Math.floor(this.pathsize / 2) - 1;
|
|
||||||
} else {
|
|
||||||
pathWidthLower = Math.floor(this.pathsize / 2);
|
|
||||||
}
|
|
||||||
final int prime = 31;
|
|
||||||
int h = 1;
|
|
||||||
h = (prime * h) + cx;
|
|
||||||
h = (prime * h) + cz;
|
|
||||||
this.state = h;
|
|
||||||
cx = (cx % this.size) + (8 * this.size);
|
|
||||||
cz = (cz % this.size) + (8 * this.size);
|
|
||||||
int absX = (int) ((((cx * 16) + 16) - pathWidthLower - 1) + (8 * this.size));
|
|
||||||
int absZ = (int) ((((cz * 16) + 16) - pathWidthLower - 1) + (8 * this.size));
|
|
||||||
int plotMinX = (((absX) % this.size));
|
|
||||||
int plotMinZ = (((absZ) % this.size));
|
|
||||||
int roadStartX = (plotMinX + this.pathsize);
|
|
||||||
int roadStartZ = (plotMinZ + this.pathsize);
|
|
||||||
if (roadStartX >= this.size) {
|
|
||||||
roadStartX -= this.size;
|
|
||||||
}
|
|
||||||
if (roadStartZ >= this.size) {
|
|
||||||
roadStartZ -= this.size;
|
|
||||||
}
|
|
||||||
|
|
||||||
// BOTTOM (1/1 cuboids)
|
|
||||||
for (int x = 0; x < 16; x++) {
|
|
||||||
for (int z = 0; z < 16; z++) {
|
|
||||||
setBlock(this.result, x, 0, z, this.bottom);
|
|
||||||
biomes.setBiome(x, z, this.biome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ROAD (0/24) The following is an inefficient placeholder as it is too
|
|
||||||
// much work to finish it
|
|
||||||
|
|
||||||
if (pathsize>16 && ((plotMinX > roadStartX) || (plotMinZ > roadStartZ)) && !(roadStartX<16 && roadStartZ<16) && ((roadStartX>16 && roadStartZ>16) || (plotMinX > roadStartX) && (plotMinZ > roadStartZ))) {
|
|
||||||
setCuboidRegion(0, 16, 1, this.roadheight + 1, 0, 16, this.floor1);
|
|
||||||
return this.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((plotMinZ + 1) <= 16) || ((roadStartZ <= 16) && (roadStartZ > 0))) {
|
|
||||||
int start = Math.max((16 - plotMinZ - this.pathsize) + 1, (16 - roadStartZ) + 1);
|
|
||||||
int end = Math.min(16 - plotMinZ - 1, (16 - roadStartZ) + this.pathsize);
|
|
||||||
if ((start >= 0) && (start <= 16) && (end < 0)) {
|
|
||||||
end = 16;
|
|
||||||
}
|
|
||||||
setCuboidRegion(0, 16, 1, this.roadheight + 1, Math.max(start, 0), Math.min(16, end), this.floor1);
|
|
||||||
}
|
|
||||||
if (((plotMinX + 1) <= 16) || ((roadStartX <= 16) && (roadStartX > 0))) {
|
|
||||||
int start = Math.max((16 - plotMinX - this.pathsize) + 1, (16 - roadStartX) + 1);
|
|
||||||
int end = Math.min(16 - plotMinX - 1, (16 - roadStartX) + this.pathsize);
|
|
||||||
if ((start >= 0) && (start <= 16) && (end < 0)) {
|
|
||||||
end = 16;
|
|
||||||
}
|
|
||||||
setCuboidRegion(Math.max(start, 0), Math.min(16, end), 1, this.roadheight + 1, 0, 16, this.floor1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ROAD STRIPES
|
|
||||||
if ((this.pathsize > 4) && this.plotworld.ROAD_STRIPES_ENABLED) {
|
|
||||||
if ((plotMinZ + 2) <= 16) {
|
|
||||||
int value = (plotMinZ + 2);
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinX + 2) <= 16) {
|
|
||||||
start = 16 - plotMinX - 1;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartX - 1) <= 16) {
|
|
||||||
end = (16 - roadStartX) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion(0, end, this.wallheight, this.wallheight + 1, 16 - value, (16 - value) + 1, this.floor2); //
|
|
||||||
setCuboidRegion(start, 16, this.wallheight, this.wallheight + 1, 16 - value, (16 - value) + 1, this.floor2); //
|
|
||||||
}
|
|
||||||
if ((plotMinX + 2) <= 16) {
|
|
||||||
int value = (plotMinX + 2);
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinZ + 2) <= 16) {
|
|
||||||
start = 16 - plotMinZ - 1;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartZ - 1) <= 16) {
|
|
||||||
end = (16 - roadStartZ) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion(16 - value, (16 - value) + 1, this.wallheight, this.wallheight + 1, 0, end, this.floor2); //
|
|
||||||
setCuboidRegion(16 - value, (16 - value) + 1, this.wallheight, this.wallheight + 1, start, 16, this.floor2); //
|
|
||||||
}
|
|
||||||
if ((roadStartZ <= 16) && (roadStartZ > 1)) {
|
|
||||||
int val = roadStartZ;
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinX + 2) <= 16) {
|
|
||||||
start = 16 - plotMinX - 1;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartX - 1) <= 16) {
|
|
||||||
end = (16 - roadStartX) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion(0, end, this.wallheight, this.wallheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2);
|
|
||||||
setCuboidRegion(start, 16, this.wallheight, this.wallheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2);
|
|
||||||
}
|
|
||||||
if ((roadStartX <= 16) && (roadStartX > 1)) {
|
|
||||||
int val = roadStartX;
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinZ + 2) <= 16) {
|
|
||||||
start = 16 - plotMinZ - 1;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartZ - 1) <= 16) {
|
|
||||||
end = (16 - roadStartZ) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.wallheight, this.wallheight + 1, 0, end, this.floor2); //
|
|
||||||
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.wallheight, this.wallheight + 1, start, 16, this.floor2); //
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Plot filling (28/28 cuboids) (10x2 + 4x2)
|
|
||||||
if (this.plotsize > 16) {
|
|
||||||
if (roadStartX <= 16) {
|
|
||||||
if (roadStartZ <= 16) {
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors);
|
|
||||||
}
|
|
||||||
if (plotMinZ <= 16) {
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (roadStartZ <= 16) {
|
|
||||||
if (plotMinX > 16) {
|
|
||||||
setCuboidRegion(0, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
|
|
||||||
setCuboidRegion(0, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (plotMinX <= 16) {
|
|
||||||
if (plotMinZ <= 16) {
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
|
|
||||||
} else {
|
|
||||||
int z = 16 - roadStartZ;
|
|
||||||
if (z < 0) {
|
|
||||||
z = 16;
|
|
||||||
}
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, z, this.filling);
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors);
|
|
||||||
}
|
|
||||||
if (roadStartZ <= 16) {
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors);
|
|
||||||
} else {
|
|
||||||
if (roadStartX <= 16) {
|
|
||||||
if (plotMinZ > 16) {
|
|
||||||
int x = 16 - roadStartX;
|
|
||||||
if (x < 0) {
|
|
||||||
x = 16;
|
|
||||||
}
|
|
||||||
setCuboidRegion(0, x, 1, this.plotheight, 0, 16, this.filling);
|
|
||||||
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, 16, this.plotfloors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (plotMinZ <= 16) {
|
|
||||||
if (roadStartX > 16) {
|
|
||||||
int x = 16 - roadStartX;
|
|
||||||
if (x < 0) {
|
|
||||||
x = 16;
|
|
||||||
}
|
|
||||||
setCuboidRegion(0, x, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
|
|
||||||
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (roadStartZ > 16) {
|
|
||||||
int x = 16 - roadStartX;
|
|
||||||
if (x < 0) {
|
|
||||||
x = 16;
|
|
||||||
}
|
|
||||||
int z = 16 - roadStartZ;
|
|
||||||
if (z < 0) {
|
|
||||||
z = 16;
|
|
||||||
}
|
|
||||||
if (roadStartX > 16) {
|
|
||||||
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling);
|
|
||||||
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors);
|
|
||||||
} else {
|
|
||||||
setCuboidRegion(0, x, 1, this.plotheight, 0, z, this.filling);
|
|
||||||
setCuboidRegion(0, x, this.plotheight, this.plotheight + 1, 0, z, this.plotfloors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (roadStartX <= 16) {
|
|
||||||
if (roadStartZ <= 16) {
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors);
|
|
||||||
}
|
|
||||||
if (plotMinZ <= 16) {
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
|
|
||||||
setCuboidRegion(0, 16 - roadStartX, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (plotMinX <= 16) {
|
|
||||||
if (plotMinZ <= 16) {
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 16 - plotMinZ, 16, this.filling);
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 16 - plotMinZ, 16, this.plotfloors);
|
|
||||||
}
|
|
||||||
if (roadStartZ <= 16) {
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, 1, this.plotheight, 0, 16 - roadStartZ, this.filling);
|
|
||||||
setCuboidRegion(16 - plotMinX, 16, this.plotheight, this.plotheight + 1, 0, 16 - roadStartZ, this.plotfloors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// WALLS (16/16 cuboids)
|
|
||||||
if (this.pathsize > 0) {
|
|
||||||
if ((plotMinZ + 1) <= 16) {
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinX + 2) <= 16) {
|
|
||||||
start = 16 - plotMinX - 1;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartX - 1) <= 16) {
|
|
||||||
end = (16 - roadStartX) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion(0, end, 1, this.wallheight + 1, 16 - plotMinZ - 1, 16 - plotMinZ, this.wallfilling);
|
|
||||||
setCuboidRegion(0, end, this.wallheight + 1, this.wallheight + 2, 16 - plotMinZ - 1, 16 - plotMinZ, this.wall);
|
|
||||||
setCuboidRegion(start, 16, 1, this.wallheight + 1, 16 - plotMinZ - 1, 16 - plotMinZ, this.wallfilling);
|
|
||||||
setCuboidRegion(start, 16, this.wallheight + 1, this.wallheight + 2, 16 - plotMinZ - 1, 16 - plotMinZ, this.wall);
|
|
||||||
}
|
|
||||||
if ((plotMinX + 1) <= 16) {
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinZ + 2) <= 16) {
|
|
||||||
start = 16 - plotMinZ - 1;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartZ - 1) <= 16) {
|
|
||||||
end = (16 - roadStartZ) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, 1, this.wallheight + 1, 0, end, this.wallfilling);
|
|
||||||
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, this.wallheight + 1, this.wallheight + 2, 0, end, this.wall);
|
|
||||||
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, 1, this.wallheight + 1, start, 16, this.wallfilling);
|
|
||||||
setCuboidRegion(16 - plotMinX - 1, 16 - plotMinX, this.wallheight + 1, this.wallheight + 2, start, 16, this.wall);
|
|
||||||
}
|
|
||||||
if ((roadStartZ <= 16) && (roadStartZ > 0)) {
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinX + 1) <= 16) {
|
|
||||||
start = 16 - plotMinX;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartX + 1) <= 16) {
|
|
||||||
end = (16 - roadStartX) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinX + 1) <= 16) || (roadStartX <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion(0, end, 1, this.wallheight + 1, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wallfilling);
|
|
||||||
setCuboidRegion(0, end, this.wallheight + 1, this.wallheight + 2, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wall);
|
|
||||||
setCuboidRegion(start, 16, 1, this.wallheight + 1, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wallfilling);
|
|
||||||
setCuboidRegion(start, 16, this.wallheight + 1, this.wallheight + 2, 16 - roadStartZ, (16 - roadStartZ) + 1, this.wall);
|
|
||||||
}
|
|
||||||
if ((roadStartX <= 16) && (roadStartX > 0)) {
|
|
||||||
int start, end;
|
|
||||||
if ((plotMinZ + 1) <= 16) {
|
|
||||||
start = 16 - plotMinZ;
|
|
||||||
} else {
|
|
||||||
start = 16;
|
|
||||||
}
|
|
||||||
if ((roadStartZ + 1) <= 16) {
|
|
||||||
end = (16 - roadStartZ) + 1;
|
|
||||||
} else {
|
|
||||||
end = 0;
|
|
||||||
}
|
|
||||||
if (!(((plotMinZ + 1) <= 16) || ((roadStartZ + 1) <= 16))) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, 1, this.wallheight + 1, 0, end, this.wallfilling);
|
|
||||||
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.roadheight + 2, 0, end, this.wall);
|
|
||||||
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, 1, this.wallheight + 1, start, 16, this.wallfilling);
|
|
||||||
setCuboidRegion(16 - roadStartX, (16 - roadStartX) + 1, this.wallheight + 1, this.wallheight + 2, start, 16, this.wall);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setBlock(short[][] result, int x, int y, int z, short blkid) {
|
|
||||||
if (result[y >> 4] == null) {
|
|
||||||
result[y >> 4] = new short[4096];
|
|
||||||
}
|
|
||||||
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,228 +1,113 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
/**
|
import com.sk89q.worldedit.util.YAMLConfiguration;
|
||||||
* This is the PlotWorld class (obviously) <br>
|
|
||||||
* - All existing PlotWorld instances should be kept in PlotMain (worlds
|
|
||||||
* variable) <br>
|
|
||||||
* - The accessors and mutators are: <br>
|
|
||||||
* PlotMain.isPlotWorld(world) <br>
|
|
||||||
* PlotMain.getPlotWorlds() or PlotMain.getPlotWorldsString() <- use this if you
|
|
||||||
* don't need to get world objects <br>
|
|
||||||
* PlotMain.getWorldSettings(World) - get the PlotWorld class for a world <br>
|
|
||||||
* <br>
|
|
||||||
* Also added is getWorldPlots(World) as the plots are now sorted per world <br>
|
|
||||||
* <br>
|
|
||||||
* To get the world of a plot, you can use plot.world - (string) or
|
|
||||||
* plot.getWorld() (world object) <br>
|
|
||||||
* <br>
|
|
||||||
* All PlotWorld settings are per world in the settings.yml (these settings are
|
|
||||||
* automatically added when a world is loaded, either at startup or if a new
|
|
||||||
* world is created): <br>
|
|
||||||
* - You can find this in the WorldGenerator class (yeah, it's possibly not the
|
|
||||||
* best place, but it makes sure worlds are added to the settings.yml) <br>
|
|
||||||
* <br>
|
|
||||||
* All new DEFAULT CONSTANTS should be static and be given a value <br>
|
|
||||||
* All new variables should not be static and should not be given any values
|
|
||||||
* here, but rather in the WorldGenerator class
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
public class PlotWorld {
|
|
||||||
|
|
||||||
|
public abstract class PlotWorld {
|
||||||
|
|
||||||
public boolean AUTO_MERGE;
|
public boolean AUTO_MERGE;
|
||||||
public static boolean AUTO_MERGE_DEFAULT = false;
|
public static boolean AUTO_MERGE_DEFAULT = false;
|
||||||
|
|
||||||
public boolean MOB_SPAWNING;
|
public boolean MOB_SPAWNING;
|
||||||
public static boolean MOB_SPAWNING_DEFAULT = false;
|
public static boolean MOB_SPAWNING_DEFAULT = false;
|
||||||
/**
|
|
||||||
* Road Height
|
public Biome PLOT_BIOME;
|
||||||
*/
|
public static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
||||||
public int ROAD_HEIGHT;
|
|
||||||
/**
|
|
||||||
* Default Road Height: 64
|
|
||||||
*/
|
|
||||||
public static int ROAD_HEIGHT_DEFAULT = 64;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* plot height
|
|
||||||
*/
|
|
||||||
public int PLOT_HEIGHT;
|
|
||||||
/**
|
|
||||||
* Default plot height: 64
|
|
||||||
*/
|
|
||||||
public static int PLOT_HEIGHT_DEFAULT = 64;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wall height
|
|
||||||
*/
|
|
||||||
public int WALL_HEIGHT;
|
|
||||||
/**
|
|
||||||
* Default Wall Height: 64
|
|
||||||
*/
|
|
||||||
public static int WALL_HEIGHT_DEFAULT = 64;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* plot width
|
|
||||||
*/
|
|
||||||
public int PLOT_WIDTH;
|
|
||||||
/**
|
|
||||||
* Default plot width: 32
|
|
||||||
*/
|
|
||||||
public static int PLOT_WIDTH_DEFAULT = 32;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Road width
|
|
||||||
*/
|
|
||||||
public int ROAD_WIDTH;
|
|
||||||
/**
|
|
||||||
* Default road width: 7
|
|
||||||
*/
|
|
||||||
public static int ROAD_WIDTH_DEFAULT = 7;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plot biome
|
|
||||||
*/
|
|
||||||
public String PLOT_BIOME;
|
|
||||||
/**
|
|
||||||
* Default biome = FOREST
|
|
||||||
*/
|
|
||||||
public static String PLOT_BIOME_DEFAULT = "FOREST";
|
|
||||||
/**
|
|
||||||
* PlotMain block
|
|
||||||
*/
|
|
||||||
public String[] MAIN_BLOCK;
|
|
||||||
/**
|
|
||||||
* Default main block: 1
|
|
||||||
*/
|
|
||||||
public static String[] MAIN_BLOCK_DEFAULT = new String[] { "1:0" };
|
|
||||||
/**
|
|
||||||
* Top blocks
|
|
||||||
*/
|
|
||||||
public String[] TOP_BLOCK;
|
|
||||||
/**
|
|
||||||
* Default top blocks: {"2"}
|
|
||||||
*/
|
|
||||||
public static String[] TOP_BLOCK_DEFAULT = new String[] { "2:0" };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wall block
|
|
||||||
*/
|
|
||||||
public String WALL_BLOCK;
|
|
||||||
/**
|
|
||||||
* Default wall block: 44
|
|
||||||
*/
|
|
||||||
public static String WALL_BLOCK_DEFAULT = "44:0";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wall filling
|
|
||||||
*/
|
|
||||||
public String WALL_FILLING;
|
|
||||||
/**
|
|
||||||
* Default wall filling: 1
|
|
||||||
*/
|
|
||||||
public static String WALL_FILLING_DEFAULT = "1:0";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Road stripes
|
|
||||||
*/
|
|
||||||
public String ROAD_STRIPES;
|
|
||||||
public boolean ROAD_STRIPES_ENABLED;
|
|
||||||
public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
|
|
||||||
/**
|
|
||||||
* Default road stripes: 35
|
|
||||||
*/
|
|
||||||
public static String ROAD_STRIPES_DEFAULT = "98:0";
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Road stripes data value (byte)
|
|
||||||
// */
|
|
||||||
// public int ROAD_STRIPES_DATA;
|
|
||||||
// /**
|
|
||||||
// * Default road stripes data value: (byte) 0
|
|
||||||
// */
|
|
||||||
// public static int ROAD_STRIPES_DATA_DEFAULT = 0;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Wall block data value (byte)
|
|
||||||
// */
|
|
||||||
// public int WALL_BLOCK_DATA;
|
|
||||||
// /**
|
|
||||||
// * Default wall block data value: (byte) 0
|
|
||||||
// */
|
|
||||||
// public static int WALL_BLOCK_DATA_DEFAULT = 0;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Wall filling data value (byte)
|
|
||||||
// */
|
|
||||||
// public int WALL_FILLING_DATA;
|
|
||||||
// /**
|
|
||||||
// * Default wall filling data value: (byte) 0
|
|
||||||
// */
|
|
||||||
// public static int WALL_FILLING_DATA_DEFAULT = 0;
|
|
||||||
/**
|
|
||||||
* Road block
|
|
||||||
*/
|
|
||||||
public String ROAD_BLOCK;
|
|
||||||
/**
|
|
||||||
* Default road block: 155
|
|
||||||
*/
|
|
||||||
public static String ROAD_BLOCK_DEFAULT = "155:0";
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Road block data value (byte)
|
|
||||||
// */
|
|
||||||
// public int ROAD_BLOCK_DATA;
|
|
||||||
// /**
|
|
||||||
// * Default road block data value: (byte) 0
|
|
||||||
// */
|
|
||||||
// public static int ROAD_BLOCK_DATA_DEFAULT = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* plot chat?
|
|
||||||
*/
|
|
||||||
public boolean PLOT_CHAT;
|
public boolean PLOT_CHAT;
|
||||||
/**
|
|
||||||
* Default plot chat: true
|
|
||||||
*/
|
|
||||||
public static boolean PLOT_CHAT_DEFAULT = false;
|
public static boolean PLOT_CHAT_DEFAULT = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Blocks available in /p set
|
|
||||||
*/
|
|
||||||
public static ArrayList<Material> BLOCKS = new ArrayList<Material>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* schematic on claim
|
|
||||||
*/
|
|
||||||
public boolean SCHEMATIC_ON_CLAIM;
|
|
||||||
/**
|
|
||||||
* Default schematic on claim: false
|
|
||||||
*/
|
|
||||||
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
|
||||||
public boolean SCHEMATIC_CLAIM_SPECIFY = false;
|
public boolean SCHEMATIC_CLAIM_SPECIFY = false;
|
||||||
public List<String> SCHEMATICS = new ArrayList<>();
|
public static boolean SCHEMATIC_CLAIM_SPECIFY_DEFAULT = false;
|
||||||
|
|
||||||
/**
|
public boolean SCHEMATIC_ON_CLAIM;
|
||||||
* schematic file
|
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
||||||
*/
|
|
||||||
public String SCHEMATIC_FILE;
|
public String SCHEMATIC_FILE;
|
||||||
/**
|
|
||||||
* Default schematic file: 'null'
|
|
||||||
*/
|
|
||||||
public static String SCHEMATIC_FILE_DEFAULT = "null";
|
public static String SCHEMATIC_FILE_DEFAULT = "null";
|
||||||
/**
|
|
||||||
* default flags
|
public List<String> SCHEMATICS;
|
||||||
*/
|
public static List<String> SCHEMATICS_DEFAULT = null;
|
||||||
public Flag[] DEFAULT_FLAGS;
|
|
||||||
/**
|
public List<String> DEFAULT_FLAGS;
|
||||||
* Default default flags
|
public static List<String> DEFAULT_FLAGS_DEFAULT = new ArrayList<String>();
|
||||||
*/
|
|
||||||
public static String[] DEFAULT_FLAGS_DEFAULT = new String[] {};
|
public boolean USE_ECONOMY;
|
||||||
|
public static boolean USE_ECONOMY_DEFAULT = false;
|
||||||
|
|
||||||
|
public double PLOT_PRICE;
|
||||||
|
public static double PLOT_PRICE_DEFAULT = 100;
|
||||||
|
|
||||||
|
public double MERGE_PRICE;
|
||||||
|
public static double MERGE_PRICE_DEFAULT = 100;
|
||||||
|
|
||||||
public boolean USE_ECONOMY = false;
|
public PlotWorld(String worldname) {
|
||||||
public double PLOT_PRICE = 100;
|
this.worldname = worldname;
|
||||||
public double MERGE_PRICE = 100;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When a world is created, the following method will be called for each node set in the configuration
|
||||||
|
* - You may ignore this if you generator does not support configuration, or if you want to implement your own methods
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
public void loadConfiguration(ConfigurationSection config) {
|
||||||
|
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
|
||||||
|
this.AUTO_MERGE = config.getBoolean("plot.auto_merge");
|
||||||
|
this.PLOT_BIOME = (Biome) Configuration.BIOME.parseString(config.getString("plot.biome"));
|
||||||
|
this.SCHEMATIC_ON_CLAIM = config.getBoolean("schematic.on_claim");
|
||||||
|
this.SCHEMATIC_FILE = config.getString("schematic.file");
|
||||||
|
this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim");
|
||||||
|
this.SCHEMATICS = config.getStringList("schematic.schematics");
|
||||||
|
this.USE_ECONOMY = config.getBoolean("economy.use");
|
||||||
|
this.PLOT_PRICE = config.getDouble("economy.prices.claim");
|
||||||
|
this.MERGE_PRICE = config.getDouble("economy.prices.merge");
|
||||||
|
this.PLOT_CHAT = config.getBoolean("chat.enabled");
|
||||||
|
this.DEFAULT_FLAGS = config.getStringList("flags.default");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveConfiguration(ConfigurationSection config) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Saving core plotworld settings
|
||||||
|
*/
|
||||||
|
config.set("natural_mob_spawning",this.MOB_SPAWNING);
|
||||||
|
config.set("plot.auto_merge",this.AUTO_MERGE);
|
||||||
|
config.set("plot.biome",this.PLOT_BIOME.name());
|
||||||
|
config.set("schematic.on_claim",this.SCHEMATIC_ON_CLAIM);
|
||||||
|
config.set("schematic.file",this.SCHEMATIC_FILE);
|
||||||
|
config.set("schematic.specify_on_claim",this.SCHEMATIC_CLAIM_SPECIFY);
|
||||||
|
config.set("schematic.schematics",this.SCHEMATICS);
|
||||||
|
config.set("economy.use",this.USE_ECONOMY);
|
||||||
|
config.set("economy.prices.claim",this.PLOT_PRICE);
|
||||||
|
config.set("economy.prices.merge",this.MERGE_PRICE);
|
||||||
|
config.set("chat.enabled",this.PLOT_CHAT);
|
||||||
|
config.set("flags.default",this.DEFAULT_FLAGS);
|
||||||
|
|
||||||
|
ConfigurationNode[] settings = getSettingNodes();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Saving generator specific settings
|
||||||
|
*/
|
||||||
|
for (ConfigurationNode setting:settings) {
|
||||||
|
config.set(setting.getConstant(), setting.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String worldname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for the <b>/plot setup</b> command
|
||||||
|
* Return null if you do not want to support this feature
|
||||||
|
*
|
||||||
|
* @return ConfigurationNode[]
|
||||||
|
*/
|
||||||
|
public abstract ConfigurationNode[] getSettingNodes();
|
||||||
}
|
}
|
||||||
|
@ -1,210 +0,0 @@
|
|||||||
package com.intellectualcrafters.plot;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
public abstract class PlotWorld2 {
|
|
||||||
|
|
||||||
public abstract SettingNode[] getSettingNodes();
|
|
||||||
|
|
||||||
public static final SettingValue STRING = new SettingValue("STRING") {
|
|
||||||
@Override
|
|
||||||
public boolean validateValue(String string) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object parseValue(String string) {
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final SettingValue INTEGER = new SettingValue("INTEGER") {
|
|
||||||
@Override
|
|
||||||
public boolean validateValue(String string) {
|
|
||||||
try {
|
|
||||||
Integer.parseInt(string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object parseValue(String string) {
|
|
||||||
return Integer.parseInt(string);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final SettingValue BOOLEAN = new SettingValue("BOOLEAN") {
|
|
||||||
@Override
|
|
||||||
public boolean validateValue(String string) {
|
|
||||||
try {
|
|
||||||
Boolean.parseBoolean(string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object parseValue(String string) {
|
|
||||||
return Boolean.parseBoolean(string);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final SettingValue DOUBLE = new SettingValue("DOUBLE") {
|
|
||||||
@Override
|
|
||||||
public boolean validateValue(String string) {
|
|
||||||
try {
|
|
||||||
Double.parseDouble(string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object parseValue(String string) {
|
|
||||||
return Double.parseDouble(string);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final SettingValue BIOME = new SettingValue("BIOME") {
|
|
||||||
@Override
|
|
||||||
public boolean validateValue(String string) {
|
|
||||||
try {
|
|
||||||
Biome.valueOf(string.toUpperCase());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object parseValue(String string) {
|
|
||||||
return Biome.valueOf(string.toUpperCase());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final SettingValue BLOCK = new SettingValue("BLOCK") {
|
|
||||||
@Override
|
|
||||||
public boolean validateValue(String string) {
|
|
||||||
try {
|
|
||||||
if (string.contains(":")) {
|
|
||||||
String[] split = string.split(":");
|
|
||||||
Short.parseShort(split[0]);
|
|
||||||
Short.parseShort(split[1]);
|
|
||||||
} else {
|
|
||||||
Short.parseShort(string);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object parseValue(String string) {
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static final SettingValue BLOCKLIST = new SettingValue("BLOCKLIST") {
|
|
||||||
@Override
|
|
||||||
public boolean validateValue(String string) {
|
|
||||||
try {
|
|
||||||
for (String block : string.split(",")) {
|
|
||||||
if (block.contains(":")) {
|
|
||||||
String[] split = block.split(":");
|
|
||||||
Short.parseShort(split[0]);
|
|
||||||
Short.parseShort(split[1]);
|
|
||||||
} else {
|
|
||||||
Short.parseShort(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object parseValue(String string) {
|
|
||||||
return string.split(",");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static abstract class SettingValue {
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
public SettingValue(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Object parseValue(String string);
|
|
||||||
|
|
||||||
public abstract boolean validateValue(String string);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SettingNode {
|
|
||||||
private String constant;
|
|
||||||
private Object default_value;
|
|
||||||
private String description;
|
|
||||||
private Object value = 0;
|
|
||||||
private SettingValue type;
|
|
||||||
|
|
||||||
public SettingNode(String constant, Object default_value, String description, SettingValue type) {
|
|
||||||
this.constant = constant;
|
|
||||||
this.default_value = default_value;
|
|
||||||
this.description = description;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return this.type.getType();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setValue(String string) {
|
|
||||||
if (!type.validateValue(string)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.value = type.parseValue(string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue() {
|
|
||||||
if (this.value instanceof String[]) {
|
|
||||||
return Arrays.asList((String[]) this.value);
|
|
||||||
}
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConstant() {
|
|
||||||
return this.constant;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getDefaultValue() {
|
|
||||||
if (this.default_value instanceof String[]) {
|
|
||||||
return StringUtils.join((String[]) this.default_value, ",");
|
|
||||||
}
|
|
||||||
return this.default_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -82,22 +82,107 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
if (northSouth || eastWest) {
|
if (northSouth || eastWest) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returning the plot id (based on the number of shifts required)
|
// returning the plot id (based on the number of shifts required)
|
||||||
return new PlotId(dx + 1, dz + 1);
|
return new PlotId(dx + 1, dz + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some complex stuff for traversing mega plots (return getPlotIdAbs if you do not support mega plots)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PlotId getPlotId(PlotWorld plotworld, Location loc) {
|
||||||
|
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
||||||
|
|
||||||
|
int x = loc.getBlockX();
|
||||||
|
int z = loc.getBlockZ();
|
||||||
|
|
||||||
|
String world = loc.getWorld().getName();
|
||||||
|
if (plotworld == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
int size = dpw.PLOT_WIDTH + dpw.ROAD_WIDTH;
|
||||||
|
int pathWidthLower;
|
||||||
|
if ((dpw.ROAD_WIDTH % 2) == 0) {
|
||||||
|
pathWidthLower = (int) (Math.floor(dpw.ROAD_WIDTH / 2) - 1);
|
||||||
|
} else {
|
||||||
|
pathWidthLower = (int) Math.floor(dpw.ROAD_WIDTH / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int dx = x / size;
|
||||||
|
int dz = z / size;
|
||||||
|
|
||||||
|
if (x < 0) {
|
||||||
|
dx--;
|
||||||
|
x += ((-dx) * size);
|
||||||
|
}
|
||||||
|
if (z < 0) {
|
||||||
|
dz--;
|
||||||
|
z += ((-dz) * size);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rx = (x) % size;
|
||||||
|
int rz = (z) % size;
|
||||||
|
|
||||||
|
int end = pathWidthLower + dpw.PLOT_WIDTH;
|
||||||
|
|
||||||
|
boolean northSouth = (rz <= pathWidthLower) || (rz > end);
|
||||||
|
boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
||||||
|
if (northSouth && eastWest) {
|
||||||
|
// This means you are in the intersection
|
||||||
|
PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, dpw.ROAD_WIDTH));
|
||||||
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
|
if (plot == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((plot.settings.getMerged(0) && plot.settings.getMerged(3))) {
|
||||||
|
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (northSouth) {
|
||||||
|
// You are on a road running West to East (yeah, I named the var
|
||||||
|
// poorly)
|
||||||
|
PlotId id = PlayerFunctions.getPlotAbs(loc.add(0, 0, dpw.ROAD_WIDTH));
|
||||||
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
|
if (plot == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (plot.settings.getMerged(0)) {
|
||||||
|
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (eastWest) {
|
||||||
|
// This is the road separating an Eastern and Western plot
|
||||||
|
PlotId id = PlayerFunctions.getPlotAbs(loc.add(dpw.ROAD_WIDTH, 0, 0));
|
||||||
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
|
if (plot == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (plot.settings.getMerged(3)) {
|
||||||
|
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
PlotId id = new PlotId(dx + 1, dz + 1);
|
||||||
|
Plot plot = PlotMain.getPlots(loc.getWorld()).get(id);
|
||||||
|
if (plot == null) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if a location is inside a specific plot(non-Javadoc)
|
* Check if a location is inside a specific plot(non-Javadoc)
|
||||||
* - For this implementation, we don't need to do anything fancier than referring to getPlotIdAbs(...)
|
* - For this implementation, we don't need to do anything fancier than referring to getPlotIdAbs(...)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isInPlotAbs(PlotWorld plotworld, Location loc, Plot plot) {
|
public boolean isInPlotAbs(PlotWorld plotworld, Location loc, PlotId plotid) {
|
||||||
PlotId result = getPlotIdAbs(plotworld, loc);
|
PlotId result = getPlotIdAbs(plotworld, loc);
|
||||||
if (result==null) {
|
if (result==null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return result==plot.id;
|
return result==plotid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -105,16 +190,16 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
* (some basic math)
|
* (some basic math)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Location getPlotBottomLocAbs(PlotWorld plotworld, Plot plot) {
|
public Location getPlotBottomLocAbs(PlotWorld plotworld, PlotId plotid) {
|
||||||
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
||||||
|
|
||||||
int px = plot.id.x;
|
int px = plotid.x;
|
||||||
int pz = plot.id.y;
|
int pz = plotid.y;
|
||||||
|
|
||||||
int x = (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - dpw.PLOT_WIDTH - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
int x = (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - dpw.PLOT_WIDTH - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
||||||
int z = (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - dpw.PLOT_WIDTH - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
int z = (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - dpw.PLOT_WIDTH - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
||||||
|
|
||||||
return new Location(Bukkit.getWorld(plot.world), x, 1, z);
|
return new Location(Bukkit.getWorld(plotworld.worldname), x, 1, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -122,16 +207,16 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
* (some basic math)
|
* (some basic math)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Location getPlotTopLocAbs(PlotWorld plotworld, Plot plot) {
|
public Location getPlotTopLocAbs(PlotWorld plotworld, PlotId plotid) {
|
||||||
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
||||||
|
|
||||||
int px = plot.id.x;
|
int px = plotid.x;
|
||||||
int pz = plot.id.y;
|
int pz = plotid.y;
|
||||||
|
|
||||||
int x = (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
int x = (px * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
||||||
int z = (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
int z = (pz * (dpw.ROAD_WIDTH + dpw.PLOT_WIDTH)) - ((int) Math.floor(dpw.ROAD_WIDTH / 2)) - 1;
|
||||||
|
|
||||||
return new Location(Bukkit.getWorld(plot.world), x, 256, z);
|
return new Location(Bukkit.getWorld(plotworld.worldname), x, 256, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -349,8 +434,8 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World w = Bukkit.getWorld(plot.world);
|
World w = Bukkit.getWorld(plot.world);
|
||||||
|
|
||||||
Location pos1 = getPlotBottomLocAbs(plotworld, plot);
|
Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
||||||
Location pos2 = getPlotTopLocAbs(plotworld, plot);
|
Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
||||||
|
|
||||||
int sx = pos2.getBlockX();
|
int sx = pos2.getBlockX();
|
||||||
int ex = (sx + dpw.ROAD_WIDTH);
|
int ex = (sx + dpw.ROAD_WIDTH);
|
||||||
@ -375,8 +460,8 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World w = Bukkit.getWorld(plot.world);
|
World w = Bukkit.getWorld(plot.world);
|
||||||
|
|
||||||
Location pos1 = getPlotBottomLocAbs(plotworld, plot);
|
Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
||||||
Location pos2 = getPlotTopLocAbs(plotworld, plot);
|
Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
||||||
|
|
||||||
int sz = pos2.getBlockZ();
|
int sz = pos2.getBlockZ();
|
||||||
int ez = (sz + dpw.ROAD_WIDTH);
|
int ez = (sz + dpw.ROAD_WIDTH);
|
||||||
@ -401,7 +486,7 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World w = Bukkit.getWorld(plot.world);
|
World w = Bukkit.getWorld(plot.world);
|
||||||
|
|
||||||
Location pos2 = getPlotTopLocAbs(plotworld, plot);
|
Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
||||||
|
|
||||||
int sx = pos2.getBlockX() + 1;
|
int sx = pos2.getBlockX() + 1;
|
||||||
int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
||||||
@ -419,8 +504,8 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World w = Bukkit.getWorld(plot.world);
|
World w = Bukkit.getWorld(plot.world);
|
||||||
|
|
||||||
Location pos1 = getPlotBottomLocAbs(plotworld, plot);
|
Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
||||||
Location pos2 = getPlotTopLocAbs(plotworld, plot);
|
Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
||||||
|
|
||||||
int sx = pos2.getBlockX();
|
int sx = pos2.getBlockX();
|
||||||
int ex = (sx + dpw.ROAD_WIDTH);
|
int ex = (sx + dpw.ROAD_WIDTH);
|
||||||
@ -439,8 +524,8 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World w = Bukkit.getWorld(plot.world);
|
World w = Bukkit.getWorld(plot.world);
|
||||||
|
|
||||||
Location pos1 = getPlotBottomLocAbs(plotworld, plot);
|
Location pos1 = getPlotBottomLocAbs(plotworld, plot.id);
|
||||||
Location pos2 = getPlotTopLocAbs(plotworld, plot);
|
Location pos2 = getPlotTopLocAbs(plotworld, plot.id);
|
||||||
|
|
||||||
int sz = pos2.getBlockZ();
|
int sz = pos2.getBlockZ();
|
||||||
int ez = (sz + dpw.ROAD_WIDTH);
|
int ez = (sz + dpw.ROAD_WIDTH);
|
||||||
@ -459,7 +544,7 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World world = Bukkit.getWorld(plot.world);
|
World world = Bukkit.getWorld(plot.world);
|
||||||
|
|
||||||
Location loc = getPlotTopLocAbs(dpw, plot);
|
Location loc = getPlotTopLocAbs(dpw, plot.id);
|
||||||
|
|
||||||
int sx = loc.getBlockX() + 1;
|
int sx = loc.getBlockX() + 1;
|
||||||
int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
int ex = (sx + dpw.ROAD_WIDTH) - 1;
|
||||||
@ -497,6 +582,4 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,7 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public boolean AUTO_MERGE;
|
|
||||||
public static boolean AUTO_MERGE_DEFAULT = false;
|
|
||||||
public boolean MOB_SPAWNING;
|
|
||||||
public static boolean MOB_SPAWNING_DEFAULT = false;
|
|
||||||
/**
|
/**
|
||||||
* Road Height
|
* Road Height
|
||||||
*/
|
*/
|
||||||
@ -75,14 +72,6 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
/**
|
/**
|
||||||
* Plot biome
|
* Plot biome
|
||||||
*/
|
*/
|
||||||
public Biome PLOT_BIOME;
|
|
||||||
/**
|
|
||||||
* Default biome = FOREST
|
|
||||||
*/
|
|
||||||
public static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
|
||||||
/**
|
|
||||||
* PlotMain block
|
|
||||||
*/
|
|
||||||
public PlotBlock[] MAIN_BLOCK;
|
public PlotBlock[] MAIN_BLOCK;
|
||||||
/**
|
/**
|
||||||
* Default main block: 1
|
* Default main block: 1
|
||||||
@ -136,57 +125,6 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
* Default road block: 155
|
* Default road block: 155
|
||||||
*/
|
*/
|
||||||
public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
|
public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
|
||||||
|
|
||||||
/**
|
|
||||||
* plot chat?
|
|
||||||
*/
|
|
||||||
public boolean PLOT_CHAT;
|
|
||||||
/**
|
|
||||||
* Default plot chat: true
|
|
||||||
*/
|
|
||||||
public static boolean PLOT_CHAT_DEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Blocks available in /p set
|
|
||||||
*/
|
|
||||||
public static ArrayList<Material> BLOCKS = new ArrayList<Material>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* schematic on claim
|
|
||||||
*/
|
|
||||||
public boolean SCHEMATIC_ON_CLAIM;
|
|
||||||
/**
|
|
||||||
* Default schematic on claim: false
|
|
||||||
*/
|
|
||||||
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
|
||||||
public boolean SCHEMATIC_CLAIM_SPECIFY = false;
|
|
||||||
public List<String> SCHEMATICS = new ArrayList<String>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* schematic file
|
|
||||||
*/
|
|
||||||
public String SCHEMATIC_FILE;
|
|
||||||
/**
|
|
||||||
* Default schematic file: 'null'
|
|
||||||
*/
|
|
||||||
public static String SCHEMATIC_FILE_DEFAULT = "null";
|
|
||||||
/**
|
|
||||||
* default flags
|
|
||||||
*/
|
|
||||||
public Flag[] DEFAULT_FLAGS;
|
|
||||||
/**
|
|
||||||
* Default default flags
|
|
||||||
*/
|
|
||||||
public static Flag[] DEFAULT_FLAGS_DEFAULT = new Flag[] {};
|
|
||||||
|
|
||||||
public boolean USE_ECONOMY;
|
|
||||||
public static boolean USE_ECONOMY_DEFAULT = false;
|
|
||||||
|
|
||||||
public double PLOT_PRICE;
|
|
||||||
public static double PLOT_PRICE_DEFAULT = 100;
|
|
||||||
|
|
||||||
public double MERGE_PRICE;
|
|
||||||
public static double MERGE_PRICE_DEFAULT = 100;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -208,11 +146,8 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
// TODO return a set of configuration nodes (used for setup command)
|
// TODO return a set of configuration nodes (used for setup command)
|
||||||
return
|
return
|
||||||
new ConfigurationNode[] {
|
new ConfigurationNode[] {
|
||||||
new ConfigurationNode("natural_mob_spawning", MOB_SPAWNING, "Enable mob spawning", Configuration.BOOLEAN, false),
|
|
||||||
new ConfigurationNode("plot.auto_merge", AUTO_MERGE, "Enable Auto plot merging", Configuration.BOOLEAN, false),
|
|
||||||
new ConfigurationNode("plot.height", PLOT_HEIGHT, "Plot height", Configuration.INTEGER, true),
|
new ConfigurationNode("plot.height", PLOT_HEIGHT, "Plot height", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("plot.width", PLOT_WIDTH, "Plot width", Configuration.INTEGER, true),
|
new ConfigurationNode("plot.width", PLOT_WIDTH, "Plot width", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("plot.biome", PLOT_BIOME, "Plot biome", Configuration.BIOME, true),
|
|
||||||
new ConfigurationNode("plot.filling", MAIN_BLOCK, "Plot block", Configuration.BLOCKLIST, true),
|
new ConfigurationNode("plot.filling", MAIN_BLOCK, "Plot block", Configuration.BLOCKLIST, true),
|
||||||
new ConfigurationNode("plot.floor", TOP_BLOCK, "Plot floor block", Configuration.BLOCKLIST, true),
|
new ConfigurationNode("plot.floor", TOP_BLOCK, "Plot floor block", Configuration.BLOCKLIST, true),
|
||||||
new ConfigurationNode("wall.block", WALL_BLOCK, "Top wall block", Configuration.BLOCK, true),
|
new ConfigurationNode("wall.block", WALL_BLOCK, "Top wall block", Configuration.BLOCK, true),
|
||||||
@ -223,14 +158,6 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
new ConfigurationNode("road.stripes", ROAD_STRIPES, "Road stripe block", Configuration.BLOCK, true),
|
new ConfigurationNode("road.stripes", ROAD_STRIPES, "Road stripe block", Configuration.BLOCK, true),
|
||||||
new ConfigurationNode("wall.filling", WALL_FILLING, "Wall filling block", Configuration.BLOCK, true),
|
new ConfigurationNode("wall.filling", WALL_FILLING, "Wall filling block", Configuration.BLOCK, true),
|
||||||
new ConfigurationNode("wall.height", WALL_HEIGHT, "Wall height", Configuration.INTEGER, true),
|
new ConfigurationNode("wall.height", WALL_HEIGHT, "Wall height", Configuration.INTEGER, true),
|
||||||
new ConfigurationNode("schematic.on_claim", SCHEMATIC_ON_CLAIM, "Enable schematic paste on claim", Configuration.BOOLEAN, false),
|
|
||||||
new ConfigurationNode("schematic.file", SCHEMATIC_FILE, "Schematic file directory", Configuration.STRING, false),
|
|
||||||
new ConfigurationNode("schematic.specify_on_claim", SCHEMATIC_CLAIM_SPECIFY, "Enable specifying schematics on claim", Configuration.BOOLEAN, false),
|
|
||||||
new ConfigurationNode("schematic.schematics", SCHEMATICS, "List of schematic paths", Configuration.STRINGLIST, false),
|
|
||||||
new ConfigurationNode("economy.use", USE_ECONOMY, "Enable economy features", Configuration.BOOLEAN, false),
|
|
||||||
new ConfigurationNode("economy.prices.claim", PLOT_PRICE, "Plot claim price", Configuration.DOUBLE, false),
|
|
||||||
new ConfigurationNode("economy.prices.merge", MERGE_PRICE, "Plot merge price", Configuration.DOUBLE, false),
|
|
||||||
new ConfigurationNode("chat.enabled", PLOT_CHAT, "Enable plot chat", Configuration.BOOLEAN, false)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,11 +167,9 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void loadConfiguration(ConfigurationSection config) {
|
public void loadConfiguration(ConfigurationSection config) {
|
||||||
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
|
|
||||||
this.AUTO_MERGE = config.getBoolean("plot.auto_merge");
|
|
||||||
this.PLOT_HEIGHT = config.getInt("plot.height");
|
this.PLOT_HEIGHT = config.getInt("plot.height");
|
||||||
this.PLOT_WIDTH = config.getInt("plot.width");
|
this.PLOT_WIDTH = config.getInt("plot.width");
|
||||||
this.PLOT_BIOME = (Biome) Configuration.BIOME.parseString(config.getString("plot.biome"));
|
|
||||||
this.MAIN_BLOCK = (PlotBlock[]) Configuration.BLOCKLIST.parseString(StringUtils.join(config.getStringList("plot.filling"),','));
|
this.MAIN_BLOCK = (PlotBlock[]) Configuration.BLOCKLIST.parseString(StringUtils.join(config.getStringList("plot.filling"),','));
|
||||||
this.TOP_BLOCK = (PlotBlock[]) Configuration.BLOCKLIST.parseString(StringUtils.join(config.getStringList("plot.floor"),','));
|
this.TOP_BLOCK = (PlotBlock[]) Configuration.BLOCKLIST.parseString(StringUtils.join(config.getStringList("plot.floor"),','));
|
||||||
this.WALL_BLOCK = (PlotBlock) Configuration.BLOCK.parseString(config.getString("wall.block"));
|
this.WALL_BLOCK = (PlotBlock) Configuration.BLOCK.parseString(config.getString("wall.block"));
|
||||||
@ -255,14 +180,7 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
this.ROAD_STRIPES = (PlotBlock) Configuration.BLOCK.parseString(config.getString("road.stripes"));
|
this.ROAD_STRIPES = (PlotBlock) Configuration.BLOCK.parseString(config.getString("road.stripes"));
|
||||||
this.WALL_FILLING = (PlotBlock) Configuration.BLOCK.parseString(config.getString("wall.filling"));
|
this.WALL_FILLING = (PlotBlock) Configuration.BLOCK.parseString(config.getString("wall.filling"));
|
||||||
this.WALL_HEIGHT = config.getInt("wall.height");
|
this.WALL_HEIGHT = config.getInt("wall.height");
|
||||||
this.SCHEMATIC_ON_CLAIM = config.getBoolean("schematic.on_claim");
|
|
||||||
this.SCHEMATIC_FILE = config.getString("schematic.file");
|
|
||||||
this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim");
|
|
||||||
this.SCHEMATICS = config.getStringList("schematic.schematics");
|
|
||||||
this.USE_ECONOMY = config.getBoolean("economy.use");
|
|
||||||
this.PLOT_PRICE = config.getDouble("economy.prices.claim");
|
|
||||||
this.MERGE_PRICE = config.getDouble("economy.prices.merge");
|
|
||||||
this.PLOT_CHAT = config.getBoolean("chat.enabled");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user