mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Bug fixes.
This commit is contained in:
parent
e548cd8158
commit
b0351b5c99
@ -305,7 +305,7 @@ public class PlotHelper {
|
|||||||
PlotManager manager = PlotMain.getPlotManager(world);
|
PlotManager manager = PlotMain.getPlotManager(world);
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
|
|
||||||
manager.setWall(player, plotworld, plot.id, block);
|
manager.setWall(world, plotworld, plot.id, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void autoMerge(World world, Plot plot, Player player) {
|
public static void autoMerge(World world, Plot plot, Player player) {
|
||||||
@ -599,7 +599,7 @@ public class PlotHelper {
|
|||||||
World world = requester.getWorld();
|
World world = requester.getWorld();
|
||||||
PlotManager manager = PlotMain.getPlotManager(world);
|
PlotManager manager = PlotMain.getPlotManager(world);
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
manager.setWall(requester, plotworld, plot.id, block);
|
manager.setWallFilling(world, plotworld, plot.id, block);
|
||||||
PlayerFunctions.sendMessage(requester, C.SET_BLOCK_ACTION_FINISHED);
|
PlayerFunctions.sendMessage(requester, C.SET_BLOCK_ACTION_FINISHED);
|
||||||
if (canSetFast) {
|
if (canSetFast) {
|
||||||
SetBlockFast.update(requester);
|
SetBlockFast.update(requester);
|
||||||
@ -617,7 +617,7 @@ public class PlotHelper {
|
|||||||
PlotManager manager = PlotMain.getPlotManager(world);
|
PlotManager manager = PlotMain.getPlotManager(world);
|
||||||
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||||
PlayerFunctions.sendMessage(requester, C.SET_BLOCK_ACTION_FINISHED);
|
PlayerFunctions.sendMessage(requester, C.SET_BLOCK_ACTION_FINISHED);
|
||||||
manager.setFloor(requester, plotworld, plot.id, blocks);
|
manager.setFloor(world, plotworld, plot.id, blocks);
|
||||||
if (canSetFast) {
|
if (canSetFast) {
|
||||||
SetBlockFast.update(requester);
|
SetBlockFast.update(requester);
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,13 @@ public abstract class PlotManager {
|
|||||||
* method)
|
* method)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract boolean setWall(Player player, PlotWorld plotworld, PlotId plotid, PlotBlock block);
|
public abstract boolean setWallFilling(World world, PlotWorld plotworld, PlotId plotid, PlotBlock block);
|
||||||
|
|
||||||
public abstract boolean setFloor(Player player, PlotWorld plotworld, PlotId plotid, PlotBlock[] block);
|
public abstract boolean setWall(World world, PlotWorld plotworld, PlotId plotid, PlotBlock block);
|
||||||
|
|
||||||
public abstract boolean setBiome(Player player, Plot plot, Biome biome);
|
public abstract boolean setFloor(World world, PlotWorld plotworld, PlotId plotid, PlotBlock[] block);
|
||||||
|
|
||||||
|
public abstract boolean setBiome(World world, Plot plot, Biome biome);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PLOT MERGING (return false if your generator does not support plot
|
* PLOT MERGING (return false if your generator does not support plot
|
||||||
|
@ -1,15 +1,24 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.intellectualcrafters.jnbt.*;
|
import com.intellectualcrafters.jnbt.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
@ -180,6 +189,160 @@ public class SchematicHandler {
|
|||||||
public int getZ() {
|
public int getZ() {
|
||||||
return this.z;
|
return this.z;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
public boolean save(CompoundTag tag, String path) {
|
||||||
|
try {
|
||||||
|
OutputStream stream = new FileOutputStream(path);
|
||||||
|
NBTOutputStream output = new NBTOutputStream(stream);
|
||||||
|
output.writeTag(tag);
|
||||||
|
output.close();
|
||||||
|
stream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag getCompoundTag(World world, Plot plot) {
|
||||||
|
|
||||||
|
// loading chunks
|
||||||
|
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||||
|
final 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);
|
||||||
|
chunk.load(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO get blocks
|
||||||
|
|
||||||
|
// save as a schematic
|
||||||
|
int MAX_SIZE = Short.MAX_VALUE - Short.MIN_VALUE;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// int width = region.getWidth();
|
||||||
|
// int height = region.getHeight();
|
||||||
|
// int length = region.getLength();
|
||||||
|
//
|
||||||
|
// if (width > MAX_SIZE) {
|
||||||
|
// throw new IllegalArgumentException("Width of region too large for a .schematic");
|
||||||
|
// }
|
||||||
|
// if (height > MAX_SIZE) {
|
||||||
|
// throw new IllegalArgumentException("Height of region too large for a .schematic");
|
||||||
|
// }
|
||||||
|
// if (length > MAX_SIZE) {
|
||||||
|
// throw new IllegalArgumentException("Length of region too large for a .schematic");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // ====================================================================
|
||||||
|
// // Metadata
|
||||||
|
// // ====================================================================
|
||||||
|
//
|
||||||
|
// HashMap<String, Tag> schematic = new HashMap<String, Tag>();
|
||||||
|
// schematic.put("Width", new ShortTag("Width", (short) width));
|
||||||
|
// schematic.put("Length", new ShortTag("Length", (short) length));
|
||||||
|
// schematic.put("Height", new ShortTag("Height", (short) height));
|
||||||
|
// schematic.put("Materials", new StringTag("Materials", "Alpha"));
|
||||||
|
// schematic.put("WEOriginX", new IntTag("WEOriginX", min.getBlockX()));
|
||||||
|
// schematic.put("WEOriginY", new IntTag("WEOriginY", min.getBlockY()));
|
||||||
|
// schematic.put("WEOriginZ", new IntTag("WEOriginZ", min.getBlockZ()));
|
||||||
|
// schematic.put("WEOffsetX", new IntTag("WEOffsetX", offset.getBlockX()));
|
||||||
|
// schematic.put("WEOffsetY", new IntTag("WEOffsetY", offset.getBlockY()));
|
||||||
|
// schematic.put("WEOffsetZ", new IntTag("WEOffsetZ", offset.getBlockZ()));
|
||||||
|
//
|
||||||
|
// // ====================================================================
|
||||||
|
// // Block handling
|
||||||
|
// // ====================================================================
|
||||||
|
//
|
||||||
|
// byte[] blocks = new byte[width * height * length];
|
||||||
|
// byte[] addBlocks = null;
|
||||||
|
// byte[] blockData = new byte[width * height * length];
|
||||||
|
// List<Tag> tileEntities = new ArrayList<Tag>();
|
||||||
|
//
|
||||||
|
// for (Vector point : region) {
|
||||||
|
// Vector relative = point.subtract(min);
|
||||||
|
// int x = relative.getBlockX();
|
||||||
|
// int y = relative.getBlockY();
|
||||||
|
// int z = relative.getBlockZ();
|
||||||
|
//
|
||||||
|
// int index = y * width * length + z * width + x;
|
||||||
|
// BaseBlock block = clipboard.getBlock(point);
|
||||||
|
//
|
||||||
|
// // Save 4096 IDs in an AddBlocks section
|
||||||
|
// if (block.getType() > 255) {
|
||||||
|
// if (addBlocks == null) { // Lazily create section
|
||||||
|
// addBlocks = new byte[(blocks.length >> 1) + 1];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// addBlocks[index >> 1] = (byte) (((index & 1) == 0) ?
|
||||||
|
// addBlocks[index >> 1] & 0xF0 | (block.getType() >> 8) & 0xF
|
||||||
|
// : addBlocks[index >> 1] & 0xF | ((block.getType() >> 8) & 0xF) << 4);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// blocks[index] = (byte) block.getType();
|
||||||
|
// blockData[index] = (byte) block.getData();
|
||||||
|
//
|
||||||
|
// // Store TileEntity data
|
||||||
|
// CompoundTag rawTag = block.getNbtData();
|
||||||
|
// if (rawTag != null) {
|
||||||
|
// Map<String, Tag> values = new HashMap<String, Tag>();
|
||||||
|
// for (Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
|
||||||
|
// values.put(entry.getKey(), entry.getValue());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// values.put("id", new StringTag("id", block.getNbtId()));
|
||||||
|
// values.put("x", new IntTag("x", x));
|
||||||
|
// values.put("y", new IntTag("y", y));
|
||||||
|
// values.put("z", new IntTag("z", z));
|
||||||
|
//
|
||||||
|
// CompoundTag tileEntityTag = new CompoundTag("TileEntity", values);
|
||||||
|
// tileEntities.add(tileEntityTag);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// schematic.put("Blocks", new ByteArrayTag("Blocks", blocks));
|
||||||
|
// schematic.put("Data", new ByteArrayTag("Data", blockData));
|
||||||
|
// schematic.put("TileEntities", new ListTag("TileEntities", CompoundTag.class, tileEntities));
|
||||||
|
//
|
||||||
|
// if (addBlocks != null) {
|
||||||
|
// schematic.put("AddBlocks", new ByteArrayTag("AddBlocks", addBlocks));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // ====================================================================
|
||||||
|
// // Entities
|
||||||
|
// // ====================================================================
|
||||||
|
//
|
||||||
|
// List<Tag> entities = new ArrayList<Tag>();
|
||||||
|
// for (Entity entity : clipboard.getEntities()) {
|
||||||
|
// BaseEntity state = entity.getState();
|
||||||
|
//
|
||||||
|
// if (state != null) {
|
||||||
|
// Map<String, Tag> values = new HashMap<String, Tag>();
|
||||||
|
//
|
||||||
|
// // Put NBT provided data
|
||||||
|
// CompoundTag rawTag = state.getNbtData();
|
||||||
|
// if (rawTag != null) {
|
||||||
|
// values.putAll(rawTag.getValue());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Store our location data, overwriting any
|
||||||
|
// values.put("id", new StringTag("id", state.getTypeId()));
|
||||||
|
// values.put("Pos", writeVector(entity.getLocation().toVector(), "Pos"));
|
||||||
|
// values.put("Rotation", writeRotation(entity.getLocation(), "Rotation"));
|
||||||
|
//
|
||||||
|
// CompoundTag entityTag = new CompoundTag("Entity", values);
|
||||||
|
// entities.add(entityTag);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// schematic.put("Entities", new ListTag("Entities", CompoundTag.class, entities));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// CompoundTag schematicTag = new CompoundTag("Schematic", schematic);
|
||||||
|
// return schematicTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DataCollection {
|
public class DataCollection {
|
||||||
|
@ -78,7 +78,7 @@ public class Denied extends SubCommand {
|
|||||||
}
|
}
|
||||||
if (!uuid.equals(DBFunc.everyone) && (Bukkit.getPlayer(uuid) != null) && Bukkit.getPlayer(uuid).isOnline()) {
|
if (!uuid.equals(DBFunc.everyone) && (Bukkit.getPlayer(uuid) != null) && Bukkit.getPlayer(uuid).isOnline()) {
|
||||||
Plot pl = PlayerFunctions.getCurrentPlot(Bukkit.getPlayer((uuid)));
|
Plot pl = PlayerFunctions.getCurrentPlot(Bukkit.getPlayer((uuid)));
|
||||||
if (pl.id == plot.id) {
|
if (pl!=null && pl.id.equals(plot.id)) {
|
||||||
PlayerFunctions.sendMessage(Bukkit.getPlayer(uuid), C.YOU_BE_DENIED);
|
PlayerFunctions.sendMessage(Bukkit.getPlayer(uuid), C.YOU_BE_DENIED);
|
||||||
Bukkit.getPlayer(uuid).teleport(Bukkit.getPlayer(uuid).getWorld().getSpawnLocation());
|
Bukkit.getPlayer(uuid).teleport(Bukkit.getPlayer(uuid).getWorld().getSpawnLocation());
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import com.intellectualcrafters.plot.C;
|
|||||||
import com.intellectualcrafters.plot.PlayerFunctions;
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.Plot;
|
import com.intellectualcrafters.plot.Plot;
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
import com.intellectualcrafters.plot.UUIDHandler;
|
||||||
|
|
||||||
public class Visit extends SubCommand {
|
public class Visit extends SubCommand {
|
||||||
public Visit() {
|
public Visit() {
|
||||||
@ -43,8 +44,13 @@ public class Visit extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String username = args[0];
|
String username = args[0];
|
||||||
List<Plot> plots = getPlots(Bukkit.getOfflinePlayer(username).getUniqueId());
|
|
||||||
if (plots.isEmpty()) {
|
UUID uuid = UUIDHandler.getUUID(username);
|
||||||
|
List<Plot> plots = null;
|
||||||
|
if (uuid!=null) {
|
||||||
|
plots = getPlots(uuid);
|
||||||
|
}
|
||||||
|
if (uuid==null || plots.isEmpty()) {
|
||||||
PlayerFunctions.sendMessage(plr, C.FOUND_NO_PLOTS);
|
PlayerFunctions.sendMessage(plr, C.FOUND_NO_PLOTS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,19 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
PlotBlock[] plotfloor = dpw.TOP_BLOCK;
|
PlotBlock[] plotfloor = dpw.TOP_BLOCK;
|
||||||
PlotBlock[] filling = dpw.TOP_BLOCK;
|
PlotBlock[] filling = dpw.TOP_BLOCK;
|
||||||
|
|
||||||
|
PlotBlock wall = dpw.WALL_BLOCK;
|
||||||
|
PlotBlock wall_filling = dpw.WALL_FILLING;
|
||||||
|
|
||||||
|
Block block = world.getBlockAt(new Location(world, pos1.getBlockX()-1, 1, pos1.getBlockZ()));
|
||||||
|
if (block.getTypeId()!=wall_filling.id || block.getData()!=wall_filling.data) {
|
||||||
|
setWallFilling(world, dpw, plot.id, wall_filling);
|
||||||
|
}
|
||||||
|
|
||||||
|
block = world.getBlockAt(new Location(world, pos1.getBlockX()-1, dpw.WALL_HEIGHT+1, pos1.getBlockZ()));
|
||||||
|
if (block.getTypeId()!=wall.id || block.getData()!=wall.data) {
|
||||||
|
setWall(world, dpw, plot.id, wall_filling);
|
||||||
|
}
|
||||||
|
|
||||||
if ((pos2.getBlockX() - pos1.getBlockX()) < 48) {
|
if ((pos2.getBlockX() - pos1.getBlockX()) < 48) {
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, 1, pos2.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, 1, pos2.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
@ -356,9 +369,8 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setFloor(Player player, PlotWorld plotworld, PlotId plotid, PlotBlock[] blocks) {
|
public boolean setFloor(World world, PlotWorld plotworld, PlotId plotid, PlotBlock[] blocks) {
|
||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World world = player.getWorld();
|
|
||||||
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plotid).add(1, 0, 1);
|
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plotid).add(1, 0, 1);
|
||||||
final Location pos2 = PlotHelper.getPlotTopLoc(world, plotid);
|
final Location pos2 = PlotHelper.getPlotTopLoc(world, plotid);
|
||||||
PlotHelper.setCuboid(world, new Location(world,pos1.getX(),dpw.PLOT_HEIGHT,pos1.getZ()), new Location(world,pos2.getX()+1,dpw.PLOT_HEIGHT+1,pos2.getZ()+1), blocks);
|
PlotHelper.setCuboid(world, new Location(world,pos1.getX(),dpw.PLOT_HEIGHT,pos1.getZ()), new Location(world,pos2.getX()+1,dpw.PLOT_HEIGHT+1,pos2.getZ()+1), blocks);
|
||||||
@ -366,9 +378,8 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setWall(Player player, PlotWorld plotworld, PlotId plotid, PlotBlock plotblock) {
|
public boolean setWallFilling(World w, PlotWorld plotworld, PlotId plotid, PlotBlock plotblock) {
|
||||||
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
World w = player.getWorld();
|
|
||||||
|
|
||||||
Location bottom = PlotHelper.getPlotBottomLoc(w, plotid);
|
Location bottom = PlotHelper.getPlotBottomLoc(w, plotid);
|
||||||
Location top = PlotHelper.getPlotTopLoc(w, plotid);
|
Location top = PlotHelper.getPlotTopLoc(w, plotid);
|
||||||
@ -377,32 +388,67 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
|
|
||||||
Block block;
|
Block block;
|
||||||
|
|
||||||
// TODO use PlotHelper.setSimpleCuboid rather than this for loop
|
|
||||||
|
|
||||||
for (x = bottom.getBlockX(); x < (top.getBlockX() + 1); x++) {
|
|
||||||
z = bottom.getBlockZ();
|
z = bottom.getBlockZ();
|
||||||
|
for (x = bottom.getBlockX(); x < (top.getBlockX() + 1); x++) {
|
||||||
block = w.getBlockAt(x, dpw.ROAD_HEIGHT + 1, z);
|
for (int y = 1; y<= dpw.WALL_HEIGHT; y++) {
|
||||||
|
block = w.getBlockAt(x, y, z);
|
||||||
PlotHelper.setBlock(block, plotblock);
|
PlotHelper.setBlock(block, plotblock);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (z = bottom.getBlockZ(); z < (top.getBlockZ() + 1); z++) {
|
|
||||||
x = top.getBlockX() + 1;
|
x = top.getBlockX() + 1;
|
||||||
|
for (z = bottom.getBlockZ(); z < (top.getBlockZ() + 1); z++) {
|
||||||
block = w.getBlockAt(x, dpw.ROAD_HEIGHT + 1, z);
|
for (int y = 1; y<= dpw.WALL_HEIGHT; y++) {
|
||||||
|
block = w.getBlockAt(x, y, z);
|
||||||
PlotHelper.setBlock(block, plotblock);
|
PlotHelper.setBlock(block, plotblock);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (x = top.getBlockX() + 1; x > (bottom.getBlockX() - 1); x--) {
|
|
||||||
z = top.getBlockZ() + 1;
|
z = top.getBlockZ() + 1;
|
||||||
|
for (x = top.getBlockX() + 1; x > (bottom.getBlockX() - 1); x--) {
|
||||||
block = w.getBlockAt(x, dpw.ROAD_HEIGHT + 1, z);
|
for (int y = 1; y<= dpw.WALL_HEIGHT; y++) {
|
||||||
|
block = w.getBlockAt(x, y, z);
|
||||||
PlotHelper.setBlock(block, plotblock);
|
PlotHelper.setBlock(block, plotblock);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (z = top.getBlockZ() + 1; z > (bottom.getBlockZ() - 1); z--) {
|
|
||||||
x = bottom.getBlockX();
|
x = bottom.getBlockX();
|
||||||
block = w.getBlockAt(x, dpw.ROAD_HEIGHT + 1, z);
|
for (z = top.getBlockZ() + 1; z > (bottom.getBlockZ() - 1); z--) {
|
||||||
|
for (int y = 1; y<= dpw.WALL_HEIGHT; y++) {
|
||||||
|
block = w.getBlockAt(x, y, z);
|
||||||
|
PlotHelper.setBlock(block, plotblock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setWall(World w, PlotWorld plotworld, PlotId plotid, PlotBlock plotblock) {
|
||||||
|
DefaultPlotWorld dpw = (DefaultPlotWorld) plotworld;
|
||||||
|
|
||||||
|
Location bottom = PlotHelper.getPlotBottomLoc(w, plotid);
|
||||||
|
Location top = PlotHelper.getPlotTopLoc(w, plotid);
|
||||||
|
|
||||||
|
int x, z;
|
||||||
|
|
||||||
|
Block block;
|
||||||
|
z = bottom.getBlockZ();
|
||||||
|
for (x = bottom.getBlockX(); x < (top.getBlockX() + 1); x++) {
|
||||||
|
block = w.getBlockAt(x, dpw.WALL_HEIGHT + 1, z);
|
||||||
|
PlotHelper.setBlock(block, plotblock);
|
||||||
|
}
|
||||||
|
x = top.getBlockX() + 1;
|
||||||
|
for (z = bottom.getBlockZ(); z < (top.getBlockZ() + 1); z++) {
|
||||||
|
block = w.getBlockAt(x, dpw.WALL_HEIGHT + 1, z);
|
||||||
|
PlotHelper.setBlock(block, plotblock);
|
||||||
|
}
|
||||||
|
z = top.getBlockZ() + 1;
|
||||||
|
for (x = top.getBlockX() + 1; x > (bottom.getBlockX() - 1); x--) {
|
||||||
|
block = w.getBlockAt(x, dpw.WALL_HEIGHT + 1, z);
|
||||||
|
PlotHelper.setBlock(block, plotblock);
|
||||||
|
}
|
||||||
|
x = bottom.getBlockX();
|
||||||
|
for (z = top.getBlockZ() + 1; z > (bottom.getBlockZ() - 1); z--) {
|
||||||
|
block = w.getBlockAt(x, dpw.WALL_HEIGHT + 1, z);
|
||||||
PlotHelper.setBlock(block, plotblock);
|
PlotHelper.setBlock(block, plotblock);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -412,9 +458,7 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
* Set a plot biome
|
* Set a plot biome
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(Player player, Plot plot, Biome biome) {
|
public boolean setBiome(World world, Plot plot, Biome biome) {
|
||||||
|
|
||||||
World world = player.getWorld();
|
|
||||||
|
|
||||||
int bottomX = PlotHelper.getPlotBottomLoc(world, plot.id).getBlockX() - 1;
|
int bottomX = PlotHelper.getPlotBottomLoc(world, plot.id).getBlockX() - 1;
|
||||||
int topX = PlotHelper.getPlotTopLoc(world, plot.id).getBlockX() + 1;
|
int topX = PlotHelper.getPlotTopLoc(world, plot.id).getBlockX() + 1;
|
||||||
|
@ -161,9 +161,15 @@ public class PlotListener {
|
|||||||
PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
|
PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
|
||||||
Bukkit.getPluginManager().callEvent(callEvent);
|
Bukkit.getPluginManager().callEvent(callEvent);
|
||||||
}
|
}
|
||||||
|
if(plot.settings.getFlag("gamemode") != null) {
|
||||||
player.setGameMode(Bukkit.getDefaultGameMode());
|
player.setGameMode(Bukkit.getDefaultGameMode());
|
||||||
|
}
|
||||||
|
if(plot.settings.getFlag("time") != null) {
|
||||||
player.resetPlayerTime();
|
player.resetPlayerTime();
|
||||||
|
}
|
||||||
|
if(plot.settings.getFlag("weather") != null) {
|
||||||
player.resetPlayerWeather();
|
player.resetPlayerWeather();
|
||||||
|
}
|
||||||
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
|
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user