mirror of
https://github.com/taoneill/war.git
synced 2025-02-01 20:21:19 +01:00
Mapping bugs. Monument bugs still ongoing. Lobby is borked.
This commit is contained in:
parent
40f14a7bb0
commit
1723aae771
@ -379,8 +379,9 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
lobby.initialize();
|
lobby.initialize();
|
||||||
player.sendMessage(war.str("Default lobby created on south side of zone."));
|
player.sendMessage(war.str("Default lobby created on south side of zone."));
|
||||||
}
|
}
|
||||||
player.sendMessage(war.str("Warzone " + warzone.getName() + " initial state changed. Saved " + savedBlocks + " blocks."));
|
|
||||||
WarzoneMapper.save(war, warzone, true);
|
WarzoneMapper.save(war, warzone, true);
|
||||||
|
warzone.initializeZone(); // bring back team spawns etc
|
||||||
|
player.sendMessage(war.str("Warzone " + warzone.getName() + " initial state changed. Saved " + savedBlocks + " blocks."));
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -431,8 +432,12 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
t.getVolume().resetBlocks();
|
t.getVolume().resetBlocks();
|
||||||
}
|
}
|
||||||
for(Monument m : warzone.getMonuments()) {
|
for(Monument m : warzone.getMonuments()) {
|
||||||
m.remove();
|
m.getVolume().resetBlocks();
|
||||||
}
|
}
|
||||||
|
if(warzone.getLobby() != null) {
|
||||||
|
warzone.getLobby().getVolume().resetBlocks();
|
||||||
|
}
|
||||||
|
warzone.getVolume().resetBlocks();
|
||||||
war.getWarzones().remove(warzone);
|
war.getWarzones().remove(warzone);
|
||||||
WarMapper.save(war);
|
WarMapper.save(war);
|
||||||
WarzoneMapper.delete(war, warzone.getName());
|
WarzoneMapper.delete(war, warzone.getName());
|
||||||
@ -509,6 +514,7 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
if(warzone.hasMonument(monumentName)) {
|
if(warzone.hasMonument(monumentName)) {
|
||||||
// move the existing monument
|
// move the existing monument
|
||||||
Monument monument = warzone.getMonument(monumentName);
|
Monument monument = warzone.getMonument(monumentName);
|
||||||
|
monument.getVolume().resetBlocks();
|
||||||
monument.setLocation(player.getLocation());
|
monument.setLocation(player.getLocation());
|
||||||
player.sendMessage(war.str("Monument " + monument.getName() + " was moved."));
|
player.sendMessage(war.str("Monument " + monument.getName() + " was moved."));
|
||||||
} else {
|
} else {
|
||||||
@ -533,7 +539,7 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
Warzone warzone = war.warzone(player.getLocation());
|
Warzone warzone = war.warzone(player.getLocation());
|
||||||
Monument monument = warzone.getMonument(name);
|
Monument monument = warzone.getMonument(name);
|
||||||
if(monument != null) {
|
if(monument != null) {
|
||||||
monument.remove();
|
monument.getVolume().resetBlocks();
|
||||||
warzone.getMonuments().remove(monument);
|
warzone.getMonuments().remove(monument);
|
||||||
WarzoneMapper.save(war, warzone, false);
|
WarzoneMapper.save(war, warzone, false);
|
||||||
player.sendMessage(war.str("Monument " + name + " removed."));
|
player.sendMessage(war.str("Monument " + name + " removed."));
|
||||||
|
@ -25,11 +25,12 @@ public class Monument {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.warzone = warzone;
|
this.warzone = warzone;
|
||||||
volume = new CenteredVolume("name",
|
volume = new CenteredVolume(name,
|
||||||
warzone.getWorld().getBlockAt(location.getBlockX(),
|
warzone.getWorld().getBlockAt(location.getBlockX(),
|
||||||
location.getBlockY() + 2,
|
location.getBlockY() + 2,
|
||||||
location.getBlockZ()),
|
location.getBlockZ()),
|
||||||
7, war, warzone.getWorld());
|
7, war, warzone.getWorld());
|
||||||
|
volume.calculateCorners();
|
||||||
volume.saveBlocks();
|
volume.saveBlocks();
|
||||||
this.addMonumentBlocks();
|
this.addMonumentBlocks();
|
||||||
}
|
}
|
||||||
@ -44,16 +45,16 @@ public class Monument {
|
|||||||
warzone.getWorld().getBlockAt(x, y-1, z).getState().setType(Material.OBSIDIAN);
|
warzone.getWorld().getBlockAt(x, y-1, z).getState().setType(Material.OBSIDIAN);
|
||||||
|
|
||||||
// inner ring
|
// inner ring
|
||||||
warzone.getWorld().getBlockAt(x+1, y-1, z+1).setType(Material.GLOWSTONE);
|
warzone.getWorld().getBlockAt(x+1, y-1, z+1).setType(Material.OBSIDIAN);
|
||||||
warzone.getWorld().getBlockAt(x+1, y-1, z).setType(Material.OBSIDIAN);
|
warzone.getWorld().getBlockAt(x+1, y-1, z).setType(Material.OBSIDIAN);
|
||||||
warzone.getWorld().getBlockAt(x+1, y-1, z-1).setType(Material.GLOWSTONE);
|
warzone.getWorld().getBlockAt(x+1, y-1, z-1).setType(Material.OBSIDIAN);
|
||||||
|
|
||||||
warzone.getWorld().getBlockAt(x, y-1, z+1).setType(Material.OBSIDIAN);
|
warzone.getWorld().getBlockAt(x, y-1, z+1).setType(Material.OBSIDIAN);
|
||||||
warzone.getWorld().getBlockAt(x, y-1, z-1).setType(Material.OBSIDIAN);
|
warzone.getWorld().getBlockAt(x, y-1, z-1).setType(Material.OBSIDIAN);
|
||||||
|
|
||||||
warzone.getWorld().getBlockAt(x-1, y-1, z+1).setType(Material.GLOWSTONE);
|
warzone.getWorld().getBlockAt(x-1, y-1, z+1).setType(Material.OBSIDIAN);
|
||||||
warzone.getWorld().getBlockAt(x-1, y-1, z).setType(Material.OBSIDIAN);
|
warzone.getWorld().getBlockAt(x-1, y-1, z).setType(Material.OBSIDIAN);
|
||||||
warzone.getWorld().getBlockAt(x-1, y-1, z-1).setType(Material.GLOWSTONE);
|
warzone.getWorld().getBlockAt(x-1, y-1, z-1).setType(Material.OBSIDIAN);
|
||||||
|
|
||||||
// outer ring
|
// outer ring
|
||||||
|
|
||||||
@ -129,10 +130,6 @@ public class Monument {
|
|||||||
warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()).setType(Material.OBSIDIAN);
|
warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()).setType(Material.OBSIDIAN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
|
||||||
volume.resetBlocks();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return location;
|
return location;
|
||||||
@ -150,6 +147,7 @@ public class Monument {
|
|||||||
public void setLocation(Location location) {
|
public void setLocation(Location location) {
|
||||||
volume.changeCenter(location);
|
volume.changeCenter(location);
|
||||||
this.addMonumentBlocks();
|
this.addMonumentBlocks();
|
||||||
|
this.location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CenteredVolume getVolume() {
|
public CenteredVolume getVolume() {
|
||||||
|
@ -156,8 +156,9 @@ public class Warzone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Monument monument : monuments) {
|
for(Monument monument : monuments) {
|
||||||
monument.remove();
|
monument.getVolume().resetBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
int saved = volume.saveBlocks();
|
int saved = volume.saveBlocks();
|
||||||
initializeZone(); // bring back stuff
|
initializeZone(); // bring back stuff
|
||||||
return saved;
|
return saved;
|
||||||
@ -193,7 +194,7 @@ public class Warzone {
|
|||||||
|
|
||||||
// reset monuments
|
// reset monuments
|
||||||
for(Monument monument : monuments) {
|
for(Monument monument : monuments) {
|
||||||
monument.remove();
|
monument.getVolume().resetBlocks();
|
||||||
monument.addMonumentBlocks();
|
monument.addMonumentBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class VolumeMapper {
|
|||||||
public static void load(Volume volume, String zoneName, War war, World world) {
|
public static void load(Volume volume, String zoneName, War war, World world) {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
try {
|
try {
|
||||||
if(zoneName.equals("")) in = new BufferedReader(new FileReader(new File("War/volume-" + volume.getName() + ".dat")));
|
if(zoneName.equals("")) in = new BufferedReader(new FileReader(new File("War/volume-" + volume.getName() + ".dat"))); // for the warhub
|
||||||
else in = new BufferedReader(new FileReader(new File("War/warzone-" + zoneName + "/volume-" + volume.getName() + ".dat")));
|
else in = new BufferedReader(new FileReader(new File("War/warzone-" + zoneName + "/volume-" + volume.getName() + ".dat")));
|
||||||
String firstLine = in.readLine();
|
String firstLine = in.readLine();
|
||||||
if(firstLine != null && !firstLine.equals("")) {
|
if(firstLine != null && !firstLine.equals("")) {
|
||||||
@ -74,26 +74,27 @@ public class VolumeMapper {
|
|||||||
for(int k = 0; k < volume.getSizeZ(); k++) {
|
for(int k = 0; k < volume.getSizeZ(); k++) {
|
||||||
String blockLine = in.readLine();
|
String blockLine = in.readLine();
|
||||||
String[] blockSplit = blockLine.split(",");
|
String[] blockSplit = blockLine.split(",");
|
||||||
|
if(blockLine != null && !blockLine.equals("")) {
|
||||||
int typeID = Integer.parseInt(blockSplit[0]);
|
int typeID = Integer.parseInt(blockSplit[0]);
|
||||||
byte data = Byte.parseByte(blockSplit[1]);
|
byte data = Byte.parseByte(blockSplit[1]);
|
||||||
String[] lines = null;
|
String[] lines = null;
|
||||||
if(typeID == Material.SIGN.getID() || typeID == Material.SIGN_POST.getID()) {
|
if(typeID == Material.SIGN.getID() || typeID == Material.SIGN_POST.getID()) {
|
||||||
String signLines = blockSplit[2];
|
String signLines = blockSplit[2];
|
||||||
if(blockSplit.length > 3) {
|
if(blockSplit.length > 3) {
|
||||||
// sign includes commas
|
// sign includes commas
|
||||||
for(int splitI = 3; splitI < blockSplit.length; splitI++) {
|
for(int splitI = 3; splitI < blockSplit.length; splitI++) {
|
||||||
signLines.concat(blockSplit[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];
|
||||||
}
|
}
|
||||||
String[] signLinesSplit = signLines.split("[line]");
|
volume.getBlockInfos()[i][j][k] = new BlockInfo(typeID, data, lines);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,10 +317,14 @@ public class WarzoneMapper {
|
|||||||
for(File file : files) {
|
for(File file : files) {
|
||||||
boolean deletedData = file.delete();
|
boolean deletedData = file.delete();
|
||||||
if(!deletedData) {
|
if(!deletedData) {
|
||||||
war.getLogger().warning(file.getName());
|
war.getLogger().warning("Failed to delete file " + file.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zoneFolder.delete();
|
;
|
||||||
|
boolean deletedData = zoneFolder.delete();
|
||||||
|
if(!deletedData) {
|
||||||
|
war.getLogger().warning("Failed to delete file " + zoneFolder.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ public class Volume {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Block getCornerTwo() {
|
public Block getCornerTwo() {
|
||||||
return cornerOne;
|
return cornerTwo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(Location location) {
|
public boolean contains(Location location) {
|
||||||
|
Loading…
Reference in New Issue
Block a user