mirror of
https://github.com/taoneill/war.git
synced 2024-11-24 03:05:54 +01:00
Totally broken. Factoring out the volume mapping and adding warhubs
This commit is contained in:
parent
f2be251106
commit
e33a19cc4f
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/bukkit"/>
|
||||
|
@ -187,6 +187,13 @@ public class War extends JavaPlugin {
|
||||
return zoneMakerNames;
|
||||
}
|
||||
|
||||
public boolean isZoneMaker(String playerName) {
|
||||
for(String zoneMaker : zoneMakerNames) {
|
||||
if(zoneMaker.equals(playerName)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getDefaultDrawZoneOutline() {
|
||||
return defaultDrawZoneOutline ;
|
||||
}
|
||||
|
@ -201,10 +201,11 @@ public class WarPlayerListener extends PlayerListener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if(war.isZoneMaker(player.getName())) {
|
||||
// Mod commands : /nextbattle
|
||||
|
||||
// /restartbattle
|
||||
else if(command.equals("nextbattle") || command.equals("restartbattle")) {
|
||||
if(command.equals("nextbattle") || command.equals("restartbattle")) {
|
||||
if(!war.inAnyWarzone(player.getLocation())) {
|
||||
player.sendMessage(war.str("Usage: /nextbattle. Resets the zone blocks and all teams' life pools. Must be in warzone."));
|
||||
} else {
|
||||
@ -220,7 +221,6 @@ public class WarPlayerListener extends PlayerListener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
// Warzone maker commands: /setzone, /savezone, /setteam, /setmonument, /resetzone
|
||||
|
||||
// /setzone
|
||||
@ -474,6 +474,7 @@ public class WarPlayerListener extends PlayerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
@ -15,7 +15,7 @@ import com.tommytony.war.volumes.Volume;
|
||||
*/
|
||||
public class Monument {
|
||||
private Location location;
|
||||
private CenteredVolume volume;
|
||||
private Volume volume;
|
||||
|
||||
private Team ownerTeam = null;
|
||||
private final String name;
|
||||
@ -29,7 +29,7 @@ public class Monument {
|
||||
warzone.getWorld().getBlockAt(location.getBlockX(),
|
||||
location.getBlockY() + 2,
|
||||
location.getBlockZ()),
|
||||
7, war, warzone);
|
||||
7, war, warzone.getWorld());
|
||||
volume.saveBlocks();
|
||||
this.addMonumentBlocks();
|
||||
}
|
||||
@ -155,5 +155,8 @@ public class Monument {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public void setVolume(Volume newVolume) {
|
||||
this.volume = newVolume;
|
||||
|
||||
}
|
||||
}
|
||||
|
23
war/src/main/java/com/tommytony/war/WarHub.java
Normal file
23
war/src/main/java/com/tommytony/war/WarHub.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.tommytony.war;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
import com.tommytony.war.volumes.Volume;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
public class WarHub {
|
||||
private final War war;
|
||||
private final World world;
|
||||
private final Location location;
|
||||
private Volume volume;
|
||||
|
||||
public WarHub(War war, World world, Location location) {
|
||||
this.war = war;
|
||||
this.world = world;
|
||||
this.location = location;
|
||||
this.volume = new Volume("warHub", war, warzone);
|
||||
}
|
||||
|
||||
}
|
@ -4,15 +4,17 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Block;
|
||||
import org.bukkit.BlockFace;
|
||||
import org.bukkit.HumanEntity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Player;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
import com.tommytony.war.volumes.CenteredVolume;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tommytony
|
||||
*
|
||||
*/
|
||||
public class ZoneWallGuard {
|
||||
private Player player;
|
||||
private Warzone warzone;
|
||||
|
135
war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java
Normal file
135
war/src/main/java/com/tommytony/war/mappers/VolumeMapper.java
Normal file
@ -0,0 +1,135 @@
|
||||
package com.tommytony.war.mappers;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
import com.tommytony.war.volumes.BlockInfo;
|
||||
import com.tommytony.war.volumes.Volume;
|
||||
|
||||
public class VolumeMapper {
|
||||
public static Volume load(String zoneName, String volumeName, War war, World world) {
|
||||
BufferedReader in = null;
|
||||
Volume volume = null;
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(new File("War/warzone-" + zoneName + "/volume-" + volumeName)));
|
||||
String firstLine = in.readLine();
|
||||
if(firstLine != null && !firstLine.equals("")) {
|
||||
int x1 = Integer.parseInt(in.readLine());
|
||||
int y1 = Integer.parseInt(in.readLine());
|
||||
int z1 = Integer.parseInt(in.readLine());
|
||||
int x2 = Integer.parseInt(in.readLine());
|
||||
int y2 = Integer.parseInt(in.readLine());
|
||||
int z2 = Integer.parseInt(in.readLine());
|
||||
|
||||
volume = new Volume(volumeName, war, world);
|
||||
volume.setCornerOne(world.getBlockAt(x1, y1, z1));
|
||||
volume.setCornerTwo(world.getBlockAt(x2, y2, z2));
|
||||
|
||||
volume.setBlockInfos(new BlockInfo[volume.getSizeX()][volume.getSizeY()][volume.getSizeZ()]);
|
||||
for(int i = 0; i < volume.getSizeX(); i++){
|
||||
for(int j = 0; j < volume.getSizeY(); j++) {
|
||||
for(int k = 0; k < volume.getSizeZ(); k++) {
|
||||
String blockLine = in.readLine();
|
||||
String[] blockSplit = blockLine.split(",");
|
||||
|
||||
int typeID = Integer.parseInt(blockSplit[0]);
|
||||
byte data = Byte.parseByte(blockSplit[1]);
|
||||
String[] lines = null;
|
||||
if(typeID == Material.Sign.getID() || typeID == Material.SignPost.getID()) {
|
||||
String signLines = blockSplit[2];
|
||||
if(blockSplit.length > 3) {
|
||||
// sign includes commas
|
||||
for(int splitI = 3; splitI < blockSplit.length; splitI++) {
|
||||
signLines.concat(blockSplit[splitI]);
|
||||
}
|
||||
}
|
||||
String[] signLinesSplit = signLines.split("[line]");
|
||||
lines = new String[4];
|
||||
lines[0] = signLinesSplit[0];
|
||||
lines[1] = signLinesSplit[1];
|
||||
lines[2] = signLinesSplit[2];
|
||||
lines[3] = signLinesSplit[3];
|
||||
}
|
||||
volume.getBlockInfos()[i][j][k] = new BlockInfo(typeID, data, lines);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to read volume file " + volumeName +
|
||||
" for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(in != null)
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to close file reader for volume " + volumeName +
|
||||
" for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return volume;
|
||||
}
|
||||
|
||||
public static void save(Volume volume, String zoneName, War war) {
|
||||
if(volume.isSaved() && volume.getBlockInfos() != null) {
|
||||
BufferedWriter out = null;
|
||||
try {
|
||||
out = new BufferedWriter(new FileWriter(new File("War/warzone-" + zoneName + "/volume-" + volume.getName() + ".dat")));
|
||||
out.write("corner1"); out.newLine();
|
||||
out.write(volume.getCornerOne().getX()); out.newLine();
|
||||
out.write(volume.getCornerOne().getY()); out.newLine();
|
||||
out.write(volume.getCornerOne().getZ()); out.newLine();
|
||||
out.write("corner2"); out.newLine();
|
||||
out.write(volume.getCornerTwo().getX()); out.newLine();
|
||||
out.write(volume.getCornerTwo().getY()); out.newLine();
|
||||
out.write(volume.getCornerTwo().getZ()); out.newLine();
|
||||
|
||||
for(int i = 0; i < volume.getSizeX(); i++){
|
||||
for(int j = 0; j < volume.getSizeY(); j++) {
|
||||
for(int k = 0; k < volume.getSizeZ(); k++) {
|
||||
BlockInfo info = volume.getBlockInfos()[i][j][k];
|
||||
if(info == null) {
|
||||
out.write("0,0,"); out.newLine();
|
||||
} else {
|
||||
if(info.getType() == Material.Sign || info.getType() == Material.SignPost) {
|
||||
String[] lines = info.getSignLines();
|
||||
out.write(info.getTypeID() + "," + info.getData() + "," + lines[0] + "[line]" + lines[1]
|
||||
+ "[line]" + lines[2] + "[line]"+ lines[3]);
|
||||
|
||||
} else {
|
||||
out.write(info.getTypeID() + "," + info.getData() + ",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to write volume file " + zoneName +
|
||||
" for warzone " + volume.getName() + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
if(out != null)
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to close file writer for volume " + volume.getName() +
|
||||
" for warzone " + zoneName + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -16,6 +16,7 @@ import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamMaterials;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.volumes.VerticalVolume;
|
||||
import com.tommytony.war.volumes.Volume;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -26,7 +27,7 @@ public class WarzoneMapper {
|
||||
|
||||
public static Warzone load(War war, String name, boolean loadBlocks) {
|
||||
//war.getLogger().info("Loading warzone " + name + " config and blocks...");
|
||||
PropertiesFile warzoneConfig = new PropertiesFile(war.getName() + "/warzone-" + name + ".txt");
|
||||
PropertiesFile warzoneConfig = new PropertiesFile(war.getName() + "/warzone-" + name + "/warzone-" + name + ".txt");
|
||||
try {
|
||||
warzoneConfig.load();
|
||||
} catch (IOException e) {
|
||||
@ -152,17 +153,11 @@ public class WarzoneMapper {
|
||||
if(loadBlocks && warzone.getNorthwest() != null && warzone.getSoutheast() != null) {
|
||||
|
||||
// zone blocks
|
||||
VerticalVolume zoneVolume = new VerticalVolume("zone", war, warzone);
|
||||
try {
|
||||
zoneVolume.fromDisk();
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to read volume file " + warzone.getVolume().getName() +
|
||||
" for warzone " + warzone.getName() + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
VerticalVolume zoneVolume = VolumeMapper.load(warzone.getName(), "zone", war, warzone.getWorld());
|
||||
|
||||
// monument blocks
|
||||
for(Monument monument: warzone.getMonuments()) {
|
||||
monument.setVolume(VolumeMapper.load(warzone.getName(), monument.getName(), war, world));
|
||||
try {
|
||||
monument.getVolume().fromDisk();
|
||||
} catch (IOException e) {
|
||||
@ -193,7 +188,7 @@ public class WarzoneMapper {
|
||||
}
|
||||
|
||||
public static void save(War war, Warzone warzone, boolean saveBlocks) {
|
||||
PropertiesFile warzoneConfig = new PropertiesFile(war.getName() + "/warzone-" + warzone.getName() + ".txt");
|
||||
PropertiesFile warzoneConfig = new PropertiesFile(war.getName() + "/warzone-" + warzone.getName() + "/warzone-" + warzone.getName() + ".txt");
|
||||
//war.getLogger().info("Saving warzone " + warzone.getName() + "...");
|
||||
|
||||
// name
|
||||
@ -264,34 +259,16 @@ public class WarzoneMapper {
|
||||
if(saveBlocks) {
|
||||
(new File(war.getName()+"/"+warzone.getName())).mkdir();
|
||||
// zone blocks
|
||||
try {
|
||||
warzone.getVolume().toDisk();
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to write volume file " + warzone.getVolume().getName() +
|
||||
" for warzone " + warzone.getName() + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
VolumeMapper.save(warzone.getVolume(), "zone", war);
|
||||
|
||||
// monument blocks
|
||||
for(Monument monument: monuments) {
|
||||
try {
|
||||
monument.getVolume().toDisk();
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to write volume file " + warzone.getVolume().getName() +
|
||||
" for warzone " + warzone.getName() + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
VolumeMapper.save(monument.getVolume(), warzone.getName(), war);
|
||||
}
|
||||
|
||||
// team spawn blocks
|
||||
for(Team team : teams) {
|
||||
try {
|
||||
team.getVolume().toDisk();
|
||||
} catch (IOException e) {
|
||||
war.getLogger().warning("Failed to write volume file " + warzone.getVolume().getName() +
|
||||
" for warzone " + warzone.getName() + ". " + e.getClass().getName() + " " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
VolumeMapper.save(team.getVolume(), warzone.getName(), war);
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,12 +280,6 @@ public class WarzoneMapper {
|
||||
}
|
||||
|
||||
public static void delete(War war, String name) {
|
||||
File warzoneConfig = new File(war.getName() + "/warzone-" + name + ".txt");
|
||||
boolean deletedConfig = warzoneConfig.delete();
|
||||
if(!deletedConfig) {
|
||||
war.getLogger().warning("Failed to delete file " + war.getName() + "/warzone-"+name+".txt");
|
||||
}
|
||||
|
||||
File zoneFolder = new File(war.getName() + "/warzone-" + name);
|
||||
File[] files = zoneFolder.listFiles();
|
||||
for(File file : files) {
|
||||
|
@ -2,24 +2,25 @@ package com.tommytony.war.volumes;
|
||||
|
||||
import org.bukkit.Block;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
import com.tommytony.war.Warzone;
|
||||
|
||||
public class CenteredVolume extends Volume {
|
||||
|
||||
private Block center;
|
||||
private int sideSize = -1;
|
||||
private final World world;
|
||||
|
||||
public CenteredVolume(String name, Block center, int sideSize, War war, Warzone warzone) {
|
||||
super(name, war, warzone);
|
||||
public CenteredVolume(String name, Block center, int sideSize, War war, World world) {
|
||||
super(name, war, world);
|
||||
this.world = world;
|
||||
setCenter(center);
|
||||
setSideSize(sideSize);
|
||||
}
|
||||
|
||||
public void changeCenter(Location newCenter) {
|
||||
changeCenter(getWarzone().getWorld().getBlockAt(newCenter.getBlockX(),
|
||||
changeCenter(world.getBlockAt(newCenter.getBlockX(),
|
||||
newCenter.getBlockY(),
|
||||
newCenter.getBlockZ()),
|
||||
this.sideSize);
|
||||
@ -42,7 +43,7 @@ public class CenteredVolume extends Volume {
|
||||
int x = center.getX() + topHalfOfSide;
|
||||
int y = center.getY() + topHalfOfSide;
|
||||
int z = center.getZ() + topHalfOfSide;
|
||||
Block cornerOne = getWarzone().getWorld().getBlockAt(x, y, z);
|
||||
Block cornerOne = world.getBlockAt(x, y, z);
|
||||
setCornerOne(cornerOne);
|
||||
|
||||
if(sideSize % 2 == 0) { // not a real center, bottom half is larger by 1
|
||||
@ -50,13 +51,13 @@ public class CenteredVolume extends Volume {
|
||||
x = center.getX() - bottomHalfOfSide;
|
||||
y = center.getY() - bottomHalfOfSide;
|
||||
z = center.getZ() - bottomHalfOfSide;
|
||||
Block cornerTwo = getWarzone().getWorld().getBlockAt(x, y, z);
|
||||
Block cornerTwo = world.getBlockAt(x, y, z);
|
||||
setCornerTwo(cornerTwo);
|
||||
} else {
|
||||
x = center.getX() - topHalfOfSide;
|
||||
y = center.getY() - topHalfOfSide;
|
||||
z = center.getZ() - topHalfOfSide;
|
||||
Block cornerTwo = getWarzone().getWorld().getBlockAt(x, y, z);
|
||||
Block cornerTwo = world.getBlockAt(x, y, z);
|
||||
setCornerTwo(cornerTwo);
|
||||
}
|
||||
}
|
||||
|
@ -3,17 +3,16 @@ package com.tommytony.war.volumes;
|
||||
import org.bukkit.Block;
|
||||
import org.bukkit.BlockFace;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
import com.tommytony.war.Warzone;
|
||||
|
||||
public class VerticalVolume extends Volume{
|
||||
|
||||
public VerticalVolume(String name, War war, Warzone warzone) {
|
||||
super(name, war, warzone);
|
||||
public VerticalVolume(String name, War war, World world) {
|
||||
super(name, war, world);
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,17 +32,16 @@ import com.tommytony.war.Warzone;
|
||||
public class Volume {
|
||||
private final String name;
|
||||
private final World world;
|
||||
private final Warzone warzone;
|
||||
//private final Warzone warzone;
|
||||
private Block cornerOne;
|
||||
private Block cornerTwo;
|
||||
private BlockInfo[][][] blockInfos = null;
|
||||
private final War war;
|
||||
|
||||
public Volume(String name, War war, Warzone warzone) {
|
||||
public Volume(String name, War war, World world) {
|
||||
this.name = name;
|
||||
this.war = war;
|
||||
this.warzone = warzone;
|
||||
this.world = warzone.getWorld();
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
@ -280,100 +279,13 @@ public class Volume {
|
||||
// }
|
||||
// }
|
||||
|
||||
public void fromDisk() throws IOException {
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(new File(war.getName() + "/warzone-" + warzone.getName() + "/" + name)));
|
||||
;
|
||||
String firstLine = in.readLine();
|
||||
if(firstLine != null && !firstLine.equals("")) {
|
||||
int x1 = Integer.parseInt(in.readLine());
|
||||
int y1 = Integer.parseInt(in.readLine());
|
||||
int z1 = Integer.parseInt(in.readLine());
|
||||
int x2 = Integer.parseInt(in.readLine());
|
||||
int y2 = Integer.parseInt(in.readLine());
|
||||
int z2 = Integer.parseInt(in.readLine());
|
||||
cornerOne = getWorld().getBlockAt(x1, y1, z1);
|
||||
cornerTwo = getWorld().getBlockAt(x2, y2, z2);
|
||||
|
||||
setBlockInfos(new BlockInfo[getSizeX()][getSizeY()][getSizeZ()]);
|
||||
for(int i = 0; i < getSizeX(); i++){
|
||||
for(int j = 0; j < getSizeY(); j++) {
|
||||
for(int k = 0; k < getSizeZ(); k++) {
|
||||
String blockLine = in.readLine();
|
||||
String[] blockSplit = blockLine.split(",");
|
||||
|
||||
int typeID = Integer.parseInt(blockSplit[0]);
|
||||
byte data = Byte.parseByte(blockSplit[1]);
|
||||
String[] lines = null;
|
||||
if(typeID == Material.Sign.getID() || typeID == Material.SignPost.getID()) {
|
||||
String signLines = blockSplit[2];
|
||||
if(blockSplit.length > 3) {
|
||||
// sign includes commas
|
||||
for(int splitI = 3; splitI < blockSplit.length; splitI++) {
|
||||
signLines.concat(blockSplit[splitI]);
|
||||
}
|
||||
}
|
||||
String[] signLinesSplit = signLines.split("[line]");
|
||||
lines = new String[4];
|
||||
lines[0] = signLinesSplit[0];
|
||||
lines[1] = signLinesSplit[1];
|
||||
lines[2] = signLinesSplit[2];
|
||||
lines[3] = signLinesSplit[3];
|
||||
}
|
||||
getBlockInfos()[i][j][k] = new BlockInfo(typeID, data, lines);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if(in != null) in.close();
|
||||
}
|
||||
public Block getCornerOne() {
|
||||
return cornerOne;
|
||||
}
|
||||
|
||||
public void toDisk() throws IOException {
|
||||
if(isSaved() && getBlockInfos() != null) {
|
||||
BufferedWriter out = null;
|
||||
try {
|
||||
out = new BufferedWriter(new FileWriter(new File(war.getName() + "/warzone-" + warzone.getName() + "/" + name)));
|
||||
out.write("corner1"); out.newLine();
|
||||
out.write(cornerOne.getX()); out.newLine();
|
||||
out.write(cornerOne.getY()); out.newLine();
|
||||
out.write(cornerOne.getZ()); out.newLine();
|
||||
out.write("corner2"); out.newLine();
|
||||
out.write(cornerTwo.getX()); out.newLine();
|
||||
out.write(cornerTwo.getY()); out.newLine();
|
||||
out.write(cornerTwo.getZ()); out.newLine();
|
||||
|
||||
for(int i = 0; i < getSizeX(); i++){
|
||||
for(int j = 0; j < getSizeY(); j++) {
|
||||
for(int k = 0; k < getSizeZ(); k++) {
|
||||
BlockInfo info = getBlockInfos()[i][j][k];
|
||||
if(info == null) {
|
||||
out.write("0,0,"); out.newLine();
|
||||
} else {
|
||||
if(info.getType() == Material.Sign || info.getType() == Material.SignPost) {
|
||||
String[] lines = info.getSignLines();
|
||||
out.write(info.getTypeID() + "," + info.getData() + "," + lines[0] + "[line]" + lines[1] + "[line]" + lines[2] + "[line]"+ lines[3]);
|
||||
|
||||
} else {
|
||||
out.write(info.getTypeID() + "," + info.getData() + ",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if(out != null) out.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Warzone getWarzone() {
|
||||
return warzone;
|
||||
public Block getCornerTwo() {
|
||||
return cornerOne;
|
||||
}
|
||||
|
||||
public boolean contains(Location location) {
|
||||
|
Loading…
Reference in New Issue
Block a user