mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
Hopefully better looking and working monuments. Finished up missing parts of lobby mapping. Something else I forget. Ready for the new CraftBukkit a a hell of a lot of testing.
This commit is contained in:
parent
81ce4627f0
commit
4222b2eedf
@ -42,6 +42,7 @@ public class WarBlockListener extends BlockListener {
|
||||
for(Team t : teams) {
|
||||
t.teamcast(war.str("Monument " + monument.getName() + " has been captured by team " + team.getName() + "."));
|
||||
}
|
||||
return; // important otherwise cancelled down a few line by isImportantblock
|
||||
} else {
|
||||
player.sendMessage(war.str("You can't capture a monument without team block. Get one from your team spawn."));
|
||||
event.setCancelled(true);
|
||||
|
@ -41,8 +41,7 @@ public class Monument {
|
||||
int z = location.getBlockZ();
|
||||
|
||||
// center
|
||||
warzone.getWorld().getBlockAt(x, y-1, z).getState().setType(Material.AIR);
|
||||
warzone.getWorld().getBlockAt(x, y-2, z).setType(Material.GLOWSTONE);
|
||||
warzone.getWorld().getBlockAt(x, y-1, z).getState().setType(Material.OBSIDIAN);
|
||||
|
||||
// inner ring
|
||||
warzone.getWorld().getBlockAt(x+1, y-1, z+1).setType(Material.GLOWSTONE);
|
||||
@ -58,11 +57,11 @@ public class Monument {
|
||||
|
||||
// outer ring
|
||||
|
||||
warzone.getWorld().getBlockAt(x+2, y-1, z+2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+2, y-1, z+2).setType(Material.GLOWSTONE);
|
||||
warzone.getWorld().getBlockAt(x+2, y-1, z+1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+2, y-1, z).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+2, y-1, z-1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+2, y-1, z-2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+2, y-1, z-2).setType(Material.GLOWSTONE);
|
||||
|
||||
warzone.getWorld().getBlockAt(x-1, y-1, z+2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-1, y-1, z-2).setType(Material.OBSIDIAN);
|
||||
@ -73,22 +72,24 @@ public class Monument {
|
||||
warzone.getWorld().getBlockAt(x+1, y-1, z+2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+1, y-1, z-2).setType(Material.OBSIDIAN);
|
||||
|
||||
warzone.getWorld().getBlockAt(x-2, y-1, z+2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-2, y-1, z+2).setType(Material.GLOWSTONE);
|
||||
warzone.getWorld().getBlockAt(x-2, y-1, z+1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-2, y-1, z).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-2, y-1, z-1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-2, y-1, z-2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-2, y-1, z-2).setType(Material.GLOWSTONE);
|
||||
|
||||
// towers
|
||||
warzone.getWorld().getBlockAt(x-2, y, z-1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-2, y, z-2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-1, y, z-2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x-2, y+1, z-2).setType(Material.OBSIDIAN);
|
||||
// block holder
|
||||
warzone.getWorld().getBlockAt(x, y, z).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x, y, z-1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x, y, z+1).setType(Material.OBSIDIAN);
|
||||
|
||||
warzone.getWorld().getBlockAt(x+2, y, z+1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+2, y, z+2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+1, y, z+2).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x+2, y+1, z+2).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+2, z).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x, y+2, z-1).setType(Material.OBSIDIAN);
|
||||
warzone.getWorld().getBlockAt(x, y+2, z+1).setType(Material.OBSIDIAN);
|
||||
|
||||
}
|
||||
|
||||
public boolean isNear(Location playerLocation) {
|
||||
|
@ -309,7 +309,7 @@ public class Warzone {
|
||||
public boolean isMonumentCenterBlock(Block block) {
|
||||
for(Monument monument : monuments) {
|
||||
int x = monument.getLocation().getBlockX();
|
||||
int y = monument.getLocation().getBlockY() - 1;
|
||||
int y = monument.getLocation().getBlockY() + 1;
|
||||
int z = monument.getLocation().getBlockZ();
|
||||
if(x == block.getX() && y == block.getY() && z == block.getZ()) {
|
||||
return true;
|
||||
@ -321,7 +321,7 @@ public class Warzone {
|
||||
public Monument getMonumentFromCenterBlock(Block block) {
|
||||
for(Monument monument : monuments) {
|
||||
int x = monument.getLocation().getBlockX();
|
||||
int y = monument.getLocation().getBlockY();
|
||||
int y = monument.getLocation().getBlockY() + 1;
|
||||
int z = monument.getLocation().getBlockZ();
|
||||
if(x == block.getX() && y == block.getY() && z == block.getZ()) {
|
||||
return monument;
|
||||
|
@ -54,6 +54,7 @@ public class WarMapper {
|
||||
Warzone zone = WarzoneMapper.load(war, warzoneName, !newWar); // cascade load, only load blocks if warzone exists
|
||||
war.getWarzones().add(zone);
|
||||
zone.getVolume().resetBlocks();
|
||||
zone.getLobby().getVolume().resetBlocks();
|
||||
zone.initializeZone(); // is this wise?
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.BlockFace;
|
||||
import org.bukkit.ItemStack;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -15,7 +16,9 @@ import com.tommytony.war.Monument;
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamMaterials;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.ZoneLobby;
|
||||
import com.tommytony.war.volumes.VerticalVolume;
|
||||
import com.tommytony.war.volumes.Volume;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -147,12 +150,27 @@ public class WarzoneMapper {
|
||||
}
|
||||
}
|
||||
|
||||
// lobby
|
||||
String lobbyStr = warzoneConfig.getString("lobby");
|
||||
BlockFace lobbyFace = null;
|
||||
if(lobbyStr.equals("south")) {
|
||||
lobbyFace = BlockFace.South;
|
||||
} else if(lobbyStr.equals("east")) {
|
||||
lobbyFace = BlockFace.East;
|
||||
} else if(lobbyStr.equals("north")) {
|
||||
lobbyFace = BlockFace.North;
|
||||
} else if(lobbyStr.equals("west")) {
|
||||
lobbyFace = BlockFace.West;
|
||||
}
|
||||
warzone.setLobby(new ZoneLobby(war, warzone, lobbyFace));
|
||||
|
||||
warzoneConfig.close();
|
||||
|
||||
if(loadBlocks && warzone.getNorthwest() != null && warzone.getSoutheast() != null) {
|
||||
|
||||
// zone blocks
|
||||
VerticalVolume zoneVolume = VolumeMapper.loadVerticalVolume(warzone.getName(), "zone", war, warzone.getWorld());
|
||||
warzone.setVolume(zoneVolume);
|
||||
|
||||
// monument blocks
|
||||
for(Monument monument: warzone.getMonuments()) {
|
||||
@ -164,6 +182,10 @@ public class WarzoneMapper {
|
||||
team.setVolume(VolumeMapper.loadVolume(team.getName(), warzone.getName(), war, world));
|
||||
}
|
||||
|
||||
// lobby
|
||||
Volume lobbyVolume = VolumeMapper.loadVolume("lobby", warzone.getName(), war, world);
|
||||
warzone.getLobby().setVolume(lobbyVolume);
|
||||
|
||||
//war.getLogger().info("Loaded warzone " + name + " config and blocks.");
|
||||
} else {
|
||||
//war.getLogger().info("Loaded warzone " + name + " config.");
|
||||
@ -239,6 +261,20 @@ public class WarzoneMapper {
|
||||
monumentsStr += monument.getName() + "," + (int)monumentLoc.getBlockX() + "," + (int)monumentLoc.getBlockY() + "," + (int)monumentLoc.getBlockZ() + ";";
|
||||
}
|
||||
warzoneConfig.setString("monuments", monumentsStr);
|
||||
|
||||
// lobby
|
||||
String lobbyStr = "";
|
||||
if(BlockFace.South == warzone.getLobby().getWall()) {
|
||||
lobbyStr = "south";
|
||||
} else if(BlockFace.East == warzone.getLobby().getWall()) {
|
||||
lobbyStr = "east";
|
||||
} else if(BlockFace.North == warzone.getLobby().getWall()) {
|
||||
lobbyStr = "north";
|
||||
} else if(BlockFace.West == warzone.getLobby().getWall()) {
|
||||
lobbyStr = "west";
|
||||
}
|
||||
warzoneConfig.setString("lobby", lobbyStr);
|
||||
|
||||
warzoneConfig.save();
|
||||
warzoneConfig.close();
|
||||
|
||||
@ -256,6 +292,8 @@ public class WarzoneMapper {
|
||||
for(Team team : teams) {
|
||||
VolumeMapper.save(team.getVolume(), warzone.getName(), war);
|
||||
}
|
||||
|
||||
VolumeMapper.save(warzone.getLobby().getVolume(), warzone.getName(), war);
|
||||
}
|
||||
|
||||
// if(saveBlocks) {
|
||||
|
Loading…
Reference in New Issue
Block a user