mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
A lot will need to be changed to implement this...
This commit is contained in:
parent
4e08ae2a54
commit
bde2e45e6b
@ -0,0 +1,56 @@
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.intellectualcrafters.plot.Configuration.SettingValue;
|
||||
|
||||
public class ConfigurationNode {
|
||||
private String constant;
|
||||
private Object default_value;
|
||||
private String description;
|
||||
private Object value = 0;
|
||||
private SettingValue type;
|
||||
|
||||
public ConfigurationNode(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 (!this.type.validateValue(string)) {
|
||||
return false;
|
||||
}
|
||||
this.value = this.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;
|
||||
}
|
||||
}
|
10
PlotSquared/src/com/intellectualcrafters/plot/PlotBlock.java
Normal file
10
PlotSquared/src/com/intellectualcrafters/plot/PlotBlock.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
public class PlotBlock {
|
||||
public int id;
|
||||
public byte data;
|
||||
public PlotBlock(int id, byte data) {
|
||||
this.id = id;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -27,7 +27,6 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
@ -750,8 +749,7 @@ public class PlotHelper {
|
||||
if ((id != null) && id.equals(plot.id)) {
|
||||
if (entity instanceof Player) {
|
||||
PlotMain.teleportPlayer((Player) entity, entity.getLocation(), plot);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
@ -776,12 +774,15 @@ public class PlotHelper {
|
||||
final long start = System.nanoTime();
|
||||
final World world = requester.getWorld();
|
||||
|
||||
// clear entities/teleport players
|
||||
/*
|
||||
* keep
|
||||
*/
|
||||
clearAllEntities(world, plot, false);
|
||||
|
||||
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||
PlotHelper.setBiome(requester.getWorld(), plot, Biome.FOREST);
|
||||
PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT);
|
||||
|
||||
|
||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
||||
|
||||
@ -802,6 +803,9 @@ public class PlotHelper {
|
||||
filling_data[i] = result[1];
|
||||
}
|
||||
|
||||
/*
|
||||
* keep
|
||||
*/
|
||||
final int prime = 31;
|
||||
int h = 1;
|
||||
h = (prime * h) + pos1.getBlockX();
|
||||
@ -904,6 +908,11 @@ public class PlotHelper {
|
||||
setCuboid(world, new Location(world, max.getBlockX(), 1, max.getBlockZ()), new Location(world, plotMaxX + 1, plotworld.PLOT_HEIGHT, plotMaxZ + 1), filling, filling_data);
|
||||
setCuboid(world, new Location(world, max.getBlockX(), plotworld.PLOT_HEIGHT, max.getBlockZ()), new Location(world, plotMaxX + 1, plotworld.PLOT_HEIGHT + 1, plotMaxZ + 1), plotfloors, plotfloors_data);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* keep
|
||||
*/
|
||||
PlayerFunctions.sendMessage(requester, C.CLEARING_DONE.s().replaceAll("%time%", "" + ((System.nanoTime() - start) / 1000000.0)));
|
||||
if (canSetFast) {
|
||||
SetBlockFast.update(requester);
|
||||
|
@ -7,63 +7,56 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class PlotManager {
|
||||
public final PlotWorld plotworld;
|
||||
|
||||
public PlotManager(PlotWorld plotworld) {
|
||||
this.plotworld = plotworld;
|
||||
}
|
||||
|
||||
public PlotWorld getPlotWorld() {
|
||||
return this.plotworld;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Plot locations (methods with Abs in them will not need to consider mega plots)
|
||||
* Plot locations (methods with Abs in them will not need to consider mega
|
||||
* plots)
|
||||
*/
|
||||
|
||||
public abstract PlotId getPlotIdAbs(World world, Location loc);
|
||||
|
||||
public abstract boolean isInPlotAbs(Location loc, Plot plot);
|
||||
|
||||
public abstract Location getPlotBottomLocAbs(Plot plot); // If you have a circular plot, just return the corner if it were a square
|
||||
|
||||
public abstract Location getPlotTopLocAbs(Plot plot); // the same applies here
|
||||
|
||||
|
||||
public abstract PlotId getPlotIdAbs(PlotWorld plotworld, Location loc);
|
||||
|
||||
public abstract boolean isInPlotAbs(PlotWorld plotworld, Location loc, Plot plot);
|
||||
// If you have a circular plot, just return the corner if it were a square
|
||||
public abstract Location getPlotBottomLocAbs(PlotWorld plotworld, Plot plot);
|
||||
// the same applies here
|
||||
public abstract Location getPlotTopLocAbs(PlotWorld plotworld, Plot plot);
|
||||
|
||||
/*
|
||||
* Plot clearing (return false if you do not support some method)
|
||||
* Plot clearing (return false if you do not support some method)
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract boolean clearPlotAbs(Player player, Plot plot);
|
||||
|
||||
public abstract boolean clearSignAbs(Player player, Plot plot);
|
||||
|
||||
public abstract boolean clearEntitiesAbs(Player player, Plot plot);
|
||||
|
||||
// The function below will apply to MEGA PLOTS, return false if you don't support clearing of mega plots
|
||||
// the function getPlotBottomLoc(plot) will return the bottom location of the entire mega plot
|
||||
public abstract boolean clearMegaPlot(Player player, Plot plot);
|
||||
|
||||
|
||||
public abstract boolean clearPlot(Player player, Plot plot, boolean mega);
|
||||
|
||||
public abstract boolean clearSign(Player player, Plot plot, boolean mega);
|
||||
|
||||
// clearEntities also needs to clear Player entities (e.g. teleport them to the surface)
|
||||
public abstract boolean clearEntities(Player player, Plot plot, boolean mega);
|
||||
|
||||
/*
|
||||
* Plot set functions (return false if you do not support the specific set method)
|
||||
* Plot set functions (return false if you do not support the specific set
|
||||
* method)
|
||||
*/
|
||||
|
||||
|
||||
public abstract boolean setWall(Player player, Plot plot, Block block);
|
||||
|
||||
|
||||
public abstract boolean setBiome(Player player, Plot plot, Biome biome);
|
||||
|
||||
|
||||
/*
|
||||
* PLOT MERGING (return false if your generator does not support plot merging)
|
||||
* PLOT MERGING (return false if your generator does not support plot
|
||||
* merging)
|
||||
*/
|
||||
public abstract boolean createRoadEast(Plot plot);
|
||||
|
||||
|
||||
public abstract boolean createRoadSouth(Plot plot);
|
||||
|
||||
|
||||
public abstract boolean createRoadSouthEast(Plot plot);
|
||||
|
||||
|
||||
public abstract boolean removeRoadEast(Plot plot);
|
||||
|
||||
|
||||
public abstract boolean removeRoadSouth(Plot plot);
|
||||
|
||||
|
||||
public abstract boolean removeRoadSouthEast(Plot plot);
|
||||
|
||||
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class DBFunc {
|
||||
int counter = 0;
|
||||
for (Integer id : helpers.keySet()) {
|
||||
for (UUID helper : helpers.get(id)) {
|
||||
|
||||
|
||||
stmt.setInt((counter * 2) + 1, id);
|
||||
stmt.setString((counter * 2) + 2, helper.toString());
|
||||
counter++;
|
||||
|
@ -6,18 +6,15 @@ import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotHomePosition;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDFetcher;
|
||||
import com.worldcretornica.plotme.PlayerList;
|
||||
import com.worldcretornica.plotme.Plot;
|
||||
import com.worldcretornica.plotme.PlotManager;
|
||||
@ -44,10 +41,11 @@ public class PlotMeConverter {
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Caching playerdata...");
|
||||
ArrayList<com.intellectualcrafters.plot.Plot> createdPlots = new ArrayList<com.intellectualcrafters.plot.Plot>();
|
||||
Map<String, UUID> uuidMap = new HashMap<String, UUID>();
|
||||
boolean online = Bukkit.getServer().getOnlineMode();
|
||||
boolean online = Bukkit.getServer().getOnlineMode();
|
||||
if (!online) {
|
||||
File playersFolder = new File("world" + File.separator + "playerdata");
|
||||
String[] dat = playersFolder.list(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File f, String s) {
|
||||
return s.endsWith(".dat");
|
||||
}
|
||||
@ -56,13 +54,12 @@ public class PlotMeConverter {
|
||||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(current.replaceAll(".dat$", ""));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
if (uuid!=null) {
|
||||
if (uuid != null) {
|
||||
String name = Bukkit.getOfflinePlayer(uuid).getName();
|
||||
if (name!=null) {
|
||||
if (name != null) {
|
||||
uuidMap.put(name, uuid);
|
||||
}
|
||||
}
|
||||
@ -71,8 +68,8 @@ public class PlotMeConverter {
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
HashMap<String, Plot> plots = PlotManager.getPlots(world);
|
||||
if (plots != null) {
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Processing '"+plots.size()+"' plots for world '"+world.getName()+"'");
|
||||
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Processing '" + plots.size() + "' plots for world '" + world.getName() + "'");
|
||||
|
||||
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Converting " + plots.size() + " plots for '" + world.toString() + "'...");
|
||||
for (Plot plot : plots.values()) {
|
||||
ArrayList<UUID> psAdded = new ArrayList<>();
|
||||
@ -99,7 +96,7 @@ public class PlotMeConverter {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (set.getValue()!=null) {
|
||||
if (set.getValue() != null) {
|
||||
psAdded.add(set.getValue());
|
||||
}
|
||||
}
|
||||
@ -110,12 +107,11 @@ public class PlotMeConverter {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (set.getValue()!=null) {
|
||||
if (set.getValue() != null) {
|
||||
psDenied.add(set.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (String user : plot.getAllowed().split(",")) {
|
||||
if (user.equals("*")) {
|
||||
psAdded.add(DBFunc.everyone);
|
||||
@ -131,9 +127,8 @@ public class PlotMeConverter {
|
||||
psDenied.add(uuidMap.get(user));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
|
||||
} catch (Throwable e) {
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
@ -147,8 +142,7 @@ public class PlotMeConverter {
|
||||
com.intellectualcrafters.plot.Plot pl = null;
|
||||
if (online) {
|
||||
pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied, false, 8000l, false, "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] { false, false, false, false });
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
String owner = plot.getOwner();
|
||||
if (uuidMap.containsKey(owner)) {
|
||||
pl = new com.intellectualcrafters.plot.Plot(id, uuidMap.get(owner), plot.getBiome(), psAdded, psTrusted, psDenied, false, 8000l, false, "", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[] { false, false, false, false });
|
||||
@ -157,7 +151,7 @@ public class PlotMeConverter {
|
||||
|
||||
// TODO createPlot doesn't add helpers / denied
|
||||
// users
|
||||
if (pl!=null) {
|
||||
if (pl != null) {
|
||||
createdPlots.add(pl);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.PlotManager;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
|
||||
public class DefaultPlotGenerator extends PlotGenerator {
|
||||
|
||||
private final PlotWorld plotworld;
|
||||
private final ChunkGenerator generator;
|
||||
private static BlockPopulator populator = null;
|
||||
private static PlotManager manager = null;
|
||||
|
||||
public DefaultPlotGenerator(String worldname) {
|
||||
super(worldname);
|
||||
|
||||
this.plotworld = new DefaultPlotWorld(worldname);
|
||||
this.generator = new WorldGenerator(worldname);
|
||||
if (populator==null) {
|
||||
populator = new XPopulator((DefaultPlotWorld) this.plotworld);
|
||||
}
|
||||
if (manager==null) {
|
||||
DefaultPlotGenerator.manager = new DefaultPlotManager();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotWorld getPlotWorld(String worldname) {
|
||||
return this.plotworld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator getChunkGenerator(String worldname) {
|
||||
return this.generator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPopulator getBlockPopulator(PlotWorld plotworld) {
|
||||
return populator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotManager getPlotManager(PlotWorld plotworld) {
|
||||
return manager;
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.Configuration;
|
||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.Plot;
|
||||
import com.intellectualcrafters.plot.PlotHelper;
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.PlotManager;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
|
||||
public class DefaultPlotManager extends PlotManager {
|
||||
|
||||
@Override
|
||||
public PlotId getPlotIdAbs(PlotWorld plotworld, Location loc) {
|
||||
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
||||
|
||||
int x = loc.getBlockX();
|
||||
int z = loc.getBlockZ();
|
||||
|
||||
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 > (pathWidthLower + dpw.PLOT_WIDTH));
|
||||
boolean eastWest = (rx <= pathWidthLower) || (rx > end);
|
||||
|
||||
if (northSouth || eastWest) {
|
||||
return null;
|
||||
}
|
||||
return new PlotId(dx + 1, dz + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInPlotAbs(PlotWorld plotworld, Location loc, Plot plot) {
|
||||
PlotId result = getPlotIdAbs(plotworld, loc);
|
||||
if (result==null) {
|
||||
return false;
|
||||
}
|
||||
return result==plot.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getPlotBottomLocAbs(PlotWorld plotworld, Plot plot) {
|
||||
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
||||
|
||||
int px = plot.id.x;
|
||||
int pz = plot.id.y;
|
||||
|
||||
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;
|
||||
|
||||
return new Location(Bukkit.getWorld(plot.world), x, 1, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getPlotTopLocAbs(PlotWorld plotworld, Plot plot) {
|
||||
DefaultPlotWorld dpw = ((DefaultPlotWorld) plotworld);
|
||||
|
||||
int px = plot.id.x;
|
||||
int pz = plot.id.y;
|
||||
|
||||
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;
|
||||
|
||||
return new Location(Bukkit.getWorld(plot.world), x, 256, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearPlot(Player player, Plot plot, boolean mega) {
|
||||
World world = player.getWorld();
|
||||
DefaultPlotWorld plotworld = (DefaultPlotWorld) PlotMain.getWorldSettings(world);
|
||||
|
||||
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
||||
|
||||
// TODO stuff
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearSign(Player player, Plot plot, boolean mega) {
|
||||
World world = player.getWorld();
|
||||
DefaultPlotWorld plotworld = (DefaultPlotWorld) PlotMain.getWorldSettings(world);
|
||||
Location pl = new Location(world, PlotHelper.getPlotBottomLoc(world, plot.id).getBlockX(), plotworld.ROAD_HEIGHT + 1, getPlotBottomLoc(world, plot.id).getBlockZ());
|
||||
Block bs = pl.add(0, 0, -1).getBlock();
|
||||
bs.setType(Material.AIR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearEntities(Player player, Plot plot, boolean mega) {
|
||||
World world = Bukkit.getWorld(plot.world);
|
||||
Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
||||
for (int i = (pos1.getBlockX() / 16) * 16; i < (16 + ((pos2.getBlockX() / 16) * 16)); i += 16) {
|
||||
for (int j = (pos1.getBlockZ() / 16) * 16; j < (16 + ((pos2.getBlockZ() / 16) * 16)); j += 16) {
|
||||
Chunk chunk = world.getChunkAt(i, j);
|
||||
for (Entity entity : chunk.getEntities()) {
|
||||
Location eloc = entity.getLocation();
|
||||
if (eloc.getBlockX() >= pos1.getBlockX() && eloc.getBlockZ() >= pos1.getBlockZ() && eloc.getBlockX() <= pos2.getBlockX() && eloc.getBlockZ() <= pos2.getBlockZ()) {
|
||||
if (entity instanceof Player) {
|
||||
PlotMain.teleportPlayer((Player) entity, entity.getLocation(), plot);
|
||||
} else {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setWall(Player player, Plot plot, Block block) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Player player, Plot plot, Biome biome) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createRoadEast(Plot plot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createRoadSouth(Plot plot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createRoadSouthEast(Plot plot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeRoadEast(Plot plot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeRoadSouth(Plot plot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeRoadSouthEast(Plot plot) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import com.intellectualcrafters.plot.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.Flag;
|
||||
import com.intellectualcrafters.plot.PlotBlock;
|
||||
import com.intellectualcrafters.plot.PlotWorld;
|
||||
|
||||
public class DefaultPlotWorld extends PlotWorld {
|
||||
|
||||
public boolean AUTO_MERGE;
|
||||
public static boolean AUTO_MERGE_DEFAULT = false;
|
||||
/**
|
||||
* Road Height
|
||||
*/
|
||||
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 Biome PLOT_BIOME;
|
||||
/**
|
||||
* Default biome = FOREST
|
||||
*/
|
||||
public static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
||||
/**
|
||||
* PlotMain block
|
||||
*/
|
||||
public PlotBlock[] MAIN_BLOCK;
|
||||
/**
|
||||
* Default main block: 1
|
||||
*/
|
||||
public static PlotBlock[] MAIN_BLOCK_DEFAULT = new PlotBlock[] { new PlotBlock(1, (byte) 0) };
|
||||
/**
|
||||
* Top blocks
|
||||
*/
|
||||
public PlotBlock[] TOP_BLOCK;
|
||||
/**
|
||||
* Default top blocks: {"2"}
|
||||
*/
|
||||
public static PlotBlock[] TOP_BLOCK_DEFAULT = new PlotBlock[] { new PlotBlock(2, (byte) 0) };
|
||||
|
||||
/**
|
||||
* Wall block
|
||||
*/
|
||||
public PlotBlock WALL_BLOCK;
|
||||
/**
|
||||
* Default wall block: 44
|
||||
*/
|
||||
public static String WALL_BLOCK_DEFAULT = "44:0";
|
||||
|
||||
/**
|
||||
* Wall filling
|
||||
*/
|
||||
public PlotBlock WALL_FILLING;
|
||||
/**
|
||||
* Default wall filling: 1
|
||||
*/
|
||||
public static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock(1, (byte) 0);
|
||||
|
||||
/**
|
||||
* Road stripes
|
||||
*/
|
||||
public PlotBlock ROAD_STRIPES;
|
||||
/**
|
||||
* Default road stripes: 35
|
||||
*/
|
||||
public static PlotBlock ROAD_STRIPES_DEFAULT = new PlotBlock(98, (byte) 0);
|
||||
/**
|
||||
* enable road stripes
|
||||
*/
|
||||
public boolean ROAD_STRIPES_ENABLED;
|
||||
public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
|
||||
/**
|
||||
* Road block
|
||||
*/
|
||||
public PlotBlock ROAD_BLOCK;
|
||||
/**
|
||||
* Default road block: 155
|
||||
*/
|
||||
public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock(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<>();
|
||||
|
||||
/**
|
||||
* 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 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 DefaultPlotWorld(String worldname) {
|
||||
super(worldname);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationNode[] getSettingNodes() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSettingNode(String key, String value) {
|
||||
switch (key) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class PlayerEvents implements Listener {
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
PlotMain.loadWorld(event.getWorld());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
if (!event.getPlayer().hasPlayedBefore()) {
|
||||
|
Loading…
Reference in New Issue
Block a user