Warzone is not outlined in glass. Moved Plugin and Listener classes to bukkit.tommytony.war package.

This commit is contained in:
taoneill 2011-01-11 17:25:46 -05:00
parent 61ecb3b7ba
commit 31bd3523e1
15 changed files with 470 additions and 340 deletions

View File

@ -1,4 +1,4 @@
package com.tommytony.war;
package bukkit.tommytony.war;
import org.bukkit.*;
import org.bukkit.event.Event;
@ -8,6 +8,8 @@ import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.tommytony.war.Team;
import com.tommytony.war.Warzone;
import com.tommytony.war.mappers.WarMapper;
import java.io.File;
@ -16,6 +18,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.logging.Logger;
/**
*
* @author tommytony
*
*/
public class War extends JavaPlugin {
public War(PluginLoader pluginLoader, Server instance,

View File

@ -1,4 +1,4 @@
package com.tommytony.war;
package bukkit.tommytony.war;
import java.util.List;
@ -9,7 +9,15 @@ import org.bukkit.event.block.BlockDamagedEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlacedEvent;
import com.tommytony.war.Monument;
import com.tommytony.war.Team;
import com.tommytony.war.Warzone;
/**
*
* @author tommytony
*
*/
public class WarBlockListener extends BlockListener {
private War war;
@ -34,9 +42,13 @@ public class WarBlockListener extends BlockListener {
for(Team t : teams) {
t.teamcast(war.str("Monument " + monument.getName() + " has been captured by team " + team.getName() + "."));
}
} else {
player.sendMessage(war.str("You can't capture a monument without team block. Get one from your team spawn."));
event.setCancelled(true);
}
} else {
player.sendMessage(war.str("You can't capture a monument without team block. Get one from your team spawn."));
}
if(zone.isImportantBlock(block)){
player.sendMessage(war.str("Can't build here."));
event.setCancelled(true);
}
}
@ -53,21 +65,18 @@ public class WarBlockListener extends BlockListener {
// can't actually destroy blocks in a warzone if not part of a team
player.sendMessage(war.str("Can't destroy part of a warzone if you're not in a team."));
event.setCancelled(true);
}
if(warzone != null && warzone.isImportantBlock(block)) {
} else if(warzone != null && warzone.isImportantBlock(block)) {
if(team != null && team.getVolume().contains(block)) {
if(player.getInventory().contains(team.getMaterial())) {
player.sendMessage(war.str("You already have a " + team.getName() + " block."));
event.setCancelled(true);
}
// let team members loot one block the spawn for monument captures
} else {
player.sendMessage(war.str("Can't destroy this."));
event.setCancelled(true);
}
}
if(team != null && block != null && warzone != null
} else if(team != null && block != null && warzone != null
&& warzone.isMonumentCenterBlock(block)
){
Monument monument = warzone.getMonumentFromCenterBlock(block);

View File

@ -1,4 +1,4 @@
package com.tommytony.war;
package bukkit.tommytony.war;
import java.util.List;
import java.util.logging.Level;
@ -9,7 +9,14 @@ import org.bukkit.event.entity.EntityDamagedByBlockEvent;
import org.bukkit.event.entity.EntityDamagedByEntityEvent;
import org.bukkit.event.entity.EntityListener;
import com.tommytony.war.Team;
import com.tommytony.war.Warzone;
/**
*
* @author tommytony
*
*/
public class WarEntityListener extends EntityListener {
private final War war;
@ -111,7 +118,9 @@ public class WarEntityListener extends EntityListener {
t.resetSign();
}
}
zone.resetState();
zone.endRound();
zone.getVolume().resetBlocks();
zone.initializeZone();
roundOver = true;
} else {
team.setRemainingTickets(remaining - 1);

View File

@ -1,4 +1,4 @@
package com.tommytony.war;
package bukkit.tommytony.war;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
@ -11,11 +11,19 @@ import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerMoveEvent;
import com.tommytony.war.Monument;
import com.tommytony.war.Team;
import com.tommytony.war.TeamMaterials;
import com.tommytony.war.Warzone;
import com.tommytony.war.mappers.WarMapper;
import com.tommytony.war.mappers.WarzoneMapper;
/**
*
* @author tommytony
*
*/
public class WarPlayerListener extends PlayerListener {
private final War war;
@ -53,7 +61,7 @@ public class WarPlayerListener extends PlayerListener {
arguments[i-1] = split[i];
}
} else {
command = command.substring(1, command.length()-1);
command = command.substring(1, command.length());
arguments = new String[split.length - 1];
for(int i = 1; i <= arguments.length; i++) {
arguments[i-1] = split[i];
@ -63,7 +71,7 @@ public class WarPlayerListener extends PlayerListener {
// Player commands: /warzones, /warzone, /teams, /join, /leave
// warzones
if(command.equals("/warzones")){
if(command.equals("zones") || command.equals("warzones")){
String warzonesMessage = "Warzones: ";
if(war.getWarzones().isEmpty()){
@ -79,13 +87,13 @@ public class WarPlayerListener extends PlayerListener {
}
warzonesMessage += playerTotal + " players) ";
}
player.sendMessage(war.str(warzonesMessage + " Use /warzone <zone-name> to " +
player.sendMessage(war.str(warzonesMessage + " Use /zone <zone-name> to " +
"teleport to a warzone. "));
event.setCancelled(true);
}
// warzone
else if(command.equals("/zone") || command.equals("/warzone")) {
else if(command.equals("zone") || command.equals("warzone")) {
if(arguments.length < 1) {
player.sendMessage(war.str("Usage: /zone <warzone-name>."));
} else {
@ -104,7 +112,7 @@ public class WarPlayerListener extends PlayerListener {
}
// /teams
else if(command.equals("/teams")){
else if(command.equals("teams")){
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /teams. " +
"Must be in a warzone (try /warzones and /warzone)."));
@ -115,7 +123,7 @@ public class WarPlayerListener extends PlayerListener {
}
// /join <teamname>
else if(command.equals("/join")) {
else if(command.equals("join")) {
if(arguments.length < 1 || !war.inAnyWarzone(player.getLocation())
|| (arguments.length > 0 && TeamMaterials.teamMaterialFromString(arguments[0]) == null)) {
player.sendMessage(war.str("Usage: /join <diamond/iron/gold/d/i/g>." +
@ -160,7 +168,7 @@ public class WarPlayerListener extends PlayerListener {
}
// /leave
else if(command.equals("/leave")) {
else if(command.equals("leave")) {
if(!war.inAnyWarzone(player.getLocation()) || war.getPlayerTeam(player.getName()) == null) {
player.sendMessage(war.str("Usage: /leave. " +
"Must be in a team already."));
@ -177,7 +185,7 @@ public class WarPlayerListener extends PlayerListener {
// /team <msg>
else if(command.equals("/team")) {
else if(command.equals("team")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /team <message>. " +
"Sends a message only to your teammates."));
@ -196,7 +204,7 @@ public class WarPlayerListener extends PlayerListener {
// Mod commands : /nextbattle
// /restartbattle
else if(command.equals("/nextbattle") || command.equals("/restartbattle")) {
else 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 {
@ -204,17 +212,166 @@ public class WarPlayerListener extends PlayerListener {
for(Team team: warzone.getTeams()) {
team.teamcast(war.str("The battle was interrupted. " + getAllTeamsMsg(player) + " Resetting warzone " + warzone.getName() + " and life pools..."));
}
int resetBlocks = warzone.resetState();
int resetBlocks = warzone.getVolume().resetBlocks();
warzone.initializeZone();
player.sendMessage(war.str("Warzone reset. " + resetBlocks + " blocks reset."));
war.getLogger().info(resetBlocks + " blocks reset in warzone " + warzone.getName() + ".");
}
event.setCancelled(true);
}
// Warzone maker commands: /setzone, /savezone, /setteam, /setmonument, /resetzone
// /setzone
else if(command.equals("setzone") || command.equals("setwarzone")) {
if(arguments.length < 2 || arguments.length > 2
|| (arguments.length == 2 && (!arguments[1].equals("southeast") && !arguments[1].equals("northwest")
&& !arguments[1].equals("se") && !arguments[1].equals("nw")))) {
player.sendMessage(war.str("Usage: /setzone <warzone-name> <'southeast'/'northwest'/'se'/'nw'>. " +
"Defines the battleground boundary. " +
"The warzone is reset at the start of every battle. " +
"This command overwrites any previously saved blocks " +
"(i.e. make sure you reset with /restartbattle " +
"or /resetwarzone before changing the boundary). "));
} else {
Warzone warzone = war.findWarzone(arguments[0]);
if(warzone == null) {
// create the warzone
warzone = new Warzone(war, player.getLocation().getWorld(), arguments[0]);
war.addWarzone(warzone);
WarMapper.save(war);
if(arguments[1].equals("northwest") || arguments[1].equals("nw")) {
warzone.setNorthwest(player.getLocation());
player.sendMessage(war.str("Warzone " + warzone.getName() + " added. Northwesternmost point set at x="
+ (int)warzone.getNorthwest().getBlockX() + " z=" + (int)warzone.getNorthwest().getBlockZ() + "."));
} else {
warzone.setSoutheast(player.getLocation());
player.sendMessage(war.str("Warzone " + warzone.getName() + " added. Southeasternmost point set at x="
+ (int)warzone.getSoutheast().getBlockX() + " z=" + (int)warzone.getSoutheast().getBlockZ() + "."));
}
} else {
String message = "";
if(arguments[1].equals("northwest") || arguments[1].equals("nw")) {
int reset = warzone.getVolume().resetBlocks();
warzone.setNorthwest(player.getLocation());
warzone.saveState();
warzone.initializeZone();
message += "Northwesternmost point set at x=" + (int)warzone.getNorthwest().getBlockX()
+ " z=" + (int)warzone.getNorthwest().getBlockZ() + " on warzone " + warzone.getName() + ". " +
reset + " blocks reset. New zone saved.";
} else {
int reset = warzone.getVolume().resetBlocks();
warzone.setSoutheast(player.getLocation());
warzone.saveState();
warzone.initializeZone();
message += "Southeasternmost point set at x=" + (int)warzone.getSoutheast().getBlockX()
+ " z=" + (int)warzone.getSoutheast().getBlockZ() + " on warzone " + warzone.getName() + ". " +
reset + " blocks reset. New zone saved.";
}
if(warzone.getNorthwest() == null) {
message += " Still missing northwesternmost point.";
}
if(warzone.getSoutheast() == null) {
message += " Still missing southeasternmost point.";
}
if(warzone.getNorthwest() != null && warzone.getSoutheast() != null) {
if(warzone.ready()) {
message += " Warzone " + warzone.getName() + " almost ready. Use /setteam while inside the warzone to create new teams. Make sure to use /savezone to " +
"set the warzone teleport point and initial state.";
} else if (warzone.tooSmall()) {
message += " Warzone " + warzone.getName() + " is too small. Min north-south size: 20. Min east-west size: 20.";
} else if (warzone.tooBig()) {
message += " Warzone " + warzone.getName() + " is too Big. Max north-south size: 1000. Max east-west size: 1000.";
}
}
player.sendMessage(war.str(message));
}
WarzoneMapper.save(war, warzone, false);
}
event.setCancelled(true);
}
// /savewarzone
else if(command.equals("savezone") || command.equals("savewarzone")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /savezone. Must be in warzone. " +
"Changes the warzone state loaded at the beginning of every battle. " +
"Also sets the teleport point for this warzone where you're standing." +
"(i.e. make sure to use /zone or the warzone tp point will change). " +
"Just like /setzone, this command overwrites any previously saved blocks " +
"(i.e. make sure you reset with /restartbattle " +
"or /resetzone before changing start state). "));
} else {
Warzone warzone = war.warzone(player.getLocation());
int savedBlocks = warzone.saveState();
warzone.setTeleport(player.getLocation());
player.sendMessage(war.str("Warzone " + warzone.getName() + " initial state and teleport location changed. Saved " + savedBlocks + " blocks."));
WarzoneMapper.save(war, warzone, true);
}
event.setCancelled(true);
}
// /resetwarzone
else if(command.equals("resetzone") || command.equals("resetwarzone")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /resetzone pool=10. Reloads the zone. All named parameter are optional. Defaults: pool=7 maxScore=-1 (infinite). Must be in warzone."));
} else {
Warzone warzone = war.warzone(player.getLocation());
int resetBlocks = warzone.getVolume().resetBlocks();
warzone.initializeZone();
for(Team team: warzone.getTeams()) {
team.teamcast(war.str("The war has ended. " + getAllTeamsMsg(player) + " Resetting warzone " + warzone.getName() + " and teams..."));
for(Player p : team.getPlayers()) {
p.teleportTo(warzone.getTeleport());
warzone.restorePlayerInventory(p);
player.sendMessage(war.str("You have left the warzone. Your inventory has (hopefully) been restored."));
}
}
war.getWarzones().remove(warzone);
Warzone resetWarzone = WarzoneMapper.load(war, warzone.getName(), true);
war.getWarzones().add(resetWarzone);
if(arguments.length > 0) {
for(String arg : arguments) {
if(arg.startsWith("pool=")){
int overrideLifepool = Integer.parseInt(arg.substring(5));
resetWarzone.setLifePool(overrideLifepool);
}
}
}
resetWarzone.initializeZone();
player.sendMessage(war.str("Warzone and teams reset. " + resetBlocks + " blocks reset."));
war.getLogger().info(resetBlocks + " blocks reset in warzone " + warzone.getName() + ".");
}
event.setCancelled(true);
}
// /deletewarzone
else if(command.equals("deletezone") || command.equals("deletewarzone")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /deletewarzone." +
" Deletes the warzone. " +
"Must be in the warzone (try /warzones and /warzone). "));
} else {
Warzone warzone = war.warzone(player.getLocation());
for(Team t : warzone.getTeams()) {
t.getVolume().resetBlocks();
}
for(Monument m : warzone.getMonuments()) {
m.remove();
}
war.getWarzones().remove(warzone);
WarMapper.save(war);
WarzoneMapper.delete(war, warzone.getName());
player.sendMessage(war.str("Warzone " + warzone.getName() + " removed."));
}
event.setCancelled(true);
}
// /setteam <diamond/iron/gold/d/i/g>
else if(command.equals("/setteam") || command.equals("/newteam") || command.equals("/teamspawn")) {
else if(command.equals("setteam") || command.equals("newteam") || command.equals("teamspawn")) {
if(arguments.length < 1 || !war.inAnyWarzone(player.getLocation())
|| (arguments.length > 0 && TeamMaterials.teamMaterialFromString(arguments[0]) == null)) {
player.sendMessage(war.str("Usage: /setteam <diamond/iron/gold/d/i/g>." +
@ -246,7 +403,7 @@ public class WarPlayerListener extends PlayerListener {
}
// /deleteteam <teamname>
else if(command.equals("/deleteteam")) {
else if(command.equals("deleteteam")) {
if(arguments.length < 1 || !war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /deleteteam <team-name>." +
" Deletes the team and its spawn. " +
@ -273,149 +430,13 @@ public class WarPlayerListener extends PlayerListener {
event.setCancelled(true);
}
// /setwarzone
else if(command.equals("/setzone") || command.equals("/setwarzone")) {
if(arguments.length < 2 || arguments.length > 2
|| (arguments.length == 2 && (!arguments[1].equals("southeast") && !arguments[1].equals("northwest")
&& !arguments[1].equals("se") && !arguments[1].equals("nw")))) {
player.sendMessage(war.str("Usage: /setzone <warzone-name> <'southeast'/'northwest'/'se'/'nw'>. " +
"Defines the battleground boundary. " +
"The warzone is reset at the start of every battle. " +
"This command overwrites any previously saved blocks " +
"(i.e. make sure you reset with /restartbattle " +
"or /resetwarzone before changing the boundary). "));
} else {
Warzone warzone = war.findWarzone(arguments[0]);
if(warzone == null) {
// create the warzone
warzone = new Warzone(war, player.getLocation().getWorld(), arguments[0]);
war.addWarzone(warzone);
WarMapper.save(war);
if(arguments[1].equals("northwest") || arguments[1].equals("nw")) {
warzone.setNorthwest(player.getLocation());
player.sendMessage(war.str("Warzone " + warzone.getName() + " added. Northwesternmost point set at x="
+ (int)warzone.getNorthwest().getBlockX() + " z=" + (int)warzone.getNorthwest().getBlockZ() + "."));
} else {
warzone.setSoutheast(player.getLocation());
player.sendMessage(war.str("Warzone " + warzone.getName() + " added. Southeasternmost point set at x="
+ (int)warzone.getSoutheast().getBlockX() + " z=" + (int)warzone.getSoutheast().getBlockZ() + "."));
}
} else {
String message = "";
if(arguments[1].equals("northwest") || arguments[1].equals("nw")) {
warzone.setNorthwest(player.getLocation());
message += "Northwesternmost point set at x=" + (int)warzone.getNorthwest().getBlockX()
+ " z=" + (int)warzone.getNorthwest().getBlockZ() + " on warzone " + warzone.getName() + ".";
} else {
warzone.setSoutheast(player.getLocation());
message += "Southeasternmost point set at x=" + (int)warzone.getSoutheast().getBlockX()
+ " z=" + (int)warzone.getSoutheast().getBlockZ() + " on warzone " + warzone.getName() + ".";
}
if(warzone.getNorthwest() == null) {
message += " Still missing northwesternmost point.";
}
if(warzone.getSoutheast() == null) {
message += " Still missing southeasternmost point.";
}
if(warzone.getNorthwest() != null && warzone.getSoutheast() != null) {
if(warzone.ready()) {
message += " Warzone " + warzone.getName() + " almost ready. Use /setteam while inside the warzone to create new teams. Make sure to use /savezone to " +
"set the warzone teleport point and initial state.";
} else if (warzone.tooSmall()) {
message += " Warzone " + warzone.getName() + " is too small. Min north-south size: 20. Min east-west size: 20.";
} else if (warzone.tooBig()) {
message += " Warzone " + warzone.getName() + " is too Big. Max north-south size: 1000. Max east-west size: 1000.";
}
}
player.sendMessage(war.str(message));
}
WarzoneMapper.save(war, warzone, false);
}
event.setCancelled(true);
}
// /savewarzone
else if(command.equals("/savezone") || command.equals("/savewarzone")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /savezone. Must be in warzone. " +
"Changes the warzone state loaded at the beginning of every battle. " +
"Also sets the teleport point for this warzone where you're standing." +
"(i.e. make sure to use /zone or the warzone tp point will change). " +
"Just like /setzone, this command overwrites any previously saved blocks " +
"(i.e. make sure you reset with /restartbattle " +
"or /resetzone before changing start state). "));
} else {
Warzone warzone = war.warzone(player.getLocation());
int savedBlocks = warzone.saveState();
warzone.setTeleport(player.getLocation());
player.sendMessage(war.str("Warzone " + warzone.getName() + " initial state and teleport location changed. Saved " + savedBlocks + " blocks."));
WarzoneMapper.save(war, warzone, true);
}
event.setCancelled(true);
}
// /resetwarzone
else if(command.equals("/resetzone") || command.equals("/resetwarzone")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /resetzone pool=10 maxScore=5. Reloads the zone. All named parameter are optional. Defaults: pool=7 maxScore=-1 (infinite). Must be in warzone."));
} else {
Warzone warzone = war.warzone(player.getLocation());
int resetBlocks = warzone.resetState();
for(Team team: warzone.getTeams()) {
team.teamcast(war.str("The war has ended. " + getAllTeamsMsg(player) + " Resetting warzone " + warzone.getName() + " and teams..."));
for(Player p : team.getPlayers()) {
p.teleportTo(warzone.getTeleport());
warzone.restorePlayerInventory(p);
player.sendMessage(war.str("You have left the warzone. Your inventory has (hopefully) been restored."));
}
}
war.getWarzones().remove(warzone);
Warzone resetWarzone = WarzoneMapper.load(war, warzone.getName(), true);
war.getWarzones().add(resetWarzone);
if(split.length > 1) {
int overrideLifepool = Integer.parseInt(split[1]);
resetWarzone.setLifePool(overrideLifepool);
}
resetWarzone.resetState();
player.sendMessage(war.str("Warzone and teams reset. " + resetBlocks + " blocks reset."));
war.getLogger().info(resetBlocks + " blocks reset in warzone " + warzone.getName() + ".");
}
event.setCancelled(true);
}
// /deletewarzone
else if(command.equals("/deletewarzone")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /deletewarzone." +
" Deletes the warzone. " +
"Must be in the warzone (try /warzones and /warzone). "));
} else {
Warzone warzone = war.warzone(player.getLocation());
warzone.removeSoutheast();
warzone.removeNorthwest();
for(Team t : warzone.getTeams()) {
t.getVolume().resetBlocks();
}
for(Monument m : warzone.getMonuments()) {
m.remove();
}
war.getWarzones().remove(warzone);
WarMapper.save(war);
WarzoneMapper.delete(war, warzone.getName());
player.sendMessage(war.str("Warzone " + warzone.getName() + " removed."));
}
event.setCancelled(true);
}
// /monument
else if(command.equals("/setmonument")) {
else if(command.equals("setmonument")) {
if(!war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /setmonument <name>. Creates or moves a monument. Must be in warzone."));
} else {
Warzone warzone = war.warzone(player.getLocation());
String monumentName = split[1];
String monumentName = arguments[0];
if(warzone.hasMonument(monumentName)) {
// move the existing monument
Monument monument = warzone.getMonument(monumentName);
@ -424,7 +445,7 @@ public class WarPlayerListener extends PlayerListener {
player.sendMessage(war.str("Monument " + monument.getName() + " was moved."));
} else {
// create a new monument
Monument monument = new Monument(split[1], war, warzone, player.getLocation());
Monument monument = new Monument(arguments[0], war, warzone, player.getLocation());
warzone.getMonuments().add(monument);
player.sendMessage(war.str("Monument " + monument.getName() + " created."));
}
@ -434,7 +455,7 @@ public class WarPlayerListener extends PlayerListener {
}
// /deletemonument <name>
else if(command.equals("/deletemonument")) {
else if(command.equals("deletemonument")) {
if(arguments.length < 1 || !war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /deletemonument <team-name>." +
" Deletes the monument. " +

View File

@ -3,9 +3,16 @@ package com.tommytony.war;
import org.bukkit.Location;
import org.bukkit.Material;
import bukkit.tommytony.war.War;
import com.tommytony.war.volumes.CenteredVolume;
import com.tommytony.war.volumes.Volume;
/**
*
* @author tommytony
*
*/
public class Monument {
private Location location;
private CenteredVolume volume;
@ -22,7 +29,7 @@ public class Monument {
warzone.getWorld().getBlockAt(location.getBlockX(),
location.getBlockY() + 2,
location.getBlockZ()),
5, war, warzone);
7, war, warzone);
volume.saveBlocks();
this.addMonumentBlocks();
}
@ -34,29 +41,28 @@ public class Monument {
int z = location.getBlockZ();
// center
warzone.getWorld().getBlockAt(x, y, z).getState().setType(Material.Air);
warzone.getWorld().getBlockAt(x, y-1, z).setType(Material.Soil);
warzone.getWorld().getBlockAt(x, y-1, z).getState().setType(Material.Air);
warzone.getWorld().getBlockAt(x, y-2, z).setType(Material.LightStone);
// inner ring
warzone.getWorld().getBlockAt(x+1, y-1, z+1).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x+1, y-1, z+1).setType(Material.LightStone);
warzone.getWorld().getBlockAt(x+1, y-1, z).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x+1, y-1, z-1).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x+1, y-1, z-1).setType(Material.LightStone);
warzone.getWorld().getBlockAt(x, y-1, z+1).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x, y-1, z).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.Obsidian);
warzone.getWorld().getBlockAt(x-1, y-1, z+1).setType(Material.LightStone);
warzone.getWorld().getBlockAt(x-1, y-1, z).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x-1, y-1, z-1).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x-1, y-1, z-1).setType(Material.LightStone);
// outer ring
warzone.getWorld().getBlockAt(x+2, y-1, z+2).setType(Material.LightStone);
warzone.getWorld().getBlockAt(x+2, y-1, z+2).setType(Material.Obsidian);
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.LightStone);
warzone.getWorld().getBlockAt(x+2, y-1, z-2).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x-1, y-1, z+2).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x-1, y-1, z-2).setType(Material.Obsidian);
@ -67,23 +73,22 @@ 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.LightStone);
warzone.getWorld().getBlockAt(x-2, y-1, z+2).setType(Material.Obsidian);
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.LightStone);
warzone.getWorld().getBlockAt(x-2, y-1, z-2).setType(Material.Obsidian);
// center block level ring
warzone.getWorld().getBlockAt(x+1, y, z+1).setType(Material.Step);
warzone.getWorld().getBlockAt(x+1, y, z).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x+1, y, z-1).setType(Material.Step);
// 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);
warzone.getWorld().getBlockAt(x, y, z+1).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x, y, z-1).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x-1, y, z+1).setType(Material.Step);
warzone.getWorld().getBlockAt(x-1, y, z).setType(Material.Obsidian);
warzone.getWorld().getBlockAt(x-1, y, z-1).setType(Material.Step);
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);
}
public boolean isNear(Location playerLocation) {
@ -115,16 +120,17 @@ public class Monument {
public void capture(Team team) {
ownerTeam = team;
warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()).setType(team.getMaterial());
}
public void uncapture() {
ownerTeam = null;
warzone.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()).setType(Material.Obsidian);
}
public void remove() {
volume.resetBlocks();
volume.resetBlocks();
}
public Location getLocation() {
@ -143,7 +149,6 @@ public class Monument {
public void setLocation(Location location) {
this.location = location;
volume.resetBlocks();
volume.changeCenter(location);
this.addMonumentBlocks();
}

View File

@ -10,8 +10,15 @@ import org.bukkit.Player;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import bukkit.tommytony.war.War;
import com.tommytony.war.volumes.Volume;
/**
*
* @author tommytony
*
*/
public class Team {
private List<Player> players = new ArrayList<Player>();
private Location teamSpawn = null;
@ -104,19 +111,22 @@ public class Team {
warzone.getWorld().getBlockAt(x+2, y, z-1).setType(material);
// tower
//warzone.getWorld().getBlockAt(x-2, y+1, z+1).setType(material);
warzone.getWorld().getBlockAt(x-2, y+1, z).setType(material);
warzone.getWorld().getBlockAt(x-2, y+1, z-1).setType(material);
warzone.getWorld().getBlockAt(x-2, y+1, z-2).setType(material);
warzone.getWorld().getBlockAt(x-1, y+1, z-2).setType(material);
warzone.getWorld().getBlockAt(x, y+1, z-2).setType(material);
//warzone.getWorld().getBlockAt(x+1, y+1, z-2).setType(material);
//warzone.getWorld().getBlockAt(x-2, y+2, z).setType(material);
warzone.getWorld().getBlockAt(x-2, y+2, z-1).setType(material);
warzone.getWorld().getBlockAt(x-2, y+2, z-2).setType(material);
warzone.getWorld().getBlockAt(x-1, y+2, z-2).setType(material);
//warzone.getWorld().getBlockAt(x, y+2, z-2).setType(material);
//warzone.getWorld().getBlockAt(x-2, y+3, z-2).setType(Material.LightStone);
warzone.getWorld().getBlockAt(x-2, y+3, z-2).setType(material);
warzone.getWorld().getBlockAt(x-2, y+4, z-2).setType(Material.LightStone);
warzone.getWorld().getBlockAt(x-2, y+4, z-2).setType(material);
resetSign();
@ -198,7 +208,7 @@ public class Team {
sign.setLine(1, name);
sign.setLine(2, points + " pts");
sign.setLine(3, remainingTickets + "/" + warzone.getLifePool() + " lives left");
state.update(true);
}
}

View File

@ -2,6 +2,11 @@ package com.tommytony.war;
import org.bukkit.Material;
/**
*
* @author tommytony
*
*/
public class TeamMaterials {
public static final Material TEAMDIAMOND = Material.DiamondBlock;
public static final Material TEAMIRON = Material.IronBlock;

View File

@ -4,18 +4,24 @@ import java.util.HashMap;
import java.util.List;
import org.bukkit.Block;
import org.bukkit.BlockFace;
import org.bukkit.ItemStack;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Player;
import org.bukkit.PlayerInventory;
import org.bukkit.World;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import bukkit.tommytony.war.War;
import com.tommytony.war.volumes.VerticalVolume;
import com.tommytony.war.volumes.Volume;
/**
*
* @author tommytony
*
*/
public class Warzone {
private String name;
private VerticalVolume volume;
@ -79,77 +85,20 @@ public class Warzone {
}
public void setNorthwest(Location northwest) {
// remove old nw sign, if any (replace with air)
if(this.northwest != null) {
removeNorthwest();
}
this.northwest = northwest;
this.volume.setCornerOne(world.getBlockAt(northwest.getBlockX(), northwest.getBlockY(), northwest.getBlockZ()));
// add sign
int x = northwest.getBlockX();
int y = northwest.getBlockY();
int z = northwest.getBlockZ();
Block block = world.getBlockAt(x, y, z);
block.setType(Material.SignPost);
block.setData((byte)10); // towards southeast
BlockState state = block.getState();
Sign sign = (Sign)state;
sign.setLine(0, "Northwest");
sign.setLine(1, "corner of");
sign.setLine(2, "warzone");
sign.setLine(3, name);
state.update();
saveState();
}
public void removeNorthwest() {
int x = northwest.getBlockX();
int y = northwest.getBlockY();
int z = northwest.getBlockZ();
world.getBlockAt(x, y, z).setTypeID(0);
}
public Location getNorthwest() {
return northwest;
}
public void setSoutheast(Location southeast) {
// remove old se sign, if any (replace with air)
if(this.southeast != null) {
removeSoutheast();
}
this.southeast = southeast;
this.volume.setCornerTwo(world.getBlockAt(southeast.getBlockX(), southeast.getBlockY(), southeast.getBlockZ()));
// add sign
int x = southeast.getBlockX();
int y = southeast.getBlockY();
int z = southeast.getBlockZ();
Block block = world.getBlockAt(x, y, z); // towards northwest
block.setType(Material.SignPost);
block.setData((byte)2);;
BlockState state = block.getState();
Sign sign = (Sign)state;
sign.setLine(0, "Southeast");
sign.setLine(1, "corner of");
sign.setLine(2, "warzone");
sign.setLine(3, name);
state.update();
saveState();
this.volume.setCornerTwo(world.getBlockAt(southeast.getBlockX(), southeast.getBlockY(), southeast.getBlockZ()));
}
public void removeSoutheast() {
int x = southeast.getBlockX();
int y = southeast.getBlockY();
int z = southeast.getBlockZ();
world.getBlockAt(x, y, z).setTypeID(0);
}
public Location getSoutheast() {
return southeast;
}
@ -174,9 +123,41 @@ public class Warzone {
* Also teleports all players back to their respective spawns.
* @return
*/
public int resetState() {
if(ready() && volume.isSaved()){
int reset = volume.resetBlocks();
public void initializeZone() {
if(ready() && volume.isSaved()){
// get surface corners
volume.getMinX();
volume.getMinZ();
volume.getMinY();
int c1maxY = world.getHighestBlockYAt(volume.getMinX(), volume.getMinZ());
int c2maxY = world.getHighestBlockYAt(volume.getMaxX(), volume.getMaxZ());
Block ne = world.getBlockAt(volume.getMinX(), c1maxY, volume.getMinZ());
Block nw = world.getBlockAt(volume.getMinX(), c2maxY, volume.getMaxZ());
Block sw = world.getBlockAt(volume.getMinX(), c1maxY, volume.getMaxZ());
Block se = world.getBlockAt(volume.getMaxX(), c2maxY, volume.getMinZ());
// add north wall, ne - nw
Block lastBlock = null;
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
lastBlock = highestBlockToGlass(ne.getX(), z, lastBlock);
}
// add east, ne - se
lastBlock = null;
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
lastBlock = highestBlockToGlass(x, ne.getZ(), lastBlock);
}
// add south, se - sw
lastBlock = null;
for(int z = volume.getMinZ(); z < volume.getMaxZ(); z++) {
lastBlock = highestBlockToGlass(se.getX(), z, lastBlock);
}
// add west, nw - sw
for(int x = volume.getMinX(); x < volume.getMaxX(); x++) {
lastBlock = highestBlockToGlass(x, nw.getZ(), lastBlock);
}
// everyone back to team spawn with full health
for(Team team : teams) {
@ -196,10 +177,47 @@ public class Warzone {
this.setNorthwest(this.getNorthwest());
this.setSoutheast(this.getSoutheast());
return reset;
}
return 0;
}
private Block highestBlockToGlass(int x, int z, Block lastBlock) {
int highest = world.getHighestBlockYAt(x, z);
Block block = world.getBlockAt(x, highest -1 , z);
if(block.getType() == Material.Leaves) { // top of tree, lets find some dirt
Block over = block.getFace(BlockFace.Down);
Block under = over.getFace(BlockFace.Down);
int treeHeight = 0;
while(!((over.getType() == Material.Air || over.getType() == Material.Leaves || over.getType() == Material.Wood)
&& (under.getType() == Material.Grass || under.getType() == Material.Dirt || under.getType() == Material.Stone))
&& treeHeight < 40) {
over = under;
under = over.getFace(BlockFace.Down);
treeHeight++;
}
block = under; // found the ground
}
block.setType(Material.Glass);
if(lastBlock != null) {
// link the new block and the old vertically if there's a big drop or rise
if(block.getY() - lastBlock.getY() > 2) { // new block too high
Block under = block.getFace(BlockFace.Down);
while(under.getY() != lastBlock.getY() - 1) {
block.setType(Material.Glass);
under = under.getFace(BlockFace.Down);
}
} else if (block.getY() - lastBlock.getY() < -2) { // new block too low
Block over = block.getFace(BlockFace.Up);
while(over.getY() != lastBlock.getY() + 1) {
block.setType(Material.Glass);
over = over.getFace(BlockFace.Up);
}
}
}
return block;
}
public void endRound() {
@ -207,23 +225,35 @@ public class Warzone {
}
public void respawnPlayer(Team team, Player player) {
player.teleportTo(team.getTeamSpawn());
// Reset inventory to loadout
PlayerInventory playerInv = player.getInventory();
for(int i = 0; i < playerInv.getSize(); i++){
playerInv.setItem(i, new ItemStack(Material.Air));
playerInv.setItem(i, null);
}
for(Integer slot : loadout.keySet()) {
playerInv.setItem(slot, loadout.get(slot));
if(slot == 100) {
playerInv.setBoots(loadout.get(slot));
} else if(slot == 101) {
playerInv.setLeggings(loadout.get(slot));
} else if(slot == 102) {
playerInv.setChestplate(loadout.get(slot));
} else if(slot == 103) {
playerInv.setHelmet(loadout.get(slot));
} else {
playerInv.setItem(slot, loadout.get(slot));
}
}
player.setHealth(20);
player.teleportTo(team.getTeamSpawn());
}
public boolean isMonumentCenterBlock(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 true;
@ -289,7 +319,7 @@ public class Warzone {
PlayerInventory inventory = player.getInventory();
List<ItemStack> invToStore = new ArrayList<ItemStack>();
for(int i=0; i < inventory.getSize(); i++) {
invToStore.set(i, inventory.getItem(i));
invToStore.add(i, inventory.getItem(i));
}
inventories.put(player.getName(), invToStore);
}
@ -342,23 +372,25 @@ public class Warzone {
}
private boolean teleportNear(Block block) {
int x = (int)this.teleport.getBlockX();
int y = (int)this.teleport.getBlockY();
int z = (int)this.teleport.getBlockZ();
int bx = block.getX();
int by = block.getY();
int bz = block.getZ();
if((bx == x && by == y && bz == z) ||
(bx == x+1 && by == y-1 && bz == z+1) ||
(bx == x+1 && by == y-1 && bz == z) ||
(bx == x+1 && by == y-1 && bz == z-1) ||
(bx == x && by == y-1 && bz == z+1) ||
(bx == x && by == y-1 && bz == z) ||
(bx == x && by == y-1 && bz == z-1) ||
(bx == x-1 && by == y-1 && bz == z+1) ||
(bx == x-1 && by == y-1 && bz == z) ||
(bx == x-1 && by == y-1 && bz == z-1) ) {
return true;
if(teleport != null) {
int x = (int)this.teleport.getBlockX();
int y = (int)this.teleport.getBlockY();
int z = (int)this.teleport.getBlockZ();
int bx = block.getX();
int by = block.getY();
int bz = block.getZ();
if((bx == x && by == y && bz == z) ||
(bx == x+1 && by == y-1 && bz == z+1) ||
(bx == x+1 && by == y-1 && bz == z) ||
(bx == x+1 && by == y-1 && bz == z-1) ||
(bx == x && by == y-1 && bz == z+1) ||
(bx == x && by == y-1 && bz == z) ||
(bx == x && by == y-1 && bz == z-1) ||
(bx == x-1 && by == y-1 && bz == z+1) ||
(bx == x-1 && by == y-1 && bz == z) ||
(bx == x-1 && by == y-1 && bz == z-1) ) {
return true;
}
}
return false;
}

View File

@ -5,10 +5,15 @@ import java.util.HashMap;
import org.bukkit.ItemStack;
import com.tommytony.war.War;
import bukkit.tommytony.war.War;
import com.tommytony.war.Warzone;
/**
*
* @author tommytony
*
*/
public class WarMapper {
public static void load(War war) {
@ -44,7 +49,8 @@ public class WarMapper {
if(warzoneName != null && !warzoneName.equals("")){
Warzone zone = WarzoneMapper.load(war, warzoneName, !newWar); // cascade load, only load blocks if warzone exists
war.getWarzones().add(zone);
zone.resetState(); // is this wise?
zone.getVolume().resetBlocks();
zone.initializeZone(); // is this wise?
}
}

View File

@ -9,14 +9,19 @@ import org.bukkit.ItemStack;
import org.bukkit.Location;
import org.bukkit.World;
import bukkit.tommytony.war.War;
import com.tommytony.war.Monument;
import com.tommytony.war.Team;
import com.tommytony.war.TeamMaterials;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.volumes.VerticalVolume;
/**
*
* @author tommytony
*
*/
public class WarzoneMapper {
public static Warzone load(War war, String name, boolean loadBlocks) {
@ -51,21 +56,26 @@ public class WarzoneMapper {
// northwest
String nwStr = warzoneConfig.getString("northWest");
String[] nwStrSplit = nwStr.split(",");
int nwX = Integer.parseInt(nwStrSplit[0]);
int nwY = Integer.parseInt(nwStrSplit[1]);
int nwZ = Integer.parseInt(nwStrSplit[2]);
Location nw = new Location(world, nwX, nwY, nwZ);
warzone.setNorthwest(nw);
if(nwStr != null && !nwStr.equals("")) {
String[] nwStrSplit = nwStr.split(",");
int nwX = Integer.parseInt(nwStrSplit[0]);
int nwY = Integer.parseInt(nwStrSplit[1]);
int nwZ = Integer.parseInt(nwStrSplit[2]);
Location nw = new Location(world, nwX, nwY, nwZ);
warzone.setNorthwest(nw);
}
// southeast
String seStr = warzoneConfig.getString("southEast");
String[] seStrSplit = seStr.split(",");
int seX = Integer.parseInt(seStrSplit[0]);
int seY = Integer.parseInt(seStrSplit[1]);
int seZ = Integer.parseInt(seStrSplit[2]);
Location se = new Location(world, seX, seY, seZ);
warzone.setSoutheast(se);
if(nwStr != null && !nwStr.equals("")) {
String[] seStrSplit = seStr.split(",");
int seX = Integer.parseInt(seStrSplit[0]);
int seY = Integer.parseInt(seStrSplit[1]);
int seZ = Integer.parseInt(seStrSplit[2]);
Location se = new Location(world, seX, seY, seZ);
warzone.setSoutheast(se);
}
// teleport
String teleportStr = warzoneConfig.getString("teleport");
@ -79,20 +89,22 @@ public class WarzoneMapper {
// teams
String teamsStr = warzoneConfig.getString("teams");
String[] teamsSplit = teamsStr.split(";");
warzone.getTeams().clear();
for(String teamStr : teamsSplit) {
if(teamStr != null && !teamStr.equals("")){
String[] teamStrSplit = teamStr.split(",");
int teamX = Integer.parseInt(teamStrSplit[1]);
int teamY = Integer.parseInt(teamStrSplit[2]);
int teamZ = Integer.parseInt(teamStrSplit[3]);
Team team = new Team(teamStrSplit[0],
TeamMaterials.teamMaterialFromString(teamStrSplit[0]),
new Location(world, teamX, teamY, teamZ),
war, warzone );
team.setRemainingTickets(warzone.getLifePool());
warzone.getTeams().add(team);
if(teamsStr != null && !teamsStr.equals("")) {
String[] teamsSplit = teamsStr.split(";");
warzone.getTeams().clear();
for(String teamStr : teamsSplit) {
if(teamStr != null && !teamStr.equals("")){
String[] teamStrSplit = teamStr.split(",");
int teamX = Integer.parseInt(teamStrSplit[1]);
int teamY = Integer.parseInt(teamStrSplit[2]);
int teamZ = Integer.parseInt(teamStrSplit[3]);
Team team = new Team(teamStrSplit[0],
TeamMaterials.teamMaterialFromString(teamStrSplit[0]),
new Location(world, teamX, teamY, teamZ),
war, warzone );
team.setRemainingTickets(warzone.getLifePool());
warzone.getTeams().add(team);
}
}
}
@ -101,14 +113,16 @@ public class WarzoneMapper {
// loadout
String loadoutStr = warzoneConfig.getString("loadout");
String[] loadoutStrSplit = loadoutStr.split(";");
warzone.getLoadout().clear();
for(String itemStr : loadoutStrSplit) {
if(itemStr != null && !itemStr.equals("")) {
String[] itemStrSplit = itemStr.split(",");
ItemStack item = new ItemStack(Integer.parseInt(itemStrSplit[0]),
Integer.parseInt(itemStrSplit[1]));
warzone.getLoadout().put(Integer.parseInt(itemStrSplit[2]), item);
if(loadoutStr != null && !loadoutStr.equals("")) {
String[] loadoutStrSplit = loadoutStr.split(";");
warzone.getLoadout().clear();
for(String itemStr : loadoutStrSplit) {
if(itemStr != null && !itemStr.equals("")) {
String[] itemStrSplit = itemStr.split(",");
ItemStack item = new ItemStack(Integer.parseInt(itemStrSplit[0]),
Integer.parseInt(itemStrSplit[1]));
warzone.getLoadout().put(Integer.parseInt(itemStrSplit[2]), item);
}
}
}
@ -117,17 +131,19 @@ public class WarzoneMapper {
// monuments
String monumentsStr = warzoneConfig.getString("monuments");
String[] monumentsSplit = monumentsStr.split(";");
warzone.getMonuments().clear();
for(String monumentStr : monumentsSplit) {
if(monumentStr != null && !monumentStr.equals("")){
String[] monumentStrSplit = monumentStr.split(",");
int monumentX = Integer.parseInt(monumentStrSplit[1]);
int monumentY = Integer.parseInt(monumentStrSplit[2]);
int monumentZ = Integer.parseInt(monumentStrSplit[3]);
Monument monument = new Monument(monumentStrSplit[0], war, warzone,
new Location(world, monumentX, monumentY, monumentZ));
warzone.getMonuments().add(monument);
if(monumentsStr != null && !monumentsStr.equals("")) {
String[] monumentsSplit = monumentsStr.split(";");
warzone.getMonuments().clear();
for(String monumentStr : monumentsSplit) {
if(monumentStr != null && !monumentStr.equals("")){
String[] monumentStrSplit = monumentStr.split(",");
int monumentX = Integer.parseInt(monumentStrSplit[1]);
int monumentY = Integer.parseInt(monumentStrSplit[2]);
int monumentZ = Integer.parseInt(monumentStrSplit[3]);
Monument monument = new Monument(monumentStrSplit[0], war, warzone,
new Location(world, monumentX, monumentY, monumentZ));
warzone.getMonuments().add(monument);
}
}
}
@ -140,8 +156,10 @@ public class WarzoneMapper {
// zone blocks
VerticalVolume zoneVolume = new VerticalVolume("zone", war, warzone);
String stateStr = warzoneBlocksFile.getString("zoneBlocks");
zoneVolume.blocksFromString(stateStr);
warzone.setVolume(zoneVolume);
if(stateStr != null && !stateStr.equals("")) {
zoneVolume.blocksFromString(stateStr);
warzone.setVolume(zoneVolume);
}
// monument blocks
for(Monument monument: warzone.getMonuments()) {

View File

@ -3,7 +3,8 @@ package com.tommytony.war.volumes;
import org.bukkit.Block;
import org.bukkit.Location;
import com.tommytony.war.War;
import bukkit.tommytony.war.War;
import com.tommytony.war.Warzone;
public class CenteredVolume extends Volume {

View File

@ -2,7 +2,8 @@ package com.tommytony.war.volumes;
import org.bukkit.Block;
import com.tommytony.war.War;
import bukkit.tommytony.war.War;
import com.tommytony.war.Warzone;
public class VerticalVolume extends Volume{

View File

@ -9,9 +9,15 @@ import org.bukkit.World;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import com.tommytony.war.War;
import bukkit.tommytony.war.War;
import com.tommytony.war.Warzone;
/**
*
* @author tao
*
*/
public class Volume {
private final String name;
private final World world;

View File

@ -1,3 +1,3 @@
name: War
main: com.tommytony.war.War
main: bukkit.tommytony.war.War
version: 0.3

View File

@ -1,3 +1,3 @@
name: War
main: com.tommytony.war.War
main: bukkit.tommytony.war.War
version: 0.3